Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 1,795 Lines • ▼ Show 20 Lines | #endif /* INET6 */ | ||||
int optlen, tlen, win, ulen; | int optlen, tlen, win, ulen; | ||||
int ect = 0; | int ect = 0; | ||||
bool incl_opts; | bool incl_opts; | ||||
uint16_t port; | uint16_t port; | ||||
int output_ret; | int output_ret; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
int thflags = tcp_get_flags(th); | int thflags = tcp_get_flags(th); | ||||
#endif | #endif | ||||
KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL")); | KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL")); | ||||
NET_EPOCH_ASSERT(); | NET_EPOCH_ASSERT(); | ||||
#ifdef INET6 | #ifdef INET6 | ||||
isipv6 = ((struct ip *)ipgen)->ip_v == (IPV6_VERSION >> 4); | isipv6 = ((struct ip *)ipgen)->ip_v == (IPV6_VERSION >> 4); | ||||
ip6 = ipgen; | ip6 = ipgen; | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
ip = ipgen; | ip = ipgen; | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | if (tp->t_flags & TF_RCVD_TSTMP) { | ||||
to.to_tsecr = tp->ts_recent; | to.to_tsecr = tp->ts_recent; | ||||
to.to_flags |= TOF_TS; | to.to_flags |= TOF_TS; | ||||
} | } | ||||
#if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE) | #if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE) | ||||
/* TCP-MD5 (RFC2385). */ | /* TCP-MD5 (RFC2385). */ | ||||
if (tp->t_flags & TF_SIGNATURE) | if (tp->t_flags & TF_SIGNATURE) | ||||
to.to_flags |= TOF_SIGNATURE; | to.to_flags |= TOF_SIGNATURE; | ||||
#endif | #endif | ||||
/* AccECN option */ | |||||
if (V_tcp_ecn_option && | |||||
((V_tcp_do_ecn == 3) || (V_tcp_do_ecn == 4)) && | |||||
(tp->t_flags2 & TF2_ACE_PERMIT)) { | |||||
to.to_flags |= TOF_ACCECNOPT; | |||||
to.to_ae = &tp->t_ae; | |||||
to.to_flags |= ((tp->t_flags2 & TF2_ACO_E0) ? TOF_ACCE_E0 : 0) | | |||||
((tp->t_flags2 & TF2_ACO_E1) ? TOF_ACCE_E1 : 0) | | |||||
((tp->t_flags2 & TF2_ACO_CE) ? TOF_ACCE_CE : 0); | |||||
} | |||||
/* Add the options. */ | /* Add the options. */ | ||||
tlen += optlen = tcp_addoptions(&to, optp); | tlen += optlen = tcp_addoptions(&to, optp); | ||||
if (to.to_flags & TOF_ACCECNOPT) { | |||||
if ((to.to_flags & TOF_ACCE_E0) == 0) | |||||
tp->t_flags2 &= ~TF2_ACO_E0; | |||||
if ((to.to_flags & TOF_ACCE_E1) == 0) | |||||
tp->t_flags2 &= ~TF2_ACO_E1; | |||||
if ((to.to_flags & TOF_ACCE_CE) == 0) | |||||
tp->t_flags2 &= ~TF2_ACO_CE; | |||||
} | |||||
/* Update m_len in the correct mbuf. */ | /* Update m_len in the correct mbuf. */ | ||||
optm->m_len += optlen; | optm->m_len += optlen; | ||||
} else | } else | ||||
optlen = 0; | optlen = 0; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (isipv6) { | if (isipv6) { | ||||
if (uh) { | if (uh) { | ||||
ulen = tlen - sizeof(struct ip6_hdr); | ulen = tlen - sizeof(struct ip6_hdr); | ||||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | #ifdef TCPPCAP | ||||
*/ | */ | ||||
tcp_pcap_tcpcb_init(tp); | tcp_pcap_tcpcb_init(tp); | ||||
#endif | #endif | ||||
#ifdef TCP_BLACKBOX | #ifdef TCP_BLACKBOX | ||||
/* Initialize the per-TCPCB log data. */ | /* Initialize the per-TCPCB log data. */ | ||||
tcp_log_tcpcbinit(tp); | tcp_log_tcpcbinit(tp); | ||||
#endif | #endif | ||||
tp->t_pacing_rate = -1; | tp->t_pacing_rate = -1; | ||||
if (V_tcp_do_lrd) | |||||
tp->t_flags |= TF_LRD; | |||||
tp->t_ae.re0b = 1; | |||||
tp->t_ae.re1b = 1; | |||||
tp->t_ae.rceb = 0; | |||||
tp->t_ae.se0b = 1; | |||||
tp->t_ae.se1b = 1; | |||||
tp->t_ae.sceb = 0; | |||||
if (tp->t_fb->tfb_tcp_fb_init) { | if (tp->t_fb->tfb_tcp_fb_init) { | ||||
if ((*tp->t_fb->tfb_tcp_fb_init)(tp)) { | if ((*tp->t_fb->tfb_tcp_fb_init)(tp)) { | ||||
refcount_release(&tp->t_fb->tfb_refcnt); | refcount_release(&tp->t_fb->tfb_refcnt); | ||||
in_pcbrele_wlocked(inp); | in_pcbrele_wlocked(inp); | ||||
uma_zfree(V_tcpcb_zone, tm); | uma_zfree(V_tcpcb_zone, tm); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,765 Lines • Show Last 20 Lines |