Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/toecore.c
Show First 20 Lines • Show All 380 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Note that the TCP header must have been run through tcp_fields_to_host() or | * Note that the TCP header must have been run through tcp_fields_to_host() or | ||||
* equivalent. | * equivalent. | ||||
*/ | */ | ||||
int | int | ||||
toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp) | toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp) | ||||
{ | { | ||||
struct inpcb *inp; | struct inpcb *inp; | ||||
struct tcpcb *tp; | |||||
if (inc->inc_flags & INC_ISIPV6) { | if (inc->inc_flags & INC_ISIPV6) { | ||||
inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr, | inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr, | ||||
inc->inc_fport, &inc->inc6_laddr, inc->inc_lport, | inc->inc_fport, &inc->inc6_laddr, inc->inc_lport, | ||||
INPLOOKUP_RLOCKPCB, ifp); | INPLOOKUP_RLOCKPCB, ifp); | ||||
} else { | } else { | ||||
inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport, | inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport, | ||||
inc->inc_laddr, inc->inc_lport, INPLOOKUP_RLOCKPCB, ifp); | inc->inc_laddr, inc->inc_lport, INPLOOKUP_RLOCKPCB, ifp); | ||||
} | } | ||||
if (inp != NULL) { | if (inp != NULL) { | ||||
INP_RLOCK_ASSERT(inp); | INP_RLOCK_ASSERT(inp); | ||||
if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) { | tp = intotcpcb(inp); | ||||
if (tp->t_state == TCPS_TIME_WAIT && th != NULL) { | |||||
if (!tcp_twcheck(inp, NULL, th, NULL, 0)) | if (!tcp_twcheck(inp, NULL, th, NULL, 0)) | ||||
return (EADDRINUSE); | return (EADDRINUSE); | ||||
} else { | } else { | ||||
INP_RUNLOCK(inp); | INP_RUNLOCK(inp); | ||||
return (EADDRINUSE); | return (EADDRINUSE); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |