git: 13e3f3349f42 - main - in_pcb: fix TCP local ephemeral port accounting
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Dec 2021 20:32:44 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=13e3f3349f42d30bd320b8b5cabecb4d66360c92
commit 13e3f3349f42d30bd320b8b5cabecb4d66360c92
Author: Peter Lei <peterlei@netflix.com>
AuthorDate: 2021-12-03 20:30:21 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-12-03 20:30:21 +0000
in_pcb: fix TCP local ephemeral port accounting
Fix logic error causing UDP(-Lite) local ephemeral port bindings
to count against the TCP allocation counter, potentially causing
TCP to go from random to sequential port allocation mode prematurely.
---
sys/netinet/in_pcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 081d204f559c..a894163ed5a6 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -748,7 +748,7 @@ in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, u_short *lportp,
if (first == last)
dorandom = 0;
/* Make sure to not include UDP(-Lite) packets in the count. */
- if (pcbinfo != &V_udbinfo || pcbinfo != &V_ulitecbinfo)
+ if (pcbinfo != &V_udbinfo && pcbinfo != &V_ulitecbinfo)
V_ipport_tcpallocs++;
/*
* Instead of having two loops further down counting up or down