FreeBSD kernel IPv4 code
tcp_syncache.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/hash.h>
#include <sys/refcount.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/random.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/syslog.h>
#include <sys/ucred.h>
#include <sys/md5.h>
#include <crypto/siphash/siphash.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_kdtrace.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/in_var.h>
#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fastopen.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_syncache.h>
#include <netinet/tcp_ecn.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <netipsec/ipsec_support.h>
#include <machine/in_cksum.h>
#include <security/mac/mac_framework.h>
Include dependency graph for tcp_syncache.c:

Go to the source code of this file.

Macros

#define V_tcp_syncookies   VNET(tcp_syncookies)
 
#define V_tcp_syncookiesonly   VNET(tcp_syncookiesonly)
 
#define V_functions_inherit_listen_socket_stack    VNET(functions_inherit_listen_socket_stack)
 
#define SYNCACHE_MAXREXMTS   3
 
#define TCP_SYNCACHE_HASHSIZE   512
 
#define TCP_SYNCACHE_BUCKETLIMIT   30
 
#define V_tcp_syncache   VNET(tcp_syncache)
 
#define SCH_LOCK(sch)   mtx_lock(&(sch)->sch_mtx)
 
#define SCH_UNLOCK(sch)   mtx_unlock(&(sch)->sch_mtx)
 
#define SCH_LOCK_ASSERT(sch)   mtx_assert(&(sch)->sch_mtx, MA_OWNED)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 VNET_DEFINE_STATIC (int, tcp_syncookies)
 
 SYSCTL_INT (_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_syncookies), 0, "Use TCP SYN cookies if the syncache overflows")
 
 VNET_DEFINE_STATIC (int, tcp_syncookiesonly)=0
 
 SYSCTL_INT (_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_syncookiesonly), 0, "Use only TCP SYN cookies")
 
 VNET_DEFINE_STATIC (int, functions_inherit_listen_socket_stack)
 
 SYSCTL_INT (_net_inet_tcp, OID_AUTO, functions_inherit_listen_socket_stack, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(functions_inherit_listen_socket_stack), 0, "Inherit listen socket's stack")
 
static void syncache_drop (struct syncache *, struct syncache_head *)
 
static void syncache_free (struct syncache *)
 
static void syncache_insert (struct syncache *, struct syncache_head *)
 
static int syncache_respond (struct syncache *, const struct mbuf *, int)
 
static struct socket * syncache_socket (struct syncache *, struct socket *, struct mbuf *m)
 
static void syncache_timeout (struct syncache *sc, struct syncache_head *sch, int docallout)
 
static void syncache_timer (void *)
 
static uint32_t syncookie_mac (struct in_conninfo *, tcp_seq, uint8_t, uint8_t *, uintptr_t)
 
static tcp_seq syncookie_generate (struct syncache_head *, struct syncache *)
 
static struct syncachesyncookie_lookup (struct in_conninfo *, struct syncache_head *, struct syncache *, struct tcphdr *, struct tcpopt *, struct socket *, uint16_t)
 
static void syncache_pause (struct in_conninfo *)
 
static void syncache_unpause (void *)
 
static void syncookie_reseed (void *)
 
 VNET_DEFINE_STATIC (struct tcp_syncache, tcp_syncache)
 
static SYSCTL_NODE (_net_inet_tcp, OID_AUTO, syncache, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "TCP SYN cache")
 
 SYSCTL_UINT (_net_inet_tcp_syncache, OID_AUTO, bucketlimit, CTLFLAG_VNET|CTLFLAG_RDTUN, &VNET_NAME(tcp_syncache.bucket_limit), 0, "Per-bucket hash limit for syncache")
 
 SYSCTL_UINT (_net_inet_tcp_syncache, OID_AUTO, cachelimit, CTLFLAG_VNET|CTLFLAG_RDTUN, &VNET_NAME(tcp_syncache.cache_limit), 0, "Overall entry limit for syncache")
 
 SYSCTL_UMA_CUR (_net_inet_tcp_syncache, OID_AUTO, count, CTLFLAG_VNET, &VNET_NAME(tcp_syncache.zone), "Current number of entries in syncache")
 
 SYSCTL_UINT (_net_inet_tcp_syncache, OID_AUTO, hashsize, CTLFLAG_VNET|CTLFLAG_RDTUN, &VNET_NAME(tcp_syncache.hashsize), 0, "Size of TCP syncache hashtable")
 
 SYSCTL_BOOL (_net_inet_tcp_syncache, OID_AUTO, see_other, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_syncache.see_other), 0, "All syncache(4) entries are visible, ignoring UID/GID, jail(2) " "and mac(4) checks")
 
static int sysctl_net_inet_tcp_syncache_rexmtlimit_check (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_syncache, OID_AUTO, rexmtlimit, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &VNET_NAME(tcp_syncache.rexmt_limit), 0, sysctl_net_inet_tcp_syncache_rexmtlimit_check, "UI", "Limit on SYN/ACK retransmissions")
 
 VNET_DEFINE (int, tcp_sc_rst_sock_fail)
 
 SYSCTL_INT (_net_inet_tcp_syncache, OID_AUTO, rst_on_sock_fail, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_sc_rst_sock_fail), 0, "Send reset on socket allocation failure")
 
static MALLOC_DEFINE (M_SYNCACHE, "syncache", "TCP syncache")
 
void syncache_init (void)
 
static bool syncache_cookiesonly (void)
 
static struct syncache_headsyncache_hashbucket (struct in_conninfo *inc)
 
static struct syncachesyncache_lookup (struct in_conninfo *inc, struct syncache_head **schp)
 
void syncache_chkrst (struct in_conninfo *inc, struct tcphdr *th, struct mbuf *m, uint16_t port)
 
void syncache_badack (struct in_conninfo *inc, uint16_t port)
 
void syncache_unreach (struct in_conninfo *inc, tcp_seq th_seq, uint16_t port)
 
int syncache_expand (struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct socket **lsop, struct mbuf *m, uint16_t port)
 
static struct socket * syncache_tfo_expand (struct syncache *sc, struct socket *lso, struct mbuf *m, uint64_t response_cookie)
 
struct socket * syncache_add (struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, struct socket *so, struct mbuf *m, void *tod, void *todctx, uint8_t iptos, uint16_t port)
 
int syncache_pcblist (struct sysctl_req *req)
 

Variables

static int tcp_sc_msstab [] = { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }
 
static int tcp_sc_wstab [] = { 0, 0, 1, 2, 4, 6, 7, 8 }
 

Macro Definition Documentation

◆ SCH_LOCK

#define SCH_LOCK (   sch)    mtx_lock(&(sch)->sch_mtx)

Definition at line 231 of file tcp_syncache.c.

◆ SCH_LOCK_ASSERT

#define SCH_LOCK_ASSERT (   sch)    mtx_assert(&(sch)->sch_mtx, MA_OWNED)

Definition at line 233 of file tcp_syncache.c.

◆ SCH_UNLOCK

#define SCH_UNLOCK (   sch)    mtx_unlock(&(sch)->sch_mtx)

Definition at line 232 of file tcp_syncache.c.

◆ SYNCACHE_MAXREXMTS

#define SYNCACHE_MAXREXMTS   3

Definition at line 168 of file tcp_syncache.c.

◆ TCP_SYNCACHE_BUCKETLIMIT

#define TCP_SYNCACHE_BUCKETLIMIT   30

Definition at line 172 of file tcp_syncache.c.

◆ TCP_SYNCACHE_HASHSIZE

#define TCP_SYNCACHE_HASHSIZE   512

Definition at line 171 of file tcp_syncache.c.

◆ V_functions_inherit_listen_socket_stack

#define V_functions_inherit_listen_socket_stack    VNET(functions_inherit_listen_socket_stack)

Definition at line 121 of file tcp_syncache.c.

◆ V_tcp_syncache

#define V_tcp_syncache   VNET(tcp_syncache)

Definition at line 175 of file tcp_syncache.c.

◆ V_tcp_syncookies

#define V_tcp_syncookies   VNET(tcp_syncookies)

Definition at line 109 of file tcp_syncache.c.

◆ V_tcp_syncookiesonly

#define V_tcp_syncookiesonly   VNET(tcp_syncookiesonly)

Definition at line 115 of file tcp_syncache.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_SYNCACHE  ,
"syncache"  ,
"TCP syncache  
)
static

◆ syncache_add()

struct socket * syncache_add ( struct in_conninfo inc,
struct tcpopt to,
struct tcphdr *  th,
struct inpcb inp,
struct socket *  so,
struct mbuf *  m,
void *  tod,
void *  todctx,
uint8_t  iptos,
uint16_t  port 
)

Definition at line 1402 of file tcp_syncache.c.

References IN6P_AUTOFLOWLABEL, inpcb::in6p_outputopts, in_conninfo::inc_flags, INC_ISIPV6, inpcb::inp_flags, inpcb::inp_ip_tos, inpcb::inp_ip_ttl, INP_RLOCK_ASSERT, INP_RUNLOCK, ip_srcroute(), ip_tos, ip_ttl, IPV6_FLOWLABEL_MASK, IS_FASTOPEN, syncache::sc_cred, syncache::sc_flags, syncache::sc_flowlabel, syncache::sc_inc, syncache::sc_ip_tos, syncache::sc_ip_ttl, syncache::sc_ipopts, syncache::sc_irs, syncache::sc_iss, syncache::sc_label, syncache::sc_peer_mss, syncache::sc_port, syncache::sc_requested_r_scale, syncache::sc_requested_s_scale, syncache::sc_rxmits, syncache::sc_tfo_cookie, syncache::sc_tod, syncache::sc_todctx, syncache::sc_tsoff, syncache::sc_tsreflect, syncache::sc_wnd, SCF_ECN, SCF_NOOPT, SCF_SACK, SCF_SIGNATURE, SCF_TIMESTAMP, SCF_WINSCALE, syncache_head::sch_last_overflow, SCH_LOCK_ASSERT, SCH_UNLOCK, sototcpcb, syncache_cookiesonly(), syncache_drop(), syncache_free(), syncache_hashbucket(), syncache_insert(), syncache_lookup(), syncache_pause(), syncache_respond(), syncache_tfo_expand(), syncache_timeout(), syncookie_generate(), tcpcb::t_flags, tcpcb::t_tfo_pending, tcp_ecn_syncache_add(), tcp_fastopen_check_cookie(), tcp_fastopen_decrement_counter(), tcp_get_flags(), tcp_log_addrs(), tcp_new_ts_offset(), TCP_PROBE5, TCPSTAT_INC, TF_NOOPT, TF_SIGNATURE, tcpopt::to_flags, tcpopt::to_mss, tcpopt::to_signature, tcpopt::to_tfo_cookie, tcpopt::to_tfo_len, tcpopt::to_tsval, tcpopt::to_wscale, TOF_FASTOPEN, TOF_MSS, TOF_SACKPERM, TOF_SCALE, TOF_SIGNATURE, TOF_TS, V_tcp_do_ecn, V_tcp_do_rfc1323, V_tcp_fastopen_server_enable, V_tcp_syncache, V_tcp_syncookies, and V_tcp_syncookiesonly.

Referenced by tcp_input_with_port(), and toe_syncache_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_badack()

void syncache_badack ( struct in_conninfo inc,
uint16_t  port 
)

Definition at line 732 of file tcp_syncache.c.

References syncache::sc_port, SCH_LOCK_ASSERT, SCH_UNLOCK, syncache_cookiesonly(), syncache_drop(), syncache_lookup(), and TCPSTAT_INC.

Referenced by tcp_input_with_port().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_chkrst()

void syncache_chkrst ( struct in_conninfo inc,
struct tcphdr *  th,
struct mbuf *  m,
uint16_t  port 
)

Definition at line 615 of file tcp_syncache.c.

References syncache::sc_irs, syncache::sc_port, syncache::sc_wnd, SCH_LOCK_ASSERT, SCH_UNLOCK, SEQ_GEQ, SEQ_LT, syncache_cookiesonly(), syncache_drop(), syncache_lookup(), syncache_respond(), tcp_get_flags(), tcp_log_addrs(), TCPSTAT_INC, and V_tcp_insecure_rst.

Referenced by tcp_input_with_port().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_cookiesonly()

static bool syncache_cookiesonly ( void  )
inlinestatic

Definition at line 558 of file tcp_syncache.c.

References V_tcp_syncache, V_tcp_syncookies, and V_tcp_syncookiesonly.

Referenced by syncache_add(), syncache_badack(), syncache_chkrst(), syncache_expand(), and syncache_unreach().

Here is the caller graph for this function:

◆ syncache_drop()

static void syncache_drop ( struct syncache sc,
struct syncache_head sch 
)
static

Definition at line 423 of file tcp_syncache.c.

References syncache::sc_tod, syncache::sc_todctx, syncache_head::sch_length, SCH_LOCK_ASSERT, syncache_free(), TCPS_SYN_RECEIVED, TCPSTATES_DEC, and toedev::tod_syncache_removed.

Referenced by syncache_add(), syncache_badack(), syncache_chkrst(), syncache_insert(), syncache_timer(), and syncache_unreach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_expand()

◆ syncache_free()

static void syncache_free ( struct syncache sc)
static

Definition at line 239 of file tcp_syncache.c.

References syncache::sc_cred, syncache::sc_ipopts, syncache::sc_label, and V_tcp_syncache.

Referenced by syncache_add(), syncache_drop(), and syncache_expand().

Here is the caller graph for this function:

◆ syncache_hashbucket()

static struct syncache_head * syncache_hashbucket ( struct in_conninfo inc)
static

Definition at line 569 of file tcp_syncache.c.

References in_conninfo::inc_ie, and V_tcp_syncache.

Referenced by syncache_add(), syncache_expand(), and syncache_lookup().

Here is the caller graph for this function:

◆ syncache_init()

void syncache_init ( void  )

Definition at line 254 of file tcp_syncache.c.

References SYNCACHE_MAXREXMTS, SYNCOOKIE_LIFETIME, syncookie_reseed(), SYNCOOKIE_SECRET_SIZE, TCP_SYNCACHE_BUCKETLIMIT, TCP_SYNCACHE_HASHSIZE, TCP_SYNCACHE_PAUSE_TIME, and V_tcp_syncache.

Referenced by tcp_vnet_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_insert()

static void syncache_insert ( struct syncache sc,
struct syncache_head sch 
)
static

◆ syncache_lookup()

static struct syncache * syncache_lookup ( struct in_conninfo inc,
struct syncache_head **  schp 
)
static

Definition at line 591 of file tcp_syncache.c.

References in_conninfo::inc_ie, syncache::sc_inc, SCH_LOCK, and syncache_hashbucket().

Referenced by syncache_add(), syncache_badack(), syncache_chkrst(), syncache_expand(), and syncache_unreach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_pause()

static void syncache_pause ( struct in_conninfo inc)
static

Definition at line 2452 of file tcp_syncache.c.

References syncache_unpause(), tcp_log_addrs(), TCP_SYNCACHE_MAX_BACKOFF, TCP_SYNCACHE_PAUSE_TIME, TCPSTAT_INC, V_tcp_syncache, and V_tcp_syncookies.

Referenced by syncache_add(), and syncache_insert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_pcblist()

int syncache_pcblist ( struct sysctl_req *  req)

Definition at line 2554 of file tcp_syncache.c.

References in_conninfo::inc_flags, INC_ISIPV6, INP_IPV4, INP_IPV6, IPPROTO_TCP, syncache::sc_cred, syncache::sc_inc, syncache::sc_port, SCH_LOCK, SCH_UNLOCK, TCPS_SYN_RECEIVED, and V_tcp_syncache.

Referenced by tcp_pcblist().

Here is the caller graph for this function:

◆ syncache_respond()

static int syncache_respond ( struct syncache sc,
const struct mbuf *  m0,
int  flags 
)
static

Definition at line 1819 of file tcp_syncache.c.

References in_pseudo(), in_conninfo::inc_fibnum, in_conninfo::inc_flags, INC_ISIPV6, ip6_hdr::ip6_dst, ip6_hdr::ip6_src, IP_DF, ip::ip_dst, ip::ip_hl, ip::ip_id, ip::ip_len, ip::ip_off, ip_output(), ip::ip_p, ip::ip_sum, ip::ip_tos, ip::ip_ttl, ip::ip_v, IPPROTO_TCP, IPPROTO_UDP, IPV6_VERSION, IPVERSION, in_addr::s_addr, syncache::sc_flags, syncache::sc_flowlabel, syncache::sc_inc, syncache::sc_ip_tos, syncache::sc_ip_ttl, syncache::sc_ipopts, syncache::sc_irs, syncache::sc_iss, syncache::sc_label, syncache::sc_port, syncache::sc_requested_r_scale, syncache::sc_tfo_cookie, syncache::sc_tod, syncache::sc_todctx, syncache::sc_tsoff, syncache::sc_tsreflect, syncache::sc_wnd, SCF_NOOPT, SCF_SACK, SCF_SIGNATURE, SCF_TIMESTAMP, SCF_UNREACH, SCF_WINSCALE, tcp_addoptions(), tcp_ecn_syncache_respond(), TCP_FASTOPEN_COOKIE_LEN, tcp_mssopt(), TCP_PROBE5, tcp_set_flags(), tcp_ts_getticks(), tcpopt::to_flags, tcpopt::to_mss, tcpopt::to_signature, tcpopt::to_tfo_cookie, tcpopt::to_tfo_len, tcpopt::to_tsecr, tcpopt::to_tsval, tcpopt::to_wscale, toedev::tod_syncache_respond, TOF_FASTOPEN, TOF_MSS, TOF_SACKPERM, TOF_SCALE, TOF_SIGNATURE, TOF_TS, udphdr::uh_dport, udphdr::uh_sport, udphdr::uh_sum, udphdr::uh_ulen, V_path_mtu_discovery, V_tcp_minmss, V_tcp_udp_tunneling_overhead, and V_tcp_udp_tunneling_port.

Referenced by syncache_add(), syncache_chkrst(), and syncache_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_socket()

static struct socket * syncache_socket ( struct syncache sc,
struct socket *  lso,
struct mbuf *  m 
)
static

Definition at line 793 of file tcp_syncache.c.

References find_and_ref_tcp_fb(), inpcb::in6p_hops, inpcb::in6p_outputopts, in_pcbconnect(), INADDR_ANY, in_conninfo::inc_fibnum, in_conninfo::inc_flags, INC_ISIPV6, INP_CONTROLOPTS, inpcb::inp_flags, inpcb::inp_flow, inpcb::inp_flowid, inpcb::inp_flowtype, INP_HASH_WLOCK, INP_HASH_WUNLOCK, inpcb::inp_inc, inpcb::inp_ip_tos, inpcb::inp_ip_ttl, INP_IPV4, INP_IPV6, INP_IPV6PROTO, inpcb::inp_numa_domain, inpcb::inp_options, inpcb::inp_vflag, INP_WLOCK, INP_WUNLOCK, intotcpcb, ip_srcroute(), tcpcb::irs, tcpcb::iss, tcpcb::last_ack_sent, tcpcb::rcv_adv, tcpcb::rcv_nxt, tcpcb::rcv_up, tcpcb::rcv_wnd, tcpcb::request_r_scale, syncache::sc_flags, syncache::sc_flowlabel, syncache::sc_inc, syncache::sc_ip_tos, syncache::sc_ip_ttl, syncache::sc_ipopts, syncache::sc_irs, syncache::sc_iss, syncache::sc_peer_mss, syncache::sc_port, syncache::sc_requested_r_scale, syncache::sc_requested_s_scale, syncache::sc_rxmits, syncache::sc_tod, syncache::sc_todctx, syncache::sc_tsoff, syncache::sc_tsreflect, syncache::sc_wnd, SCF_NOOPT, SCF_SACK, SCF_SIGNATURE, SCF_TIMESTAMP, SCF_WINSCALE, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_len, sockaddr_in::sin_port, sockaddr_in::sin_zero, tcpcb::snd_cwnd, tcpcb::snd_max, tcpcb::snd_nxt, tcpcb::snd_scale, tcpcb::snd_wl1, sotoinpcb, sototcpcb, tcpcb::t_fb, tcpcb::t_flags, tcpcb::t_keepcnt, tcpcb::t_keepidle, tcpcb::t_keepinit, tcpcb::t_keepintvl, tcpcb::t_port, tcp_ecn_syncache_socket(), tcp_log_addrs(), tcp_mss(), tcp_rcvseqinit, tcp_sendseqinit, tcp_state_change(), tcp_timer_activate(), tcp_ts_getticks(), TCPS_SYN_RECEIVED, TCPSTAT_INC, TF_NODELAY, TF_NOOPT, TF_NOPUSH, TF_RCVD_SCALE, TF_RCVD_TSTMP, TF_REQ_SCALE, TF_REQ_TSTMP, TF_SACK_PERMIT, TF_SIGNATURE, tcp_function_block::tfb_refcnt, tcp_function_block::tfb_tcp_fb_fini, tcp_function_block::tfb_tcp_fb_init, toedev::tod_offload_socket, TP_KEEPINIT, tcpcb::ts_offset, tcpcb::ts_recent, tcpcb::ts_recent_age, TT_KEEP, V_functions_inherit_listen_socket_stack, and V_tcbinfo.

Referenced by syncache_expand(), and syncache_tfo_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_tfo_expand()

static struct socket * syncache_tfo_expand ( struct syncache sc,
struct socket *  lso,
struct mbuf *  m,
uint64_t  response_cookie 
)
static

Definition at line 1352 of file tcp_syncache.c.

References intotcpcb, tcpcb::iss, tcpcb::server, tcpcb::snd_max, tcpcb::snd_nxt, sotoinpcb, syncache_socket(), tcpcb::t_flags, tcpcb::t_tfo_cookie, tcpcb::t_tfo_pending, TCPSTAT_INC, and TF_FASTOPEN.

Referenced by syncache_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_timeout()

static void syncache_timeout ( struct syncache sc,
struct syncache_head sch,
int  docallout 
)
static

Definition at line 447 of file tcp_syncache.c.

References syncache::sc_rxmits, syncache::sc_rxttime, syncache_head::sch_nextc, syncache_head::sch_timer, syncache_timer(), tcp_backoff, tcp_rexmit_initial, tcp_rexmit_min, TCPT_RANGESET, TCPTV_REXMTMAX, and TSTMP_LT.

Referenced by syncache_add(), syncache_insert(), and syncache_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncache_timer()

static void syncache_timer ( void *  xsch)
static

◆ syncache_unpause()

static void syncache_unpause ( void *  arg)
static

Definition at line 2525 of file tcp_syncache.c.

References tcp_syncache::pause_co, tcp_syncache::pause_mtx, tcp_syncache::pause_until, and tcp_syncache::paused.

Referenced by syncache_pause().

Here is the caller graph for this function:

◆ syncache_unreach()

void syncache_unreach ( struct in_conninfo inc,
tcp_seq  th_seq,
uint16_t  port 
)

◆ syncookie_generate()

static tcp_seq syncookie_generate ( struct syncache_head sch,
struct syncache sc 
)
static

Definition at line 2235 of file tcp_syncache.c.

References cookie, syncache::sc_flags, syncache::sc_inc, syncache::sc_irs, syncache::sc_peer_mss, syncache::sc_requested_s_scale, SCF_SACK, SCF_WINSCALE, syncookie_mac(), tcp_sc_msstab, tcp_sc_wstab, TCPSTAT_INC, and V_tcp_syncache.

Referenced by syncache_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncookie_lookup()

◆ syncookie_mac()

static uint32_t syncookie_mac ( struct in_conninfo inc,
tcp_seq  irs,
uint8_t  flags,
uint8_t secbits,
uintptr_t  secmod 
)
static

Definition at line 2202 of file tcp_syncache.c.

References in_conninfo::inc_flags, and INC_ISIPV6.

Referenced by syncookie_generate(), and syncookie_lookup().

Here is the caller graph for this function:

◆ syncookie_reseed()

static void syncookie_reseed ( void *  arg)
static

Definition at line 2425 of file tcp_syncache.c.

References syncookie_secret::key, syncookie_secret::oddeven, syncookie_secret::reseed, tcp_syncache::secret, SYNCOOKIE_LIFETIME, and SYNCOOKIE_SECRET_SIZE.

Referenced by syncache_init().

Here is the caller graph for this function:

◆ SYSCTL_BOOL()

SYSCTL_BOOL ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
see_other  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_syncache.see_other,
,
"All syncache(4) entries are  visible,
ignoring UID/  GID,
jail(2) " "and mac(4) checks"   
)

◆ SYSCTL_INT() [1/4]

SYSCTL_INT ( _net_inet_tcp  ,
OID_AUTO  ,
functions_inherit_listen_socket_stack  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEfunctions_inherit_listen_socket_stack,
,
"Inherit listen socket's stack"   
)

◆ SYSCTL_INT() [2/4]

SYSCTL_INT ( _net_inet_tcp  ,
OID_AUTO  ,
syncookies  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_syncookies,
,
"Use TCP SYN cookies if the syncache overflows"   
)

◆ SYSCTL_INT() [3/4]

SYSCTL_INT ( _net_inet_tcp  ,
OID_AUTO  ,
syncookies_only  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_syncookiesonly,
,
"Use only TCP SYN cookies"   
)

◆ SYSCTL_INT() [4/4]

SYSCTL_INT ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
rst_on_sock_fail  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_sc_rst_sock_fail,
,
"Send reset on socket allocation failure"   
)

◆ sysctl_net_inet_tcp_syncache_rexmtlimit_check()

static int sysctl_net_inet_tcp_syncache_rexmtlimit_check ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 202 of file tcp_syncache.c.

References TCP_MAXRXTSHIFT, and V_tcp_syncache.

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _net_inet_tcp  ,
OID_AUTO  ,
syncache  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"TCP SYN cache"   
)
static

◆ SYSCTL_PROC()

SYSCTL_PROC ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
rexmtlimit  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|  CTLFLAG_NEEDGIANT,
VNET_NAMEtcp_syncache.rexmt_limit,
,
sysctl_net_inet_tcp_syncache_rexmtlimit_check  ,
"UI"  ,
"Limit on SYN/ACK retransmissions"   
)

◆ SYSCTL_UINT() [1/3]

SYSCTL_UINT ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
bucketlimit  ,
CTLFLAG_VNET|  CTLFLAG_RDTUN,
VNET_NAMEtcp_syncache.bucket_limit,
,
"Per-bucket hash limit for syncache  
)

◆ SYSCTL_UINT() [2/3]

SYSCTL_UINT ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
cachelimit  ,
CTLFLAG_VNET|  CTLFLAG_RDTUN,
VNET_NAMEtcp_syncache.cache_limit,
,
"Overall entry limit for syncache  
)

◆ SYSCTL_UINT() [3/3]

SYSCTL_UINT ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
hashsize  ,
CTLFLAG_VNET|  CTLFLAG_RDTUN,
VNET_NAMEtcp_syncache.hashsize,
,
"Size of TCP syncache hashtable"   
)

◆ SYSCTL_UMA_CUR()

SYSCTL_UMA_CUR ( _net_inet_tcp_syncache  ,
OID_AUTO  ,
count  ,
CTLFLAG_VNET  ,
VNET_NAMEtcp_syncache.zone,
"Current number of entries in syncache  
)

◆ VNET_DEFINE()

VNET_DEFINE ( int  ,
tcp_sc_rst_sock_fail   
)

◆ VNET_DEFINE_STATIC() [1/4]

VNET_DEFINE_STATIC ( int  ,
functions_inherit_listen_socket_stack   
)

◆ VNET_DEFINE_STATIC() [2/4]

VNET_DEFINE_STATIC ( int  ,
tcp_syncookies   
)

◆ VNET_DEFINE_STATIC() [3/4]

VNET_DEFINE_STATIC ( int  ,
tcp_syncookiesonly   
)
pure virtual

◆ VNET_DEFINE_STATIC() [4/4]

VNET_DEFINE_STATIC ( struct tcp_syncache  ,
tcp_syncache   
)

Variable Documentation

◆ tcp_sc_msstab

int tcp_sc_msstab[] = { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }
static

Definition at line 2180 of file tcp_syncache.c.

Referenced by syncookie_generate(), and syncookie_lookup().

◆ tcp_sc_wstab

int tcp_sc_wstab[] = { 0, 0, 1, 2, 4, 6, 7, 8 }
static

Definition at line 2195 of file tcp_syncache.c.

Referenced by syncookie_generate(), and syncookie_lookup().