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.
This commit is contained in:
Peter Lei 2021-12-03 12:30:21 -08:00 committed by Gleb Smirnoff
parent 5577aa338a
commit 13e3f3349f

View file

@ -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