FreeBSD kernel IPv4 code
tcp_fastopen.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include <sys/param.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/hash.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/proc.h>
#include <sys/rmlock.h>
#include <sys/sbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <crypto/siphash/siphash.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_fastopen.h>
Include dependency graph for tcp_fastopen.c:

Go to the source code of this file.

Data Structures

struct  tcp_fastopen_keylist
 
struct  tcp_fastopen_callout
 

Macros

#define TCP_FASTOPEN_KEY_LEN   SIPHASH_KEY_LENGTH
 
#define TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT   16
 
#define TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT   2048 /* must be power of 2 */
 
#define TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT   900 /* seconds */
 
#define TCP_FASTOPEN_MAX_KEYS   2
 
#define TCP_FASTOPEN_MAX_PSKS   2
 
#define V_tcp_fastopen_acceptany   VNET(tcp_fastopen_acceptany)
 
#define V_tcp_fastopen_autokey   VNET(tcp_fastopen_autokey)
 
#define V_tcp_fastopen_ccache_buckets   VNET(tcp_fastopen_ccache_buckets)
 
#define V_tcp_fastopen_numkeys   VNET(tcp_fastopen_numkeys)
 
#define V_tcp_fastopen_numpsks   VNET(tcp_fastopen_numpsks)
 
#define V_tcp_fastopen_path_disable_time   VNET(tcp_fastopen_path_disable_time)
 
#define V_tcp_fastopen_psk_enable   VNET(tcp_fastopen_psk_enable)
 
#define V_tcp_fastopen_keylock   VNET(tcp_fastopen_keylock)
 
#define TCP_FASTOPEN_KEYS_RLOCK(t)   rm_rlock(&V_tcp_fastopen_keylock, (t))
 
#define TCP_FASTOPEN_KEYS_RUNLOCK(t)   rm_runlock(&V_tcp_fastopen_keylock, (t))
 
#define TCP_FASTOPEN_KEYS_WLOCK()   rm_wlock(&V_tcp_fastopen_keylock)
 
#define TCP_FASTOPEN_KEYS_WUNLOCK()   rm_wunlock(&V_tcp_fastopen_keylock)
 
#define V_tcp_fastopen_keys   VNET(tcp_fastopen_keys)
 
#define V_tcp_fastopen_autokey_ctx   VNET(tcp_fastopen_autokey_ctx)
 
#define V_counter_zone   VNET(counter_zone)
 
#define V_tcp_fastopen_ccache   VNET(tcp_fastopen_ccache)
 
#define CCB_LOCK(ccb)   mtx_lock(&(ccb)->ccb_mtx)
 
#define CCB_UNLOCK(ccb)   mtx_unlock(&(ccb)->ccb_mtx)
 
#define CCB_LOCK_ASSERT(ccb)   mtx_assert(&(ccb)->ccb_mtx, MA_OWNED)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static struct tcp_fastopen_ccache_entrytcp_fastopen_ccache_lookup (struct in_conninfo *, struct tcp_fastopen_ccache_bucket **)
 
static struct tcp_fastopen_ccache_entrytcp_fastopen_ccache_create (struct tcp_fastopen_ccache_bucket *, struct in_conninfo *, uint16_t, uint8_t, uint8_t *)
 
static void tcp_fastopen_ccache_bucket_trim (struct tcp_fastopen_ccache_bucket *, unsigned int)
 
static void tcp_fastopen_ccache_entry_drop (struct tcp_fastopen_ccache_entry *, struct tcp_fastopen_ccache_bucket *)
 
 SYSCTL_NODE (_net_inet_tcp, OID_AUTO, fastopen, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "TCP Fast Open")
 
 VNET_DEFINE_STATIC (int, tcp_fastopen_acceptany)=0
 
 SYSCTL_INT (_net_inet_tcp_fastopen, OID_AUTO, acceptany, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_fastopen_acceptany), 0, "Accept any non-empty cookie")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_autokey)
 
static int sysctl_net_inet_tcp_fastopen_autokey (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, autokey, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, &sysctl_net_inet_tcp_fastopen_autokey, "IU", "Number of seconds between auto-generation of a new key; zero disables")
 
static int sysctl_net_inet_tcp_fastopen_ccache_bucket_limit (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, ccache_bucket_limit, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RWTUN|CTLFLAG_NEEDGIANT, NULL, 0, &sysctl_net_inet_tcp_fastopen_ccache_bucket_limit, "IU", "Max entries per bucket in client cookie cache")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_ccache_buckets)
 
 SYSCTL_UINT (_net_inet_tcp_fastopen, OID_AUTO, ccache_buckets, CTLFLAG_VNET|CTLFLAG_RDTUN, &VNET_NAME(tcp_fastopen_ccache_buckets), 0, "Client cookie cache number of buckets (power of 2)")
 
 VNET_DEFINE (unsigned int, tcp_fastopen_client_enable)
 
static int sysctl_net_inet_tcp_fastopen_client_enable (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, client_enable, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, NULL, 0, &sysctl_net_inet_tcp_fastopen_client_enable, "IU", "Enable/disable TCP Fast Open client functionality")
 
 SYSCTL_INT (_net_inet_tcp_fastopen, OID_AUTO, keylen, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, TCP_FASTOPEN_KEY_LEN, "Key length in bytes")
 
 SYSCTL_INT (_net_inet_tcp_fastopen, OID_AUTO, maxkeys, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, TCP_FASTOPEN_MAX_KEYS, "Maximum number of keys supported")
 
 SYSCTL_INT (_net_inet_tcp_fastopen, OID_AUTO, maxpsks, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, TCP_FASTOPEN_MAX_PSKS, "Maximum number of pre-shared keys supported")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_numkeys)=0
 
 SYSCTL_UINT (_net_inet_tcp_fastopen, OID_AUTO, numkeys, CTLFLAG_VNET|CTLFLAG_RD, &VNET_NAME(tcp_fastopen_numkeys), 0, "Number of keys installed")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_numpsks)=0
 
 SYSCTL_UINT (_net_inet_tcp_fastopen, OID_AUTO, numpsks, CTLFLAG_VNET|CTLFLAG_RD, &VNET_NAME(tcp_fastopen_numpsks), 0, "Number of pre-shared keys installed")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_path_disable_time)
 
 SYSCTL_UINT (_net_inet_tcp_fastopen, OID_AUTO, path_disable_time, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_fastopen_path_disable_time), 0, "Seconds a TFO failure disables a {client_ip, server_ip, server_port} path")
 
 VNET_DEFINE_STATIC (unsigned int, tcp_fastopen_psk_enable)=0
 
static int sysctl_net_inet_tcp_fastopen_psk_enable (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, psk_enable, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, &sysctl_net_inet_tcp_fastopen_psk_enable, "IU", "Enable/disable TCP Fast Open server pre-shared key mode")
 
 VNET_DEFINE (unsigned int, tcp_fastopen_server_enable)=0
 
static int sysctl_net_inet_tcp_fastopen_server_enable (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, server_enable, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, &sysctl_net_inet_tcp_fastopen_server_enable, "IU", "Enable/disable TCP Fast Open server functionality")
 
static int sysctl_net_inet_tcp_fastopen_setkey (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, setkey, CTLFLAG_VNET|CTLTYPE_OPAQUE|CTLFLAG_WR|CTLFLAG_MPSAFE, NULL, 0, &sysctl_net_inet_tcp_fastopen_setkey, "", "Install a new key")
 
static int sysctl_net_inet_tcp_fastopen_setpsk (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, setpsk, CTLFLAG_VNET|CTLTYPE_OPAQUE|CTLFLAG_WR|CTLFLAG_MPSAFE, NULL, 0, &sysctl_net_inet_tcp_fastopen_setpsk, "", "Install a new pre-shared key")
 
static int sysctl_net_inet_tcp_fastopen_ccache_list (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_tcp_fastopen, OID_AUTO, ccache_list, CTLFLAG_VNET|CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_SKIP|CTLFLAG_MPSAFE, NULL, 0, sysctl_net_inet_tcp_fastopen_ccache_list, "A", "List of all client cookie cache entries")
 
 VNET_DEFINE_STATIC (struct rmlock, tcp_fastopen_keylock)
 
 VNET_DEFINE_STATIC (struct tcp_fastopen_keylist, tcp_fastopen_keys)
 
 VNET_DEFINE_STATIC (struct tcp_fastopen_callout, tcp_fastopen_autokey_ctx)
 
 VNET_DEFINE_STATIC (uma_zone_t, counter_zone)
 
static MALLOC_DEFINE (M_TCP_FASTOPEN_CCACHE, "tfo_ccache", "TFO client cookie cache buckets")
 
 VNET_DEFINE_STATIC (struct tcp_fastopen_ccache, tcp_fastopen_ccache)
 
void tcp_fastopen_init (void)
 
void tcp_fastopen_destroy (void)
 
unsigned int * tcp_fastopen_alloc_counter (void)
 
void tcp_fastopen_decrement_counter (unsigned int *counter)
 
static void tcp_fastopen_addkey_locked (uint8_t *key)
 
static void tcp_fastopen_addpsk_locked (uint8_t *psk)
 
static void tcp_fastopen_autokey_locked (void)
 
static void tcp_fastopen_autokey_callout (void *arg)
 
static uint64_t tcp_fastopen_make_cookie (uint8_t key[SIPHASH_KEY_LENGTH], struct in_conninfo *inc)
 
static uint64_t tcp_fastopen_make_psk_cookie (uint8_t *psk, uint8_t *cookie, uint8_t cookie_len)
 
static int tcp_fastopen_find_cookie_match_locked (uint8_t *wire_cookie, uint64_t *cur_cookie)
 
int tcp_fastopen_check_cookie (struct in_conninfo *inc, uint8_t *cookie, unsigned int len, uint64_t *latest_cookie)
 
void tcp_fastopen_connect (struct tcpcb *tp)
 
void tcp_fastopen_disable_path (struct tcpcb *tp)
 
void tcp_fastopen_update_cache (struct tcpcb *tp, uint16_t mss, uint8_t cookie_len, uint8_t *cookie)
 

Macro Definition Documentation

◆ CCB_LOCK

#define CCB_LOCK (   ccb)    mtx_lock(&(ccb)->ccb_mtx)

Definition at line 380 of file tcp_fastopen.c.

◆ CCB_LOCK_ASSERT

#define CCB_LOCK_ASSERT (   ccb)    mtx_assert(&(ccb)->ccb_mtx, MA_OWNED)

Definition at line 382 of file tcp_fastopen.c.

◆ CCB_UNLOCK

#define CCB_UNLOCK (   ccb)    mtx_unlock(&(ccb)->ccb_mtx)

Definition at line 381 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT

#define TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT   16

Definition at line 208 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT

#define TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT   2048 /* must be power of 2 */

Definition at line 209 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_KEY_LEN

#define TCP_FASTOPEN_KEY_LEN   SIPHASH_KEY_LENGTH

Definition at line 194 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_KEYS_RLOCK

#define TCP_FASTOPEN_KEYS_RLOCK (   t)    rm_rlock(&V_tcp_fastopen_keylock, (t))

Definition at line 361 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_KEYS_RUNLOCK

#define TCP_FASTOPEN_KEYS_RUNLOCK (   t)    rm_runlock(&V_tcp_fastopen_keylock, (t))

Definition at line 362 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_KEYS_WLOCK

#define TCP_FASTOPEN_KEYS_WLOCK ( )    rm_wlock(&V_tcp_fastopen_keylock)

Definition at line 363 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_KEYS_WUNLOCK

#define TCP_FASTOPEN_KEYS_WUNLOCK ( )    rm_wunlock(&V_tcp_fastopen_keylock)

Definition at line 364 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_MAX_KEYS

#define TCP_FASTOPEN_MAX_KEYS   2

Definition at line 214 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_MAX_PSKS

#define TCP_FASTOPEN_MAX_PSKS   2

Definition at line 225 of file tcp_fastopen.c.

◆ TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT

#define TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT   900 /* seconds */

Definition at line 211 of file tcp_fastopen.c.

◆ V_counter_zone

#define V_counter_zone   VNET(counter_zone)

Definition at line 373 of file tcp_fastopen.c.

◆ V_tcp_fastopen_acceptany

#define V_tcp_fastopen_acceptany   VNET(tcp_fastopen_acceptany)

Definition at line 261 of file tcp_fastopen.c.

◆ V_tcp_fastopen_autokey

#define V_tcp_fastopen_autokey   VNET(tcp_fastopen_autokey)

Definition at line 267 of file tcp_fastopen.c.

◆ V_tcp_fastopen_autokey_ctx

#define V_tcp_fastopen_autokey_ctx   VNET(tcp_fastopen_autokey_ctx)

Definition at line 370 of file tcp_fastopen.c.

◆ V_tcp_fastopen_ccache

#define V_tcp_fastopen_ccache   VNET(tcp_fastopen_ccache)

Definition at line 378 of file tcp_fastopen.c.

◆ V_tcp_fastopen_ccache_buckets

#define V_tcp_fastopen_ccache_buckets   VNET(tcp_fastopen_ccache_buckets)

Definition at line 282 of file tcp_fastopen.c.

◆ V_tcp_fastopen_keylock

#define V_tcp_fastopen_keylock   VNET(tcp_fastopen_keylock)

Definition at line 359 of file tcp_fastopen.c.

◆ V_tcp_fastopen_keys

#define V_tcp_fastopen_keys   VNET(tcp_fastopen_keys)

Definition at line 367 of file tcp_fastopen.c.

◆ V_tcp_fastopen_numkeys

#define V_tcp_fastopen_numkeys   VNET(tcp_fastopen_numkeys)

Definition at line 307 of file tcp_fastopen.c.

◆ V_tcp_fastopen_numpsks

#define V_tcp_fastopen_numpsks   VNET(tcp_fastopen_numpsks)

Definition at line 313 of file tcp_fastopen.c.

◆ V_tcp_fastopen_path_disable_time

#define V_tcp_fastopen_path_disable_time   VNET(tcp_fastopen_path_disable_time)

Definition at line 320 of file tcp_fastopen.c.

◆ V_tcp_fastopen_psk_enable

#define V_tcp_fastopen_psk_enable   VNET(tcp_fastopen_psk_enable)

Definition at line 326 of file tcp_fastopen.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_TCP_FASTOPEN_CCACHE  ,
"tfo_ccache"  ,
"TFO client cookie cache buckets"   
)
static

◆ SYSCTL_INT() [1/4]

SYSCTL_INT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
acceptany  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_fastopen_acceptany,
,
"Accept any non-empty cookie  
)

◆ SYSCTL_INT() [2/4]

SYSCTL_INT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
keylen  ,
CTLFLAG_RD  ,
SYSCTL_NULL_INT_PTR  ,
TCP_FASTOPEN_KEY_LEN  ,
"Key length in bytes"   
)

◆ SYSCTL_INT() [3/4]

SYSCTL_INT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
maxkeys  ,
CTLFLAG_RD  ,
SYSCTL_NULL_INT_PTR  ,
TCP_FASTOPEN_MAX_KEYS  ,
"Maximum number of keys supported"   
)

◆ SYSCTL_INT() [4/4]

SYSCTL_INT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
maxpsks  ,
CTLFLAG_RD  ,
SYSCTL_NULL_INT_PTR  ,
TCP_FASTOPEN_MAX_PSKS  ,
"Maximum number of pre-shared keys supported"   
)

◆ sysctl_net_inet_tcp_fastopen_autokey()

static int sysctl_net_inet_tcp_fastopen_autokey ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_net_inet_tcp_fastopen_ccache_bucket_limit()

static int sysctl_net_inet_tcp_fastopen_ccache_bucket_limit ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 802 of file tcp_fastopen.c.

References tcp_fastopen_ccache_bucket_trim(), and V_tcp_fastopen_ccache.

Here is the call graph for this function:

◆ sysctl_net_inet_tcp_fastopen_ccache_list()

◆ sysctl_net_inet_tcp_fastopen_client_enable()

static int sysctl_net_inet_tcp_fastopen_client_enable ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_net_inet_tcp_fastopen_psk_enable()

static int sysctl_net_inet_tcp_fastopen_psk_enable ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_net_inet_tcp_fastopen_server_enable()

◆ sysctl_net_inet_tcp_fastopen_setkey()

static int sysctl_net_inet_tcp_fastopen_setkey ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 756 of file tcp_fastopen.c.

References tcp_fastopen_addkey_locked(), TCP_FASTOPEN_KEY_LEN, TCP_FASTOPEN_KEYS_WLOCK, and TCP_FASTOPEN_KEYS_WUNLOCK.

Here is the call graph for this function:

◆ sysctl_net_inet_tcp_fastopen_setpsk()

static int sysctl_net_inet_tcp_fastopen_setpsk ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 779 of file tcp_fastopen.c.

References tcp_fastopen_addpsk_locked(), TCP_FASTOPEN_KEY_LEN, TCP_FASTOPEN_KEYS_WLOCK, and TCP_FASTOPEN_KEYS_WUNLOCK.

Here is the call graph for this function:

◆ SYSCTL_NODE()

SYSCTL_NODE ( _net_inet_tcp  ,
OID_AUTO  ,
fastopen  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"TCP Fast Open"   
)

◆ SYSCTL_PROC() [1/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
autokey  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_autokey,
"IU"  ,
"Number of seconds between auto-generation of a new key; zero disables"   
)

◆ SYSCTL_PROC() [2/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
ccache_bucket_limit  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RWTUN|  CTLFLAG_NEEDGIANT,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_ccache_bucket_limit,
"IU"  ,
"Max entries per bucket in client cookie cache"   
)

◆ SYSCTL_PROC() [3/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
ccache_list  ,
CTLFLAG_VNET|CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_SKIP|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_ccache_list  ,
"A"  ,
"List of all client cookie cache entries"   
)

◆ SYSCTL_PROC() [4/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
client_enable  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|  CTLFLAG_NEEDGIANT,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_client_enable,
"IU"  ,
"Enable/disable TCP Fast Open client functionality"   
)

◆ SYSCTL_PROC() [5/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
psk_enable  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_psk_enable,
"IU"  ,
"Enable/disable TCP Fast Open server pre-shared key mode"   
)

◆ SYSCTL_PROC() [6/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
server_enable  ,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_server_enable,
"IU"  ,
"Enable/disable TCP Fast Open server functionality"   
)

◆ SYSCTL_PROC() [7/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
setkey  ,
CTLFLAG_VNET|CTLTYPE_OPAQUE|CTLFLAG_WR|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_setkey,
""  ,
"Install a new key"   
)

◆ SYSCTL_PROC() [8/8]

SYSCTL_PROC ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
setpsk  ,
CTLFLAG_VNET|CTLTYPE_OPAQUE|CTLFLAG_WR|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_net_inet_tcp_fastopen_setpsk,
""  ,
"Install a new pre-shared key"   
)

◆ SYSCTL_UINT() [1/4]

SYSCTL_UINT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
ccache_buckets  ,
CTLFLAG_VNET|  CTLFLAG_RDTUN,
VNET_NAMEtcp_fastopen_ccache_buckets,
,
"Client cookie cache number of buckets (power of 2)"   
)

◆ SYSCTL_UINT() [2/4]

SYSCTL_UINT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
numkeys  ,
CTLFLAG_VNET|  CTLFLAG_RD,
VNET_NAMEtcp_fastopen_numkeys,
,
"Number of keys installed"   
)

◆ SYSCTL_UINT() [3/4]

SYSCTL_UINT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
numpsks  ,
CTLFLAG_VNET|  CTLFLAG_RD,
VNET_NAMEtcp_fastopen_numpsks,
,
"Number of pre-shared keys installed"   
)

◆ SYSCTL_UINT() [4/4]

SYSCTL_UINT ( _net_inet_tcp_fastopen  ,
OID_AUTO  ,
path_disable_time  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_fastopen_path_disable_time,
,
"Seconds a TFO failure disables a {client_ip, server_ip, server_port} path"   
)

◆ tcp_fastopen_addkey_locked()

static void tcp_fastopen_addkey_locked ( uint8_t key)
static

Definition at line 488 of file tcp_fastopen.c.

References TCP_FASTOPEN_KEY_LEN, TCP_FASTOPEN_MAX_KEYS, V_tcp_fastopen_keys, and V_tcp_fastopen_numkeys.

Referenced by sysctl_net_inet_tcp_fastopen_setkey(), and tcp_fastopen_autokey_locked().

Here is the caller graph for this function:

◆ tcp_fastopen_addpsk_locked()

static void tcp_fastopen_addpsk_locked ( uint8_t psk)
static

Definition at line 501 of file tcp_fastopen.c.

References TCP_FASTOPEN_KEY_LEN, TCP_FASTOPEN_MAX_PSKS, V_tcp_fastopen_keys, and V_tcp_fastopen_numpsks.

Referenced by sysctl_net_inet_tcp_fastopen_setpsk().

Here is the caller graph for this function:

◆ tcp_fastopen_alloc_counter()

unsigned int * tcp_fastopen_alloc_counter ( void  )

Definition at line 469 of file tcp_fastopen.c.

References V_counter_zone.

Referenced by tcp_default_ctloutput().

Here is the caller graph for this function:

◆ tcp_fastopen_autokey_callout()

static void tcp_fastopen_autokey_callout ( void *  arg)
static

◆ tcp_fastopen_autokey_locked()

static void tcp_fastopen_autokey_locked ( void  )
static

Definition at line 514 of file tcp_fastopen.c.

References tcp_fastopen_addkey_locked(), and TCP_FASTOPEN_KEY_LEN.

Referenced by sysctl_net_inet_tcp_fastopen_server_enable(), and tcp_fastopen_autokey_callout().

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

◆ tcp_fastopen_ccache_bucket_trim()

static void tcp_fastopen_ccache_bucket_trim ( struct tcp_fastopen_ccache_bucket ccb,
unsigned int  limit 
)
static

Definition at line 1111 of file tcp_fastopen.c.

References CCB_LOCK, tcp_fastopen_ccache_bucket::ccb_num_entries, CCB_UNLOCK, and tcp_fastopen_ccache_entry_drop().

Referenced by sysctl_net_inet_tcp_fastopen_ccache_bucket_limit(), sysctl_net_inet_tcp_fastopen_client_enable(), and tcp_fastopen_destroy().

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

◆ tcp_fastopen_ccache_create()

◆ tcp_fastopen_ccache_entry_drop()

static void tcp_fastopen_ccache_entry_drop ( struct tcp_fastopen_ccache_entry cce,
struct tcp_fastopen_ccache_bucket ccb 
)
static

Definition at line 1136 of file tcp_fastopen.c.

References CCB_LOCK_ASSERT, tcp_fastopen_ccache_bucket::ccb_num_entries, and V_tcp_fastopen_ccache.

Referenced by tcp_fastopen_ccache_bucket_trim().

Here is the caller graph for this function:

◆ tcp_fastopen_ccache_lookup()

◆ tcp_fastopen_check_cookie()

int tcp_fastopen_check_cookie ( struct in_conninfo inc,
uint8_t cookie,
unsigned int  len,
uint64_t *  latest_cookie 
)

◆ tcp_fastopen_connect()

◆ tcp_fastopen_decrement_counter()

void tcp_fastopen_decrement_counter ( unsigned int *  counter)

Definition at line 479 of file tcp_fastopen.c.

References V_counter_zone.

Referenced by bbr_do_syn_recv(), rack_do_syn_recv(), syncache_add(), tcp_close(), and tcp_do_segment().

Here is the caller graph for this function:

◆ tcp_fastopen_destroy()

void tcp_fastopen_destroy ( void  )

◆ tcp_fastopen_disable_path()

void tcp_fastopen_disable_path ( struct tcpcb tp)

◆ tcp_fastopen_find_cookie_match_locked()

static int tcp_fastopen_find_cookie_match_locked ( uint8_t wire_cookie,
uint64_t *  cur_cookie 
)
static

Definition at line 574 of file tcp_fastopen.c.

References TCP_FASTOPEN_COOKIE_LEN, tcp_fastopen_make_psk_cookie(), TCP_FASTOPEN_MAX_PSKS, V_tcp_fastopen_keys, V_tcp_fastopen_numpsks, and V_tcp_fastopen_psk_enable.

Referenced by tcp_fastopen_check_cookie().

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

◆ tcp_fastopen_init()

◆ tcp_fastopen_make_cookie()

static uint64_t tcp_fastopen_make_cookie ( uint8_t  key[SIPHASH_KEY_LENGTH],
struct in_conninfo inc 
)
static

Definition at line 535 of file tcp_fastopen.c.

References in_conninfo::inc_flags, and INC_ISIPV6.

Referenced by tcp_fastopen_check_cookie().

Here is the caller graph for this function:

◆ tcp_fastopen_make_psk_cookie()

static uint64_t tcp_fastopen_make_psk_cookie ( uint8_t psk,
uint8_t cookie,
uint8_t  cookie_len 
)
static

Definition at line 560 of file tcp_fastopen.c.

References cookie.

Referenced by tcp_fastopen_connect(), and tcp_fastopen_find_cookie_match_locked().

Here is the caller graph for this function:

◆ tcp_fastopen_update_cache()

void tcp_fastopen_update_cache ( struct tcpcb tp,
uint16_t  mss,
uint8_t  cookie_len,
uint8_t cookie 
)

◆ VNET_DEFINE() [1/2]

VNET_DEFINE ( unsigned int  ,
tcp_fastopen_client_enable   
)

◆ VNET_DEFINE() [2/2]

VNET_DEFINE ( unsigned int  ,
tcp_fastopen_server_enable   
)
pure virtual

◆ VNET_DEFINE_STATIC() [1/12]

VNET_DEFINE_STATIC ( int  ,
tcp_fastopen_acceptany   
)
pure virtual

◆ VNET_DEFINE_STATIC() [2/12]

VNET_DEFINE_STATIC ( struct rmlock  ,
tcp_fastopen_keylock   
)

◆ VNET_DEFINE_STATIC() [3/12]

VNET_DEFINE_STATIC ( struct tcp_fastopen_callout  ,
tcp_fastopen_autokey_ctx   
)

◆ VNET_DEFINE_STATIC() [4/12]

VNET_DEFINE_STATIC ( struct tcp_fastopen_ccache  ,
tcp_fastopen_ccache   
)

◆ VNET_DEFINE_STATIC() [5/12]

VNET_DEFINE_STATIC ( struct tcp_fastopen_keylist  ,
tcp_fastopen_keys   
)

◆ VNET_DEFINE_STATIC() [6/12]

VNET_DEFINE_STATIC ( uma_zone_t  ,
counter_zone   
)

◆ VNET_DEFINE_STATIC() [7/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_autokey   
)

◆ VNET_DEFINE_STATIC() [8/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_ccache_buckets   
)

◆ VNET_DEFINE_STATIC() [9/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_numkeys   
)
pure virtual

◆ VNET_DEFINE_STATIC() [10/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_numpsks   
)
pure virtual

◆ VNET_DEFINE_STATIC() [11/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_path_disable_time   
)

◆ VNET_DEFINE_STATIC() [12/12]

VNET_DEFINE_STATIC ( unsigned int  ,
tcp_fastopen_psk_enable   
)
pure virtual