git: 6b019c30ace1 - stable/14 - tcpsso: fix when used without -i option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Jan 2024 15:55:30 UTC
The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6b019c30ace18b49822ca0869227e677c4ca8081 commit 6b019c30ace18b49822ca0869227e677c4ca8081 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2024-01-10 07:33:09 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2024-01-12 15:41:49 +0000 tcpsso: fix when used without -i option Since fdb987bebddf it is not possible anymore to use inp_next iterator for bound, but unconnected sockets. This applies to TCP listening sockets. Therefore the metioned commit broke tcpsso on listening sockets if the -i option was not used. Fix this by iterating through all endpoints instead of only through the bound, but unconnected ones. Reviewed by: markj Fixes: fdb987bebddf ("inpcb: Split PCB hash tables") Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D43353 (cherry picked from commit 13720136fbf951a7b472ce086c9cf2de702799ab) --- sys/netinet/in_pcb.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index b00d61eaecf7..95e162e60f53 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2991,25 +2991,22 @@ sysctl_setsockopt(SYSCTL_HANDLER_ARGS, struct inpcbinfo *pcbinfo, htons(params->sop_inc.inc6_zoneid & 0xffff); } #endif - if (params->sop_inc.inc_lport != htons(0)) { - if (params->sop_inc.inc_fport == htons(0)) - inpi.hash = INP_PCBHASH_WILD(params->sop_inc.inc_lport, + if (params->sop_inc.inc_lport != htons(0) && + params->sop_inc.inc_fport != htons(0)) { +#ifdef INET6 + if (params->sop_inc.inc_flags & INC_ISIPV6) + inpi.hash = INP6_PCBHASH( + ¶ms->sop_inc.inc6_faddr, + params->sop_inc.inc_lport, + params->sop_inc.inc_fport, pcbinfo->ipi_hashmask); else -#ifdef INET6 - if (params->sop_inc.inc_flags & INC_ISIPV6) - inpi.hash = INP6_PCBHASH( - ¶ms->sop_inc.inc6_faddr, - params->sop_inc.inc_lport, - params->sop_inc.inc_fport, - pcbinfo->ipi_hashmask); - else #endif - inpi.hash = INP_PCBHASH( - ¶ms->sop_inc.inc_faddr, - params->sop_inc.inc_lport, - params->sop_inc.inc_fport, - pcbinfo->ipi_hashmask); + inpi.hash = INP_PCBHASH( + ¶ms->sop_inc.inc_faddr, + params->sop_inc.inc_lport, + params->sop_inc.inc_fport, + pcbinfo->ipi_hashmask); } while ((inp = inp_next(&inpi)) != NULL) if (inp->inp_gencnt == params->sop_id) {