Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_syncache.c
Show First 20 Lines • Show All 2,211 Lines • ▼ Show 20 Lines | TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) { | ||||
if (cr_cansee(req->td->td_ucred, sc->sc_cred) != 0) | if (cr_cansee(req->td->td_ucred, sc->sc_cred) != 0) | ||||
continue; | continue; | ||||
bzero(&xt, sizeof(xt)); | bzero(&xt, sizeof(xt)); | ||||
xt.xt_len = sizeof(xt); | xt.xt_len = sizeof(xt); | ||||
if (sc->sc_inc.inc_flags & INC_ISIPV6) | if (sc->sc_inc.inc_flags & INC_ISIPV6) | ||||
xt.xt_inp.inp_vflag = INP_IPV6; | xt.xt_inp.inp_vflag = INP_IPV6; | ||||
else | else | ||||
xt.xt_inp.inp_vflag = INP_IPV4; | xt.xt_inp.inp_vflag = INP_IPV4; | ||||
bcopy(&sc->sc_inc, &xt.xt_inp.inp_inc, sizeof (struct in_conninfo)); | bcopy(&sc->sc_inc, &xt.xt_inp.inp_inc, | ||||
xt.xt_tp.t_inpcb = &xt.xt_inp; | sizeof (struct in_conninfo)); | ||||
xt.xt_tp.t_state = TCPS_SYN_RECEIVED; | xt.t_state = TCPS_SYN_RECEIVED; | ||||
xt.xt_socket.xso_protocol = IPPROTO_TCP; | xt.xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; | ||||
xt.xt_socket.xso_len = sizeof (struct xsocket); | xt.xt_inp.xi_socket.xso_len = sizeof (struct xsocket); | ||||
xt.xt_socket.so_type = SOCK_STREAM; | xt.xt_inp.xi_socket.so_type = SOCK_STREAM; | ||||
xt.xt_socket.so_state = SS_ISCONNECTING; | xt.xt_inp.xi_socket.so_state = SS_ISCONNECTING; | ||||
error = SYSCTL_OUT(req, &xt, sizeof xt); | error = SYSCTL_OUT(req, &xt, sizeof xt); | ||||
if (error) { | if (error) { | ||||
SCH_UNLOCK(sch); | SCH_UNLOCK(sch); | ||||
goto exit; | goto exit; | ||||
} | } | ||||
count++; | count++; | ||||
} | } | ||||
SCH_UNLOCK(sch); | SCH_UNLOCK(sch); | ||||
} | } | ||||
exit: | exit: | ||||
*pcbs_exported = count; | *pcbs_exported = count; | ||||
return error; | return error; | ||||
} | } |