Skip to content

Commit cb9b4d4

Browse files
committed
Support bind no port like linux's IP_BIND_ADDRESS_NO_PORT.
If you want connect remote server use an specified ip, may be you will use bind, but it won't run ff_rss_check, so the response pkts from server may can't receive by original worker. This commit will run ff_rss_check even if you use bind of a local addr, and fixed this issue. Note: If you use a vip as local addr, the vip must config in nic f-stack-x(default value), but not nic lo.
1 parent 39d70d8 commit cb9b4d4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

freebsd/netinet/in_pcb.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,17 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
661661
&inp->inp_lport, cred);
662662
if (error)
663663
return (error);
664+
#ifdef FSTACK
665+
if (inp->inp_lport != 0) {
666+
#endif
664667
if (in_pcbinshash(inp) != 0) {
665668
inp->inp_laddr.s_addr = INADDR_ANY;
666669
inp->inp_lport = 0;
667670
return (EAGAIN);
668671
}
672+
#ifdef FSTACK
673+
}
674+
#endif
669675
if (anonport)
670676
inp->inp_flags |= INP_ANONPORT;
671677
return (0);
@@ -1062,11 +1068,13 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
10621068
}
10631069
if (*lportp != 0)
10641070
lport = *lportp;
1071+
#ifndef FSTACK
10651072
if (lport == 0) {
10661073
error = in_pcb_lport(inp, &laddr, &lport, cred, lookupflags);
10671074
if (error != 0)
10681075
return (error);
10691076
}
1077+
#endif
10701078
*laddrp = laddr.s_addr;
10711079
*lportp = lport;
10721080
return (0);
@@ -1508,8 +1516,7 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam,
15081516
ifp = ifa->ifa_ifp;
15091517
while (lport == 0) {
15101518
int rss;
1511-
error = in_pcbbind_setup(inp, NULL, &laddr.s_addr, &lport,
1512-
cred);
1519+
error = in_pcb_lport(inp, &laddr, &lport, cred, INPLOOKUP_WILDCARD);
15131520
if (error)
15141521
return (error);
15151522
/* Note:

0 commit comments

Comments
 (0)