Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_stacks/fastpath.c
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
VNET_DECLARE(int, tcp_do_rfc3042); | VNET_DECLARE(int, tcp_do_rfc3042); | ||||
#define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) | #define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) | ||||
VNET_DECLARE(int, tcp_do_autorcvbuf); | VNET_DECLARE(int, tcp_do_autorcvbuf); | ||||
#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) | #define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) | ||||
VNET_DECLARE(int, tcp_insecure_rst); | VNET_DECLARE(int, tcp_insecure_rst); | ||||
#define V_tcp_insecure_rst VNET(tcp_insecure_rst) | #define V_tcp_insecure_rst VNET(tcp_insecure_rst) | ||||
VNET_DECLARE(int, tcp_insecure_syn); | VNET_DECLARE(int, tcp_insecure_syn); | ||||
#define V_tcp_insecure_syn VNET(tcp_insecure_syn) | #define V_tcp_insecure_syn VNET(tcp_insecure_syn) | ||||
VNET_DECLARE(int, drop_synfin); | |||||
#define V_drop_synfin VNET(drop_synfin) | |||||
static void tcp_do_segment_fastslow(struct mbuf *, struct tcphdr *, | static void tcp_do_segment_fastslow(struct mbuf *, struct tcphdr *, | ||||
struct socket *, struct tcpcb *, int, int, uint8_t, | struct socket *, struct tcpcb *, int, int, uint8_t, | ||||
int); | int); | ||||
static void tcp_do_segment_fastack(struct mbuf *, struct tcphdr *, | static void tcp_do_segment_fastack(struct mbuf *, struct tcphdr *, | ||||
struct socket *, struct tcpcb *, int, int, uint8_t, | struct socket *, struct tcpcb *, int, int, uint8_t, | ||||
int); | int); | ||||
▲ Show 20 Lines • Show All 1,581 Lines • ▼ Show 20 Lines | tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr *th, struct socket *so, | ||||
uint32_t tiwin; | uint32_t tiwin; | ||||
char *s; | char *s; | ||||
uint16_t nsegs; | uint16_t nsegs; | ||||
int can_enter; | int can_enter; | ||||
struct in_conninfo *inc; | struct in_conninfo *inc; | ||||
struct tcpopt to; | struct tcpopt to; | ||||
thflags = th->th_flags; | thflags = th->th_flags; | ||||
tp->sackhint.last_sack_ack = 0; | |||||
inc = &tp->t_inpcb->inp_inc; | inc = &tp->t_inpcb->inp_inc; | ||||
nsegs = max(1, m->m_pkthdr.lro_nsegs); | nsegs = max(1, m->m_pkthdr.lro_nsegs); | ||||
/* | /* | ||||
* If this is either a state-changing packet or current state isn't | * If this is either a state-changing packet or current state isn't | ||||
* established, we require a write lock on tcbinfo. Otherwise, we | * established, we require a write lock on tcbinfo. Otherwise, we | ||||
* allow the tcbinfo to be in either alocked or unlocked, as the | * allow the tcbinfo to be in either alocked or unlocked, as the | ||||
* caller may have unnecessarily acquired a write lock due to a race. | * caller may have unnecessarily acquired a write lock due to a race. | ||||
*/ | */ | ||||
Show All 14 Lines | |||||
#endif | #endif | ||||
} | } | ||||
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__)); | ||||
if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { | |||||
if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { | |||||
log(LOG_DEBUG, "%s; %s: " | |||||
"SYN|FIN segment ignored (based on " | |||||
"sysctl setting)\n", s, __func__); | |||||
free(s, M_TCPLOG); | |||||
} | |||||
if (ti_locked == TI_RLOCKED) { | |||||
INP_INFO_RUNLOCK(&V_tcbinfo); | |||||
} | |||||
INP_WUNLOCK(tp->t_inpcb); | |||||
m_freem(m); | |||||
return; | |||||
} | |||||
tp->sackhint.last_sack_ack = 0; | |||||
/* | /* | ||||
* Segment received on connection. | * Segment received on connection. | ||||
* Reset idle time and keep-alive timer. | * Reset idle time and keep-alive timer. | ||||
* XXX: This should be done after segment | * XXX: This should be done after segment | ||||
* validation to ignore broken/spoofed segs. | * validation to ignore broken/spoofed segs. | ||||
*/ | */ | ||||
tp->t_rcvtime = ticks; | tp->t_rcvtime = ticks; | ||||
▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int thflags; | int thflags; | ||||
uint32_t tiwin; | uint32_t tiwin; | ||||
char *s; | char *s; | ||||
struct in_conninfo *inc; | struct in_conninfo *inc; | ||||
struct tcpopt to; | struct tcpopt to; | ||||
thflags = th->th_flags; | thflags = th->th_flags; | ||||
tp->sackhint.last_sack_ack = 0; | |||||
inc = &tp->t_inpcb->inp_inc; | inc = &tp->t_inpcb->inp_inc; | ||||
/* | /* | ||||
* If this is either a state-changing packet or current state isn't | * If this is either a state-changing packet or current state isn't | ||||
* established, we require a write lock on tcbinfo. Otherwise, we | * established, we require a write lock on tcbinfo. Otherwise, we | ||||
* allow the tcbinfo to be in either alocked or unlocked, as the | * allow the tcbinfo to be in either alocked or unlocked, as the | ||||
* caller may have unnecessarily acquired a write lock due to a race. | * caller may have unnecessarily acquired a write lock due to a race. | ||||
*/ | */ | ||||
if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || | if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || | ||||
Show All 12 Lines | #ifdef INVARIANTS | ||||
} | } | ||||
#endif | #endif | ||||
} | } | ||||
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__)); | ||||
if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { | |||||
if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { | |||||
log(LOG_DEBUG, "%s; %s: " | |||||
"SYN|FIN segment ignored (based on " | |||||
"sysctl setting)\n", s, __func__); | |||||
free(s, M_TCPLOG); | |||||
} | |||||
if (ti_locked == TI_RLOCKED) { | |||||
INP_INFO_RUNLOCK(&V_tcbinfo); | |||||
} | |||||
INP_WUNLOCK(tp->t_inpcb); | |||||
m_freem(m); | |||||
return; | |||||
} | |||||
tp->sackhint.last_sack_ack = 0; | |||||
/* | /* | ||||
* Segment received on connection. | * Segment received on connection. | ||||
* Reset idle time and keep-alive timer. | * Reset idle time and keep-alive timer. | ||||
* XXX: This should be done after segment | * XXX: This should be done after segment | ||||
* validation to ignore broken/spoofed segs. | * validation to ignore broken/spoofed segs. | ||||
*/ | */ | ||||
tp->t_rcvtime = ticks; | tp->t_rcvtime = ticks; | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |