Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_syncache.c
Show First 20 Lines • Show All 825 Lines • ▼ Show 20 Lines | #ifdef INET6 | ||||
if (sc->sc_inc.inc_flags & INC_ISIPV6) { | if (sc->sc_inc.inc_flags & INC_ISIPV6) { | ||||
inp->inp_vflag &= ~INP_IPV4; | inp->inp_vflag &= ~INP_IPV4; | ||||
inp->inp_vflag |= INP_IPV6; | inp->inp_vflag |= INP_IPV6; | ||||
inp->in6p_laddr = sc->sc_inc.inc6_laddr; | inp->in6p_laddr = sc->sc_inc.inc6_laddr; | ||||
} else { | } else { | ||||
inp->inp_vflag &= ~INP_IPV6; | inp->inp_vflag &= ~INP_IPV6; | ||||
inp->inp_vflag |= INP_IPV4; | inp->inp_vflag |= INP_IPV4; | ||||
#endif | #endif | ||||
inp->inp_ip_ttl = sc->sc_ip_ttl; | |||||
inp->inp_ip_tos = sc->sc_ip_tos; | |||||
inp->inp_laddr = sc->sc_inc.inc_laddr; | inp->inp_laddr = sc->sc_inc.inc_laddr; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* If there's an mbuf and it has a flowid, then let's initialise the | * If there's an mbuf and it has a flowid, then let's initialise the | ||||
* inp with that particular flowid. | * inp with that particular flowid. | ||||
Show All 19 Lines | if (inp->inp_vflag & INP_IPV6PROTO) { | ||||
* previous one and hence should be passed to a user. | * previous one and hence should be passed to a user. | ||||
* If we copied in6p_inputopts, a user would not be able to | * If we copied in6p_inputopts, a user would not be able to | ||||
* receive options just after calling the accept system call. | * receive options just after calling the accept system call. | ||||
*/ | */ | ||||
inp->inp_flags |= oinp->inp_flags & INP_CONTROLOPTS; | inp->inp_flags |= oinp->inp_flags & INP_CONTROLOPTS; | ||||
if (oinp->in6p_outputopts) | if (oinp->in6p_outputopts) | ||||
inp->in6p_outputopts = | inp->in6p_outputopts = | ||||
ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT); | ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT); | ||||
inp->in6p_hops = oinp->in6p_hops; | |||||
} | } | ||||
if (sc->sc_inc.inc_flags & INC_ISIPV6) { | if (sc->sc_inc.inc_flags & INC_ISIPV6) { | ||||
struct in6_addr laddr6; | struct in6_addr laddr6; | ||||
struct sockaddr_in6 sin6; | struct sockaddr_in6 sin6; | ||||
sin6.sin6_family = AF_INET6; | sin6.sin6_family = AF_INET6; | ||||
sin6.sin6_len = sizeof(sin6); | sin6.sin6_len = sizeof(sin6); | ||||
▲ Show 20 Lines • Show All 507 Lines • ▼ Show 20 Lines | #endif | ||||
* soon as possible. | * soon as possible. | ||||
*/ | */ | ||||
so = *lsop; | so = *lsop; | ||||
KASSERT(SOLISTENING(so), ("%s: %p not listening", __func__, so)); | KASSERT(SOLISTENING(so), ("%s: %p not listening", __func__, so)); | ||||
tp = sototcpcb(so); | tp = sototcpcb(so); | ||||
cred = crhold(so->so_cred); | cred = crhold(so->so_cred); | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if ((inc->inc_flags & INC_ISIPV6) && | if (inc->inc_flags & INC_ISIPV6) { | ||||
(inp->inp_flags & IN6P_AUTOFLOWLABEL)) | if (inp->inp_flags & IN6P_AUTOFLOWLABEL) { | ||||
autoflowlabel = 1; | autoflowlabel = 1; | ||||
} | |||||
ip_ttl = in6_selecthlim(inp, NULL); | |||||
if ((inp->in6p_outputopts == NULL) || | |||||
(inp->in6p_outputopts->ip6po_tclass == -1)) { | |||||
ip_tos = 0; | |||||
} else { | |||||
ip_tos = inp->in6p_outputopts->ip6po_tclass; | |||||
} | |||||
} | |||||
#endif | #endif | ||||
#if defined(INET6) && defined(INET) | |||||
else | |||||
#endif | |||||
#ifdef INET | |||||
{ | |||||
ip_ttl = inp->inp_ip_ttl; | ip_ttl = inp->inp_ip_ttl; | ||||
ip_tos = inp->inp_ip_tos; | ip_tos = inp->inp_ip_tos; | ||||
} | |||||
#endif | |||||
win = so->sol_sbrcv_hiwat; | win = so->sol_sbrcv_hiwat; | ||||
ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); | ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); | ||||
if (V_tcp_fastopen_server_enable && IS_FASTOPEN(tp->t_flags) && | if (V_tcp_fastopen_server_enable && IS_FASTOPEN(tp->t_flags) && | ||||
(tp->t_tfo_pending != NULL) && | (tp->t_tfo_pending != NULL) && | ||||
(to->to_flags & TOF_FASTOPEN)) { | (to->to_flags & TOF_FASTOPEN)) { | ||||
/* | /* | ||||
* Limit the number of pending TFO connections to | * Limit the number of pending TFO connections to | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | skip_alloc: | ||||
*/ | */ | ||||
#ifdef MAC | #ifdef MAC | ||||
sc->sc_label = maclabel; | sc->sc_label = maclabel; | ||||
#endif | #endif | ||||
sc->sc_cred = cred; | sc->sc_cred = cred; | ||||
cred = NULL; | cred = NULL; | ||||
sc->sc_ipopts = ipopts; | sc->sc_ipopts = ipopts; | ||||
bcopy(inc, &sc->sc_inc, sizeof(struct in_conninfo)); | bcopy(inc, &sc->sc_inc, sizeof(struct in_conninfo)); | ||||
#ifdef INET6 | |||||
if (!(inc->inc_flags & INC_ISIPV6)) | |||||
#endif | |||||
{ | |||||
sc->sc_ip_tos = ip_tos; | sc->sc_ip_tos = ip_tos; | ||||
sc->sc_ip_ttl = ip_ttl; | sc->sc_ip_ttl = ip_ttl; | ||||
} | |||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
sc->sc_tod = tod; | sc->sc_tod = tod; | ||||
sc->sc_todctx = todctx; | sc->sc_todctx = todctx; | ||||
#endif | #endif | ||||
sc->sc_irs = th->th_seq; | sc->sc_irs = th->th_seq; | ||||
sc->sc_flags = 0; | sc->sc_flags = 0; | ||||
sc->sc_flowlabel = 0; | sc->sc_flowlabel = 0; | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | if (sc->sc_inc.inc_flags & INC_ISIPV6) { | ||||
ip6->ip6_nxt = IPPROTO_TCP; | ip6->ip6_nxt = IPPROTO_TCP; | ||||
ip6->ip6_src = sc->sc_inc.inc6_laddr; | ip6->ip6_src = sc->sc_inc.inc6_laddr; | ||||
ip6->ip6_dst = sc->sc_inc.inc6_faddr; | ip6->ip6_dst = sc->sc_inc.inc6_faddr; | ||||
ip6->ip6_plen = htons(tlen - hlen); | ip6->ip6_plen = htons(tlen - hlen); | ||||
/* ip6_hlim is set after checksum */ | /* ip6_hlim is set after checksum */ | ||||
/* Zero out traffic class and flow label. */ | /* Zero out traffic class and flow label. */ | ||||
ip6->ip6_flow &= ~IPV6_FLOWINFO_MASK; | ip6->ip6_flow &= ~IPV6_FLOWINFO_MASK; | ||||
ip6->ip6_flow |= sc->sc_flowlabel; | ip6->ip6_flow |= sc->sc_flowlabel; | ||||
ip6->ip6_flow |= htonl(sc->sc_ip_tos << 20); | |||||
th = (struct tcphdr *)(ip6 + 1); | th = (struct tcphdr *)(ip6 + 1); | ||||
} | } | ||||
#endif | #endif | ||||
#if defined(INET6) && defined(INET) | #if defined(INET6) && defined(INET) | ||||
else | else | ||||
#endif | #endif | ||||
#ifdef INET | #ifdef INET | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | if (m0 != NULL && M_HASHTYPE_GET(m0) != M_HASHTYPE_NONE) { | ||||
m->m_pkthdr.flowid = m0->m_pkthdr.flowid; | m->m_pkthdr.flowid = m0->m_pkthdr.flowid; | ||||
M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0)); | M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0)); | ||||
} | } | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (sc->sc_inc.inc_flags & INC_ISIPV6) { | if (sc->sc_inc.inc_flags & INC_ISIPV6) { | ||||
m->m_pkthdr.csum_flags = CSUM_TCP_IPV6; | m->m_pkthdr.csum_flags = CSUM_TCP_IPV6; | ||||
th->th_sum = in6_cksum_pseudo(ip6, tlen + optlen - hlen, | th->th_sum = in6_cksum_pseudo(ip6, tlen + optlen - hlen, | ||||
IPPROTO_TCP, 0); | IPPROTO_TCP, 0); | ||||
ip6->ip6_hlim = in6_selecthlim(NULL, NULL); | ip6->ip6_hlim = sc->sc_ip_ttl; | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if (ADDED_BY_TOE(sc)) { | if (ADDED_BY_TOE(sc)) { | ||||
struct toedev *tod = sc->sc_tod; | struct toedev *tod = sc->sc_tod; | ||||
error = tod->tod_syncache_respond(tod, sc->sc_todctx, m); | error = tod->tod_syncache_respond(tod, sc->sc_todctx, m); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 540 Lines • Show Last 20 Lines |