mirror of https://github.com/F-Stack/f-stack.git
Revert "Merge branch 'master' of https://github.com/F-Stack/f-stack"
Refer #322 #323 #343 This reverts commit2bc927fd77
, reversing changes made to2576201343
.
This commit is contained in:
parent
22a4ca445e
commit
fe45045298
|
@ -1126,9 +1126,6 @@ if (lport == 0)
|
||||||
ifp_sin.sin_len = sizeof(ifp_sin);
|
ifp_sin.sin_len = sizeof(ifp_sin);
|
||||||
ifa = ifa_ifwithnet((struct sockaddr *)&ifp_sin, 0, RT_ALL_FIBS);
|
ifa = ifa_ifwithnet((struct sockaddr *)&ifp_sin, 0, RT_ALL_FIBS);
|
||||||
if (ifa == NULL) {
|
if (ifa == NULL) {
|
||||||
ifp_sin.sin_addr.s_addr = faddr.s_addr;
|
|
||||||
ifa = ifa_ifwithnet((struct sockaddr *)&ifp_sin, 0, RT_ALL_FIBS);
|
|
||||||
if ( ifa == NULL )
|
|
||||||
return (EADDRNOTAVAIL);
|
return (EADDRNOTAVAIL);
|
||||||
}
|
}
|
||||||
ifp = ifa->ifa_ifp;
|
ifp = ifa->ifa_ifp;
|
||||||
|
|
|
@ -1321,21 +1321,13 @@ tcp_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
|
||||||
error = EADDRINUSE;
|
error = EADDRINUSE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// inp->inp_lport != lport means in_pcbconnect_setup selected new port to inp->inp_lport.
|
|
||||||
// inp will inhash.
|
|
||||||
if (in_pcbinshash(inp) != 0) {
|
if (in_pcbinshash(inp) != 0) {
|
||||||
inp->inp_laddr.s_addr = INADDR_ANY;
|
inp->inp_laddr.s_addr = INADDR_ANY;
|
||||||
inp->inp_lport = 0;
|
inp->inp_lport = 0;
|
||||||
return (EAGAIN);
|
return (EAGAIN);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// app call bind() and connect(), lport is set when bind, and the inp is inhashed in bind() function.
|
|
||||||
// in_pcbconnect_setup() update inp->inp_faddr/inp->inp_fport, so inp should be rehashed.
|
|
||||||
in_pcbrehash(inp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anonport) {
|
if (anonport) {
|
||||||
inp->inp_flags |= INP_ANONPORT;
|
inp->inp_flags |= INP_ANONPORT;
|
||||||
|
|
Loading…
Reference in New Issue