Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_usrreq.c
Show All 38 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_ddb.h" | #include "opt_ddb.h" | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ipsec.h" | #include "opt_ipsec.h" | ||||
#include "opt_kern_tls.h" | |||||
#include "opt_tcpdebug.h" | #include "opt_tcpdebug.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/refcount.h> | #include <sys/refcount.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/ktls.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
▲ Show 20 Lines • Show All 1,687 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
int | int | ||||
tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp) | tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp) | ||||
{ | { | ||||
int error, opt, optval; | int error, opt, optval; | ||||
u_int ui; | u_int ui; | ||||
struct tcp_info ti; | struct tcp_info ti; | ||||
#ifdef KERN_TLS | |||||
struct tls_enable tls; | |||||
#endif | |||||
struct cc_algo *algo; | struct cc_algo *algo; | ||||
char *pbuf, buf[TCP_LOG_ID_LEN]; | char *pbuf, buf[TCP_LOG_ID_LEN]; | ||||
size_t len; | size_t len; | ||||
/* | /* | ||||
* For TCP_CCALGOOPT forward the control to CC module, for both | * For TCP_CCALGOOPT forward the control to CC module, for both | ||||
* SOPT_SET and SOPT_GET. | * SOPT_SET and SOPT_GET. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | case TCP_CONGESTION: | ||||
* The only reason init should fail is | * The only reason init should fail is | ||||
* because of malloc. | * because of malloc. | ||||
*/ | */ | ||||
error = ENOMEM; | error = ENOMEM; | ||||
} | } | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
break; | break; | ||||
#ifdef KERN_TLS | |||||
case TCP_TXTLS_ENABLE: | |||||
INP_WUNLOCK(inp); | |||||
error = sooptcopyin(sopt, &tls, sizeof(tls), | |||||
sizeof(tls)); | |||||
if (error) | |||||
break; | |||||
error = ktls_enable_tx(so, &tls); | |||||
break; | |||||
case TCP_TXTLS_MODE: | |||||
INP_WUNLOCK(inp); | |||||
error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); | |||||
if (error) | |||||
return (error); | |||||
if (ui != TCP_TLS_MODE_SW && ui != TCP_TLS_MODE_IFNET) | |||||
return (EINVAL); | |||||
INP_WLOCK_RECHECK(inp); | |||||
error = ktls_set_tx_mode(so, ui); | |||||
INP_WUNLOCK(inp); | |||||
break; | |||||
#endif | |||||
case TCP_KEEPIDLE: | case TCP_KEEPIDLE: | ||||
case TCP_KEEPINTVL: | case TCP_KEEPINTVL: | ||||
case TCP_KEEPINIT: | case TCP_KEEPINIT: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); | error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | case TCP_LOGID: | ||||
len = tcp_log_get_id(tp, buf); | len = tcp_log_get_id(tp, buf); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = sooptcopyout(sopt, buf, len + 1); | error = sooptcopyout(sopt, buf, len + 1); | ||||
break; | break; | ||||
case TCP_LOGDUMP: | case TCP_LOGDUMP: | ||||
case TCP_LOGDUMPID: | case TCP_LOGDUMPID: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | |||||
#endif | |||||
#ifdef KERN_TLS | |||||
case TCP_TXTLS_MODE: | |||||
optval = ktls_get_tx_mode(so); | |||||
INP_WUNLOCK(inp); | |||||
error = sooptcopyout(sopt, &optval, sizeof(optval)); | |||||
break; | break; | ||||
#endif | #endif | ||||
default: | default: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 471 Lines • Show Last 20 Lines |