FreeBSD kernel IPv4 code
|
#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>
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_entry * | tcp_fastopen_ccache_lookup (struct in_conninfo *, struct tcp_fastopen_ccache_bucket **) |
static struct tcp_fastopen_ccache_entry * | tcp_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) |
#define CCB_LOCK | ( | ccb | ) | mtx_lock(&(ccb)->ccb_mtx) |
Definition at line 380 of file tcp_fastopen.c.
#define CCB_LOCK_ASSERT | ( | ccb | ) | mtx_assert(&(ccb)->ccb_mtx, MA_OWNED) |
Definition at line 382 of file tcp_fastopen.c.
#define CCB_UNLOCK | ( | ccb | ) | mtx_unlock(&(ccb)->ccb_mtx) |
Definition at line 381 of file tcp_fastopen.c.
#define TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT 16 |
Definition at line 208 of file tcp_fastopen.c.
#define TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT 2048 /* must be power of 2 */ |
Definition at line 209 of file tcp_fastopen.c.
#define TCP_FASTOPEN_KEY_LEN SIPHASH_KEY_LENGTH |
Definition at line 194 of file tcp_fastopen.c.
#define TCP_FASTOPEN_KEYS_RLOCK | ( | t | ) | rm_rlock(&V_tcp_fastopen_keylock, (t)) |
Definition at line 361 of file tcp_fastopen.c.
#define TCP_FASTOPEN_KEYS_RUNLOCK | ( | t | ) | rm_runlock(&V_tcp_fastopen_keylock, (t)) |
Definition at line 362 of file tcp_fastopen.c.
#define TCP_FASTOPEN_KEYS_WLOCK | ( | ) | rm_wlock(&V_tcp_fastopen_keylock) |
Definition at line 363 of file tcp_fastopen.c.
#define TCP_FASTOPEN_KEYS_WUNLOCK | ( | ) | rm_wunlock(&V_tcp_fastopen_keylock) |
Definition at line 364 of file tcp_fastopen.c.
#define TCP_FASTOPEN_MAX_KEYS 2 |
Definition at line 214 of file tcp_fastopen.c.
#define TCP_FASTOPEN_MAX_PSKS 2 |
Definition at line 225 of file tcp_fastopen.c.
#define TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT 900 /* seconds */ |
Definition at line 211 of file tcp_fastopen.c.
#define V_counter_zone VNET(counter_zone) |
Definition at line 373 of file tcp_fastopen.c.
#define V_tcp_fastopen_acceptany VNET(tcp_fastopen_acceptany) |
Definition at line 261 of file tcp_fastopen.c.
#define V_tcp_fastopen_autokey VNET(tcp_fastopen_autokey) |
Definition at line 267 of file tcp_fastopen.c.
#define V_tcp_fastopen_autokey_ctx VNET(tcp_fastopen_autokey_ctx) |
Definition at line 370 of file tcp_fastopen.c.
#define V_tcp_fastopen_ccache VNET(tcp_fastopen_ccache) |
Definition at line 378 of file tcp_fastopen.c.
#define V_tcp_fastopen_ccache_buckets VNET(tcp_fastopen_ccache_buckets) |
Definition at line 282 of file tcp_fastopen.c.
#define V_tcp_fastopen_keylock VNET(tcp_fastopen_keylock) |
Definition at line 359 of file tcp_fastopen.c.
#define V_tcp_fastopen_keys VNET(tcp_fastopen_keys) |
Definition at line 367 of file tcp_fastopen.c.
#define V_tcp_fastopen_numkeys VNET(tcp_fastopen_numkeys) |
Definition at line 307 of file tcp_fastopen.c.
#define V_tcp_fastopen_numpsks VNET(tcp_fastopen_numpsks) |
Definition at line 313 of file tcp_fastopen.c.
#define V_tcp_fastopen_path_disable_time VNET(tcp_fastopen_path_disable_time) |
Definition at line 320 of file tcp_fastopen.c.
#define V_tcp_fastopen_psk_enable VNET(tcp_fastopen_psk_enable) |
Definition at line 326 of file tcp_fastopen.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
SYSCTL_INT | ( | _net_inet_tcp_fastopen | , |
OID_AUTO | , | ||
acceptany | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEtcp_fastopen_acceptany, | ||
0 | , | ||
"Accept any non-empty cookie" | |||
) |
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" | |||
) |
|
static |
Definition at line 662 of file tcp_fastopen.c.
References tcp_fastopen_autokey_callout(), TCP_FASTOPEN_KEYS_WLOCK, TCP_FASTOPEN_KEYS_WUNLOCK, V_tcp_fastopen_autokey, V_tcp_fastopen_autokey_ctx, and V_tcp_fastopen_server_enable.
|
static |
Definition at line 802 of file tcp_fastopen.c.
References tcp_fastopen_ccache_bucket_trim(), and V_tcp_fastopen_ccache.
|
static |
Definition at line 1148 of file tcp_fastopen.c.
References tcp_fastopen_ccache_entry::af, CCB_LOCK, tcp_fastopen_ccache_bucket::ccb_num_entries, CCB_UNLOCK, tcp_fastopen_ccache_entry::cce_client_ip, tcp_fastopen_ccache_entry::cce_server_ip, tcp_fastopen_ccache_entry::cookie, tcp_fastopen_ccache_entry::cookie_len, tcp_fastopen_ccache_entry::disable_time, inet_ntop(), tcp_fastopen_ccache_entry::server_mss, tcp_fastopen_ccache_entry::server_port, V_tcp_fastopen_ccache, and V_tcp_fastopen_path_disable_time.
|
static |
Definition at line 829 of file tcp_fastopen.c.
References CCB_LOCK, tcp_fastopen_ccache_bucket::ccb_num_entries, CCB_UNLOCK, tcp_fastopen_ccache_bucket_trim(), V_tcp_fastopen_ccache, and V_tcp_fastopen_client_enable.
|
static |
Definition at line 690 of file tcp_fastopen.c.
References TCP_FASTOPEN_KEYS_WLOCK, TCP_FASTOPEN_KEYS_WUNLOCK, TCP_FASTOPEN_MAX_PSKS, V_tcp_fastopen_keys, V_tcp_fastopen_numpsks, and V_tcp_fastopen_psk_enable.
|
static |
Definition at line 717 of file tcp_fastopen.c.
References tcp_fastopen_autokey_callout(), tcp_fastopen_autokey_locked(), TCP_FASTOPEN_KEYS_WLOCK, TCP_FASTOPEN_KEYS_WUNLOCK, TCP_FASTOPEN_MAX_KEYS, TCP_FASTOPEN_MAX_PSKS, V_tcp_fastopen_autokey, V_tcp_fastopen_autokey_ctx, V_tcp_fastopen_keys, V_tcp_fastopen_numkeys, V_tcp_fastopen_numpsks, and V_tcp_fastopen_server_enable.
|
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.
|
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.
SYSCTL_NODE | ( | _net_inet_tcp | , |
OID_AUTO | , | ||
fastopen | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"TCP Fast Open" | |||
) |
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" | |||
) |
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" | |||
) |
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" | |||
) |
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_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" | |||
) |
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" | |||
) |
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" | |||
) |
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" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_fastopen | , |
OID_AUTO | , | ||
ccache_buckets | , | ||
CTLFLAG_VNET| | CTLFLAG_RDTUN, | ||
& | VNET_NAMEtcp_fastopen_ccache_buckets, | ||
0 | , | ||
"Client cookie cache number of buckets (power of 2)" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_fastopen | , |
OID_AUTO | , | ||
numkeys | , | ||
CTLFLAG_VNET| | CTLFLAG_RD, | ||
& | VNET_NAMEtcp_fastopen_numkeys, | ||
0 | , | ||
"Number of keys installed" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_fastopen | , |
OID_AUTO | , | ||
numpsks | , | ||
CTLFLAG_VNET| | CTLFLAG_RD, | ||
& | VNET_NAMEtcp_fastopen_numpsks, | ||
0 | , | ||
"Number of pre-shared keys installed" | |||
) |
SYSCTL_UINT | ( | _net_inet_tcp_fastopen | , |
OID_AUTO | , | ||
path_disable_time | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEtcp_fastopen_path_disable_time, | ||
0 | , | ||
"Seconds a TFO failure disables a {client_ip, server_ip, server_port} path" | |||
) |
|
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().
|
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().
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().
|
static |
Definition at line 523 of file tcp_fastopen.c.
References tcp_fastopen_callout::c, tcp_fastopen_autokey_callout(), tcp_fastopen_autokey_locked(), tcp_fastopen_callout::v, and V_tcp_fastopen_autokey.
Referenced by sysctl_net_inet_tcp_fastopen_autokey(), sysctl_net_inet_tcp_fastopen_server_enable(), and tcp_fastopen_autokey_callout().
|
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().
|
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().
|
static |
Definition at line 1051 of file tcp_fastopen.c.
References tcp_fastopen_ccache_entry::af, CCB_LOCK_ASSERT, tcp_fastopen_ccache_bucket::ccb_num_entries, tcp_fastopen_ccache_entry::cce_client_ip, tcp_fastopen_ccache_entry::cce_server_ip, cookie, tcp_fastopen_ccache_entry::cookie, tcp_fastopen_ccache_entry::cookie_len, tcp_fastopen_ccache_entry::disable_time, in_conninfo::inc_flags, INC_ISIPV6, tcp_fastopen_ccache_entry::server_mss, tcp_fastopen_ccache_entry::server_port, tcp_fastopen_ip_addr::v4, tcp_fastopen_ip_addr::v6, and V_tcp_fastopen_ccache.
Referenced by tcp_fastopen_disable_path(), and tcp_fastopen_update_cache().
|
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().
|
static |
Definition at line 1015 of file tcp_fastopen.c.
References tcp_fastopen_ccache_entry::af, CCB_LOCK, tcp_fastopen_ccache_entry::cce_client_ip, tcp_fastopen_ccache_entry::cce_server_ip, in_endpoints::ie_dependfaddr, in_endpoints::ie_dependladdr, in_endpoints::ie_fport, in_conninfo::inc_flags, in_conninfo::inc_ie, INC_ISIPV6, in_addr::s_addr, tcp_fastopen_ccache_entry::server_port, tcp_fastopen_ip_addr::v4, tcp_fastopen_ip_addr::v6, and V_tcp_fastopen_ccache.
Referenced by tcp_fastopen_connect(), tcp_fastopen_disable_path(), and tcp_fastopen_update_cache().
int tcp_fastopen_check_cookie | ( | struct in_conninfo * | inc, |
uint8_t * | cookie, | ||
unsigned int | len, | ||
uint64_t * | latest_cookie | ||
) |
Definition at line 610 of file tcp_fastopen.c.
References cookie, TCP_FASTOPEN_COOKIE_LEN, tcp_fastopen_find_cookie_match_locked(), TCP_FASTOPEN_KEYS_RLOCK, TCP_FASTOPEN_KEYS_RUNLOCK, tcp_fastopen_make_cookie(), TCP_FASTOPEN_MAX_KEYS, V_tcp_fastopen_acceptany, V_tcp_fastopen_keys, and V_tcp_fastopen_numkeys.
Referenced by syncache_add().
void tcp_fastopen_connect | ( | struct tcpcb * | tp | ) |
Definition at line 868 of file tcp_fastopen.c.
References CCB_UNLOCK, tcpcb::client, tcp_fastopen_ccache_entry::cookie, tcp_fastopen_ccache_entry::cookie_len, tcp_fastopen_ccache_entry::disable_time, inpcb::inp_inc, tcp_fastopen_ccache_entry::server_mss, tcpcb::snd_wnd, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_maxseg, tcpcb::t_tfo_client_cookie_len, tcpcb::t_tfo_cookie, tcp_fastopen_ccache_lookup(), TCP_FASTOPEN_COOKIE_LEN, tcp_fastopen_make_psk_cookie(), tcp_mss(), and V_tcp_fastopen_path_disable_time.
Referenced by tcp_usr_send().
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().
void tcp_fastopen_destroy | ( | void | ) |
Definition at line 447 of file tcp_fastopen.c.
References tcp_fastopen_ccache_bucket::ccb_mtx, tcp_fastopen_ccache_bucket_trim(), V_counter_zone, V_tcp_fastopen_autokey_ctx, V_tcp_fastopen_ccache, and V_tcp_fastopen_keylock.
void tcp_fastopen_disable_path | ( | struct tcpcb * | tp | ) |
Definition at line 956 of file tcp_fastopen.c.
References CCB_UNLOCK, tcp_fastopen_ccache_entry::cookie_len, tcp_fastopen_ccache_entry::disable_time, inpcb::inp_inc, tcp_fastopen_ccache_entry::server_mss, tcpcb::t_flags, tcpcb::t_inpcb, tcp_fastopen_ccache_create(), and tcp_fastopen_ccache_lookup().
Referenced by bbr_do_segment_nounlock(), rack_do_segment_nounlock(), tcp_do_segment(), and tcp_drop_syn_sent().
|
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().
void tcp_fastopen_init | ( | void | ) |
Definition at line 385 of file tcp_fastopen.c.
References TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT, TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT, TCP_FASTOPEN_MAX_KEYS, TCP_FASTOPEN_MAX_PSKS, V_counter_zone, V_tcp_fastopen_autokey_ctx, V_tcp_fastopen_ccache, V_tcp_fastopen_ccache_buckets, V_tcp_fastopen_client_enable, V_tcp_fastopen_keylock, and V_tcp_fastopen_keys.
Referenced by tcp_vnet_init().
|
static |
Definition at line 535 of file tcp_fastopen.c.
References in_conninfo::inc_flags, and INC_ISIPV6.
Referenced by tcp_fastopen_check_cookie().
|
static |
Definition at line 560 of file tcp_fastopen.c.
References cookie.
Referenced by tcp_fastopen_connect(), and tcp_fastopen_find_cookie_match_locked().
void tcp_fastopen_update_cache | ( | struct tcpcb * | tp, |
uint16_t | mss, | ||
uint8_t | cookie_len, | ||
uint8_t * | cookie | ||
) |
Definition at line 981 of file tcp_fastopen.c.
References CCB_UNLOCK, cookie, tcp_fastopen_ccache_entry::cookie, tcp_fastopen_ccache_entry::cookie_len, tcp_fastopen_ccache_entry::disable_time, inpcb::inp_inc, tcp_fastopen_ccache_entry::server_mss, tcpcb::t_inpcb, tcp_fastopen_ccache_create(), and tcp_fastopen_ccache_lookup().
Referenced by bbr_do_segment_nounlock(), rack_do_segment_nounlock(), and tcp_do_segment().
VNET_DEFINE | ( | unsigned int | , |
tcp_fastopen_client_enable | |||
) |
|
pure virtual |
|
pure virtual |
VNET_DEFINE_STATIC | ( | struct rmlock | , |
tcp_fastopen_keylock | |||
) |
VNET_DEFINE_STATIC | ( | struct tcp_fastopen_callout | , |
tcp_fastopen_autokey_ctx | |||
) |
VNET_DEFINE_STATIC | ( | struct tcp_fastopen_ccache | , |
tcp_fastopen_ccache | |||
) |
VNET_DEFINE_STATIC | ( | struct tcp_fastopen_keylist | , |
tcp_fastopen_keys | |||
) |
VNET_DEFINE_STATIC | ( | uma_zone_t | , |
counter_zone | |||
) |
VNET_DEFINE_STATIC | ( | unsigned int | , |
tcp_fastopen_autokey | |||
) |
VNET_DEFINE_STATIC | ( | unsigned int | , |
tcp_fastopen_ccache_buckets | |||
) |
|
pure virtual |
|
pure virtual |
VNET_DEFINE_STATIC | ( | unsigned int | , |
tcp_fastopen_path_disable_time | |||
) |
|
pure virtual |