git: 13720136fbf9 - main - tcpsso: fix when used without -i option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Jan 2024 07:45:43 UTC
The branch main has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=13720136fbf951a7b472ce086c9cf2de702799ab
commit 13720136fbf951a7b472ce086c9cf2de702799ab
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-01-10 07:33:09 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-01-10 07:33:09 +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
---
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 fa0d7309058e..981654577deb 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -2950,25 +2950,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) {