Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/udp_usrreq.c
Show First 20 Lines • Show All 1,246 Lines • ▼ Show 20 Lines | if (sin != NULL) { | ||||
* If we already have a valid binding and we're not | * If we already have a valid binding and we're not | ||||
* requesting a destination address rewrite, use a fast path. | * requesting a destination address rewrite, use a fast path. | ||||
*/ | */ | ||||
if (inp->inp_laddr.s_addr == INADDR_ANY || | if (inp->inp_laddr.s_addr == INADDR_ANY || | ||||
inp->inp_lport == 0 || | inp->inp_lport == 0 || | ||||
sin->sin_addr.s_addr == INADDR_ANY || | sin->sin_addr.s_addr == INADDR_ANY || | ||||
sin->sin_addr.s_addr == INADDR_BROADCAST) { | sin->sin_addr.s_addr == INADDR_BROADCAST) { | ||||
INP_HASH_WLOCK(pcbinfo); | INP_HASH_WLOCK(pcbinfo); | ||||
error = in_pcbconnect_setup(inp, addr, &laddr.s_addr, | error = in_pcbconnect_setup(inp, sin, &laddr.s_addr, | ||||
&lport, &faddr.s_addr, &fport, NULL, | &lport, &faddr.s_addr, &fport, NULL, | ||||
td->td_ucred); | td->td_ucred); | ||||
if (error) { | if (error) { | ||||
INP_HASH_WUNLOCK(pcbinfo); | INP_HASH_WUNLOCK(pcbinfo); | ||||
goto release; | goto release; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td) | ||||
} | } | ||||
error = prison_remote_ip4(td->td_ucred, &sin->sin_addr); | error = prison_remote_ip4(td->td_ucred, &sin->sin_addr); | ||||
if (error != 0) { | if (error != 0) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (error); | return (error); | ||||
} | } | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
INP_HASH_WLOCK(pcbinfo); | INP_HASH_WLOCK(pcbinfo); | ||||
error = in_pcbconnect(inp, nam, td->td_ucred, true); | error = in_pcbconnect(inp, sin, td->td_ucred, true); | ||||
INP_HASH_WUNLOCK(pcbinfo); | INP_HASH_WUNLOCK(pcbinfo); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
if (error == 0) | if (error == 0) | ||||
soisconnected(so); | soisconnected(so); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |