Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_usrreq.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/in6_pcb.h> | #include <netinet6/in6_pcb.h> | ||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#include <netinet6/scope6_var.h> | #include <netinet6/scope6_var.h> | ||||
#endif | #endif | ||||
#ifdef TCP_RFC7413 | |||||
#include <netinet/tcp_fastopen.h> | |||||
#endif | |||||
#include <netinet/tcp_fsm.h> | #include <netinet/tcp_fsm.h> | ||||
#include <netinet/tcp_seq.h> | #include <netinet/tcp_seq.h> | ||||
#include <netinet/tcp_timer.h> | #include <netinet/tcp_timer.h> | ||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
#include <netinet/tcpip.h> | #include <netinet/tcpip.h> | ||||
#ifdef TCPPCAP | #ifdef TCPPCAP | ||||
#include <netinet/tcp_pcap.h> | #include <netinet/tcp_pcap.h> | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 307 Lines • ▼ Show 20 Lines | if (error == 0) { | ||||
solisten_proto(so, backlog); | solisten_proto(so, backlog); | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if ((so->so_options & SO_NO_OFFLOAD) == 0) | if ((so->so_options & SO_NO_OFFLOAD) == 0) | ||||
tcp_offload_listen_start(tp); | tcp_offload_listen_start(tp); | ||||
#endif | #endif | ||||
} | } | ||||
SOCK_UNLOCK(so); | SOCK_UNLOCK(so); | ||||
#ifdef TCP_RFC7413 | |||||
if (tp->t_flags & TF_FASTOPEN) | |||||
tp->t_tfo_pending = tcp_fastopen_alloc_counter(); | |||||
#endif | |||||
out: | out: | ||||
TCPDEBUG2(PRU_LISTEN); | TCPDEBUG2(PRU_LISTEN); | ||||
TCP_PROBE2(debug__user, tp, PRU_LISTEN); | TCP_PROBE2(debug__user, tp, PRU_LISTEN); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* INET */ | #endif /* INET */ | ||||
Show All 30 Lines | if (error == 0) { | ||||
solisten_proto(so, backlog); | solisten_proto(so, backlog); | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if ((so->so_options & SO_NO_OFFLOAD) == 0) | if ((so->so_options & SO_NO_OFFLOAD) == 0) | ||||
tcp_offload_listen_start(tp); | tcp_offload_listen_start(tp); | ||||
#endif | #endif | ||||
} | } | ||||
SOCK_UNLOCK(so); | SOCK_UNLOCK(so); | ||||
#ifdef TCP_RFC7413 | |||||
if (tp->t_flags & TF_FASTOPEN) | |||||
tp->t_tfo_pending = tcp_fastopen_alloc_counter(); | |||||
#endif | |||||
out: | out: | ||||
TCPDEBUG2(PRU_LISTEN); | TCPDEBUG2(PRU_LISTEN); | ||||
TCP_PROBE2(debug__user, tp, PRU_LISTEN); | TCP_PROBE2(debug__user, tp, PRU_LISTEN); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
▲ Show 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | tcp_usr_rcvd(struct socket *so, int flags) | ||||
KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL")); | KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL")); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | ||||
error = ECONNRESET; | error = ECONNRESET; | ||||
goto out; | goto out; | ||||
} | } | ||||
tp = intotcpcb(inp); | tp = intotcpcb(inp); | ||||
TCPDEBUG1(); | TCPDEBUG1(); | ||||
#ifdef TCP_RFC7413 | |||||
/* | |||||
* For passively-created TFO connections, don't attempt a window | |||||
* update while still in SYN_RECEIVED as this may trigger an early | |||||
* SYN|ACK. It is preferable to have the SYN|ACK be sent along with | |||||
* application response data, or failing that, when the DELACK timer | |||||
* expires. | |||||
*/ | |||||
if ((tp->t_flags & TF_FASTOPEN) && | |||||
(tp->t_state == TCPS_SYN_RECEIVED)) | |||||
goto out; | |||||
#endif | |||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
if (tp->t_flags & TF_TOE) | if (tp->t_flags & TF_TOE) | ||||
tcp_offload_rcvd(tp); | tcp_offload_rcvd(tp); | ||||
else | else | ||||
#endif | #endif | ||||
tp->t_fb->tfb_tcp_output(tp); | tp->t_fb->tfb_tcp_output(tp); | ||||
out: | out: | ||||
▲ Show 20 Lines • Show All 853 Lines • ▼ Show 20 Lines | case TCP_PCAP_IN: | ||||
tcp_pcap_set_sock_max(TCP_PCAP_OUT ? | tcp_pcap_set_sock_max(TCP_PCAP_OUT ? | ||||
&(tp->t_outpkts) : &(tp->t_inpkts), | &(tp->t_outpkts) : &(tp->t_inpkts), | ||||
optval); | optval); | ||||
else | else | ||||
error = EINVAL; | error = EINVAL; | ||||
goto unlock_and_done; | goto unlock_and_done; | ||||
#endif | #endif | ||||
#ifdef TCP_RFC7413 | |||||
case TCP_FASTOPEN: | |||||
INP_WUNLOCK(inp); | |||||
if (!V_tcp_fastopen_enabled) | |||||
return (EPERM); | |||||
error = sooptcopyin(sopt, &optval, sizeof optval, | |||||
sizeof optval); | |||||
if (error) | |||||
return (error); | |||||
INP_WLOCK_RECHECK(inp); | |||||
if (optval) { | |||||
tp->t_flags |= TF_FASTOPEN; | |||||
if ((tp->t_state == TCPS_LISTEN) && | |||||
(tp->t_tfo_pending == NULL)) | |||||
tp->t_tfo_pending = | |||||
tcp_fastopen_alloc_counter(); | |||||
} else | |||||
tp->t_flags &= ~TF_FASTOPEN; | |||||
goto unlock_and_done; | |||||
#endif | |||||
default: | default: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case SOPT_GET: | case SOPT_GET: | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | #ifdef TCPPCAP | ||||
case TCP_PCAP_OUT: | case TCP_PCAP_OUT: | ||||
case TCP_PCAP_IN: | case TCP_PCAP_IN: | ||||
optval = tcp_pcap_get_sock_max(TCP_PCAP_OUT ? | optval = tcp_pcap_get_sock_max(TCP_PCAP_OUT ? | ||||
&(tp->t_outpkts) : &(tp->t_inpkts)); | &(tp->t_outpkts) : &(tp->t_inpkts)); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = sooptcopyout(sopt, &optval, sizeof optval); | error = sooptcopyout(sopt, &optval, sizeof optval); | ||||
break; | break; | ||||
#endif | #endif | ||||
#ifdef TCP_RFC7413 | |||||
case TCP_FASTOPEN: | |||||
optval = tp->t_flags & TF_FASTOPEN; | |||||
INP_WUNLOCK(inp); | |||||
error = sooptcopyout(sopt, &optval, sizeof optval); | |||||
break; | |||||
#endif | |||||
default: | default: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | if (t_flags & TF_FORCEDATA) { | ||||
comma = 1; | comma = 1; | ||||
} | } | ||||
if (t_flags & TF_TSO) { | if (t_flags & TF_TSO) { | ||||
db_printf("%sTF_TSO", comma ? ", " : ""); | db_printf("%sTF_TSO", comma ? ", " : ""); | ||||
comma = 1; | comma = 1; | ||||
} | } | ||||
if (t_flags & TF_ECN_PERMIT) { | if (t_flags & TF_ECN_PERMIT) { | ||||
db_printf("%sTF_ECN_PERMIT", comma ? ", " : ""); | db_printf("%sTF_ECN_PERMIT", comma ? ", " : ""); | ||||
comma = 1; | |||||
} | |||||
if (t_flags & TF_FASTOPEN) { | |||||
db_printf("%sTF_FASTOPEN", comma ? ", " : ""); | |||||
comma = 1; | comma = 1; | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
db_print_toobflags(char t_oobflags) | db_print_toobflags(char t_oobflags) | ||||
{ | { | ||||
int comma; | int comma; | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |