Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
Show First 20 Lines • Show All 980 Lines • ▼ Show 20 Lines | if (isipv6) { | ||||
goto dropunlock; | goto dropunlock; | ||||
} else | } else | ||||
#endif | #endif | ||||
if (inp->inp_ip_minttl > ip->ip_ttl) | if (inp->inp_ip_minttl > ip->ip_ttl) | ||||
goto dropunlock; | goto dropunlock; | ||||
} | } | ||||
tp = intotcpcb(inp); | tp = intotcpcb(inp); | ||||
to.to_ae = &tp->t_ae; | |||||
switch (tp->t_state) { | switch (tp->t_state) { | ||||
case TCPS_TIME_WAIT: | case TCPS_TIME_WAIT: | ||||
/* | /* | ||||
* A previous connection in TIMEWAIT state is supposed to catch | * A previous connection in TIMEWAIT state is supposed to catch | ||||
* stray or duplicate segments arriving late. If this segment | * stray or duplicate segments arriving late. If this segment | ||||
* was a legitimate new connection attempt, the old INPCB gets | * was a legitimate new connection attempt, the old INPCB gets | ||||
* removed and we can try again to find a listening socket. | * removed and we can try again to find a listening socket. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 548 Lines • ▼ Show 20 Lines | #ifdef TCPDEBUG | ||||
u_char tcp_saveipgen[IP6_HDR_LEN]; | u_char tcp_saveipgen[IP6_HDR_LEN]; | ||||
struct tcphdr tcp_savetcp; | struct tcphdr tcp_savetcp; | ||||
short ostate = 0; | short ostate = 0; | ||||
#endif | #endif | ||||
thflags = tcp_get_flags(th); | thflags = tcp_get_flags(th); | ||||
inc = &tp->t_inpcb->inp_inc; | inc = &tp->t_inpcb->inp_inc; | ||||
tp->sackhint.last_sack_ack = 0; | tp->sackhint.last_sack_ack = 0; | ||||
sack_changed = 0; | sack_changed = 0; | ||||
to.to_ae = &tp->t_ae; | |||||
nsegs = max(1, m->m_pkthdr.lro_nsegs); | nsegs = max(1, m->m_pkthdr.lro_nsegs); | ||||
NET_EPOCH_ASSERT(); | NET_EPOCH_ASSERT(); | ||||
INP_WLOCK_ASSERT(tp->t_inpcb); | INP_WLOCK_ASSERT(tp->t_inpcb); | ||||
KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN", | KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN", | ||||
__func__)); | __func__)); | ||||
KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT", | KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT", | ||||
__func__)); | __func__)); | ||||
▲ Show 20 Lines • Show All 1,989 Lines • ▼ Show 20 Lines | case TCPOPT_FAST_OPEN: | ||||
if (!(flags & TO_SYN)) | if (!(flags & TO_SYN)) | ||||
continue; | continue; | ||||
if (!V_tcp_fastopen_client_enable && | if (!V_tcp_fastopen_client_enable && | ||||
!V_tcp_fastopen_server_enable) | !V_tcp_fastopen_server_enable) | ||||
continue; | continue; | ||||
to->to_flags |= TOF_FASTOPEN; | to->to_flags |= TOF_FASTOPEN; | ||||
to->to_tfo_len = optlen - 2; | to->to_tfo_len = optlen - 2; | ||||
to->to_tfo_cookie = to->to_tfo_len ? cp + 2 : NULL; | to->to_tfo_cookie = to->to_tfo_len ? cp + 2 : NULL; | ||||
break; | |||||
case TCPOPT_ACCECN0: | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
1 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 0)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 1)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 2)) << 0; | |||||
opt -= (to->to_ae->se0b & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->se0b += opt; | |||||
} | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
2 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 3)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 4)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 5)) << 0; | |||||
opt -= (to->to_ae->sceb & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->sceb += opt; | |||||
} | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
3 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 6)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 7)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 8)) << 0; | |||||
opt -= (to->to_ae->se1b & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->se1b += opt; | |||||
} | |||||
break; | |||||
case TCPOPT_ACCECN1: | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
1 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 0)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 1)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 2)) << 0; | |||||
opt -= (to->to_ae->se1b & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->se1b += opt; | |||||
} | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
2 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 3)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 4)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 5)) << 0; | |||||
opt -= (to->to_ae->sceb & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->sceb += opt; | |||||
} | |||||
if (optlen >= (TCPOLEN_ACCECN_EMPTY + | |||||
3 * TCPOLEN_ACCECN_COUNTER)) { | |||||
opt = (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 6)) << 16; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 7)) << 8; | |||||
opt |= (uint32_t)(*(uint8_t *)(cp + TCPOLEN_ACCECN_EMPTY + 8)) << 0; | |||||
opt -= (to->to_ae->se0b & 0xFFFFFF); | |||||
if (opt > 0) | |||||
to->to_ae->se0b += opt; | |||||
} | |||||
break; | break; | ||||
default: | default: | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 552 Lines • Show Last 20 Lines |