FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/syslog.h>
#include <sys/protosw.h>
#include <sys/random.h>
#include <vm/uma.h>
#include <net/route.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_kdtrace.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_hpts.h>
#include <netinet/tcpip.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>
Go to the source code of this file.
Macros | |
#define | V_tcptw_zone VNET(tcptw_zone) |
#define | V_twq_2msl VNET(twq_2msl) |
#define | V_tw_lock VNET(tw_lock) |
#define | TW_LOCK_INIT(tw, d) rw_init_flags(&(tw), (d), 0) |
#define | TW_LOCK_DESTROY(tw) rw_destroy(&(tw)) |
#define | TW_RLOCK(tw) rw_rlock(&(tw)) |
#define | TW_WLOCK(tw) rw_wlock(&(tw)) |
#define | TW_RUNLOCK(tw) rw_runlock(&(tw)) |
#define | TW_WUNLOCK(tw) rw_wunlock(&(tw)) |
#define | TW_LOCK_ASSERT(tw) rw_assert(&(tw), RA_LOCKED) |
#define | TW_RLOCK_ASSERT(tw) rw_assert(&(tw), RA_RLOCKED) |
#define | TW_WLOCK_ASSERT(tw) rw_assert(&(tw), RA_WLOCKED) |
#define | TW_UNLOCK_ASSERT(tw) rw_assert(&(tw), RA_UNLOCKED) |
#define | V_nolocaltimewait VNET(nolocaltimewait) |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE_STATIC (uma_zone_t, tcptw_zone) | |
VNET_DEFINE_STATIC (TAILQ_HEAD(, tcptw), twq_2msl) | |
VNET_DEFINE_STATIC (struct rwlock, tw_lock) | |
static void | tcp_tw_2msl_reset (struct tcptw *, int) |
static void | tcp_tw_2msl_stop (struct tcptw *, int) |
static int | tcp_twrespond (struct tcptw *, int) |
static int | tcptw_auto_size (void) |
static int | sysctl_maxtcptw (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_NEEDGIANT, &maxtcptw, 0, sysctl_maxtcptw, "IU", "Maximum number of compressed TCP TIME_WAIT entries") | |
VNET_DEFINE_STATIC (bool, nolocaltimewait) | |
SYSCTL_BOOL (_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(nolocaltimewait), true, "Do not create compressed TCP TIME_WAIT entries for local connections") | |
void | tcp_tw_zone_change (void) |
void | tcp_tw_init (void) |
void | tcp_twstart (struct tcpcb *tp) |
int | tcp_twcheck (struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, struct mbuf *m, int tlen) |
void | tcp_twclose (struct tcptw *tw, int reuse) |
struct tcptw * | tcp_tw_2msl_scan (int reuse) |
Variables | |
static int | maxtcptw |
#define TW_LOCK_ASSERT | ( | tw | ) | rw_assert(&(tw), RA_LOCKED) |
Definition at line 135 of file tcp_timewait.c.
#define TW_LOCK_DESTROY | ( | tw | ) | rw_destroy(&(tw)) |
Definition at line 130 of file tcp_timewait.c.
#define TW_LOCK_INIT | ( | tw, | |
d | |||
) | rw_init_flags(&(tw), (d), 0) |
Definition at line 129 of file tcp_timewait.c.
#define TW_RLOCK | ( | tw | ) | rw_rlock(&(tw)) |
Definition at line 131 of file tcp_timewait.c.
#define TW_RLOCK_ASSERT | ( | tw | ) | rw_assert(&(tw), RA_RLOCKED) |
Definition at line 136 of file tcp_timewait.c.
#define TW_RUNLOCK | ( | tw | ) | rw_runlock(&(tw)) |
Definition at line 133 of file tcp_timewait.c.
#define TW_UNLOCK_ASSERT | ( | tw | ) | rw_assert(&(tw), RA_UNLOCKED) |
Definition at line 138 of file tcp_timewait.c.
#define TW_WLOCK | ( | tw | ) | rw_wlock(&(tw)) |
Definition at line 132 of file tcp_timewait.c.
#define TW_WLOCK_ASSERT | ( | tw | ) | rw_assert(&(tw), RA_WLOCKED) |
Definition at line 137 of file tcp_timewait.c.
#define TW_WUNLOCK | ( | tw | ) | rw_wunlock(&(tw)) |
Definition at line 134 of file tcp_timewait.c.
#define V_nolocaltimewait VNET(nolocaltimewait) |
Definition at line 185 of file tcp_timewait.c.
#define V_tcptw_zone VNET(tcptw_zone) |
Definition at line 108 of file tcp_timewait.c.
#define V_tw_lock VNET(tw_lock) |
Definition at line 127 of file tcp_timewait.c.
#define V_twq_2msl VNET(twq_2msl) |
Definition at line 123 of file tcp_timewait.c.
__FBSDID | ( | "$FreeBSD$" | ) |
SYSCTL_BOOL | ( | _net_inet_tcp | , |
OID_AUTO | , | ||
nolocaltimewait | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEnolocaltimewait, | ||
true | , | ||
"Do not create compressed TCP TIME_WAIT entries for local connections" | |||
) |
|
static |
Definition at line 162 of file tcp_timewait.c.
References maxtcptw, tcptw_auto_size(), and V_tcptw_zone.
SYSCTL_PROC | ( | _net_inet_tcp | , |
OID_AUTO | , | ||
maxtcptw | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_NEEDGIANT, | ||
& | maxtcptw, | ||
0 | , | ||
sysctl_maxtcptw | , | ||
"IU" | , | ||
"Maximum number of compressed TCP TIME_WAIT entries" | |||
) |
|
static |
Definition at line 759 of file tcp_timewait.c.
References INP_WLOCK_ASSERT, tcptw::tw_inpcb, tcptw::tw_time, TW_WLOCK, TW_WUNLOCK, V_tcp_msl, V_tw_lock, and V_twq_2msl.
Referenced by tcp_twcheck(), and tcp_twstart().
struct tcptw * tcp_tw_2msl_scan | ( | int | reuse | ) |
Definition at line 803 of file tcp_timewait.c.
References in_pcbref(), in_pcbrele_wlocked(), INP_WLOCK, INP_WUNLOCK, intotw, tcp_twclose(), tcptw::tw_inpcb, TW_RLOCK, TW_RUNLOCK, tcptw::tw_time, V_tw_lock, and V_twq_2msl.
Referenced by tcp_slowtimo(), and tcp_twstart().
|
static |
Definition at line 774 of file tcp_timewait.c.
References in_pcbrele_wlocked(), TCPS_TIME_WAIT, TCPSTATES_DEC, tcptw::tw_cred, tcptw::tw_inpcb, TW_WLOCK, TW_WUNLOCK, V_tcptw_zone, V_tw_lock, and V_twq_2msl.
Referenced by tcp_twclose().
void tcp_tw_init | ( | void | ) |
Definition at line 199 of file tcp_timewait.c.
References maxtcptw, tcptw_auto_size(), TW_LOCK_INIT, V_tcptw_zone, V_tw_lock, and V_twq_2msl.
Referenced by tcp_vnet_init().
void tcp_tw_zone_change | ( | void | ) |
Definition at line 191 of file tcp_timewait.c.
References maxtcptw, tcptw_auto_size(), and V_tcptw_zone.
int tcp_twcheck | ( | struct inpcb * | inp, |
struct tcpopt * | to, | ||
struct tcphdr * | th, | ||
struct mbuf * | m, | ||
int | tlen | ||
) |
Definition at line 392 of file tcp_timewait.c.
References INP_LOCK_ASSERT, INP_RLOCK_ASSERT, INP_TRY_UPGRADE, INP_UNLOCK, INP_WLOCK_ASSERT, intotw, tcptw::rcv_nxt, SEQ_GT, tcptw::snd_nxt, tcptw::t_port, tcptw::t_recent, tcp_get_flags(), TCP_PROBE5, tcp_respond(), tcp_tw_2msl_reset(), tcp_twclose(), tcp_twrespond(), TCPSTAT_INC, tcpopt::to_flags, tcpopt::to_tsval, TOF_TS, TSTMP_LT, and V_tcp_tolerate_missing_ts.
Referenced by tcp_input_with_port(), and toe_4tuple_check().
void tcp_twclose | ( | struct tcptw * | tw, |
int | reuse | ||
) |
Definition at line 541 of file tcp_timewait.c.
References in_pcbdrop(), in_pcbfree(), inpcb::inp_flags, inpcb::inp_ppcb, inpcb::inp_socket, INP_SOCKREF, INP_TIMEWAIT, INP_WLOCK_ASSERT, INP_WUNLOCK, intotw, tcp_tw_2msl_stop(), TCPSTAT_INC, and tcptw::tw_inpcb.
Referenced by sysctl_drop(), tcp_tw_2msl_scan(), and tcp_twcheck().
|
static |
Definition at line 600 of file tcp_timewait.c.
References inpcb::in6p_outputopts, in_pseudo(), in_conninfo::inc_flags, INC_ISIPV6, inpcb::inp_inc, inpcb::inp_options, INP_WLOCK_ASSERT, IP_DF, ip::ip_dst, ip::ip_len, ip::ip_off, ip_output(), IP_ROUTETOIF, IPPROTO_TCP, IPPROTO_UDP, tcptw::last_win, tcptw::rcv_nxt, in_addr::s_addr, tcptw::snd_nxt, tcptw::t_port, tcptw::t_recent, tcp_addoptions(), TCP_PROBE5, tcp_set_flags(), tcp_ts_getticks(), tcpip_fillheaders(), TCPSTAT_INC, TF_SIGNATURE, tcpopt::to_flags, tcpopt::to_signature, tcpopt::to_tsecr, tcpopt::to_tsval, TOF_SIGNATURE, TOF_TS, tcptw::ts_offset, tcptw::tw_flags, tcptw::tw_inpcb, tcptw::tw_so_options, udphdr::uh_dport, udphdr::uh_sport, udphdr::uh_sum, udphdr::uh_ulen, V_path_mtu_discovery, and V_tcp_udp_tunneling_port.
Referenced by tcp_twcheck(), and tcp_twstart().
void tcp_twstart | ( | struct tcpcb * | tp | ) |
Definition at line 236 of file tcp_timewait.c.
References in_localip(), in_pcbdrop(), in_pcbref(), in_conninfo::inc_flags, INC_ISIPV6, INP_DROPPED, inpcb::inp_flags, inpcb::inp_inc, inpcb::inp_ppcb, inpcb::inp_socket, INP_SOCKREF, INP_TIMEWAIT, INP_WLOCK_ASSERT, INP_WUNLOCK, tcptw::last_win, tcpcb::rcv_adv, tcpcb::rcv_nxt, tcptw::rcv_nxt, tcpcb::rcv_scale, SEQ_GT, tcpcb::snd_nxt, tcptw::snd_nxt, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_port, tcptw::t_port, tcptw::t_recent, tcp_discardcb(), tcp_hpts_remove(), tcp_state_change(), tcp_tw_2msl_reset(), tcp_tw_2msl_scan(), tcp_twrespond(), TCPS_TIME_WAIT, TCPSTATES_INC, TF_ACKNOW, TF_NOOPT, TF_RCVD_TSTMP, TF_REQ_TSTMP, tcpcb::ts_offset, tcptw::ts_offset, tcpcb::ts_recent, tcptw::tw_cred, tcptw::tw_flags, tcptw::tw_inpcb, tcptw::tw_so_options, tcptw::tw_time, V_nolocaltimewait, and V_tcptw_zone.
Referenced by bbr_do_closing(), bbr_process_data(), rack_do_closing(), rack_do_compressed_ack_processing(), rack_process_data(), and tcp_do_segment().
|
static |
Definition at line 145 of file tcp_timewait.c.
References V_ipport_firstauto, and V_ipport_lastauto.
Referenced by sysctl_maxtcptw(), tcp_tw_init(), and tcp_tw_zone_change().
VNET_DEFINE_STATIC | ( | bool | , |
nolocaltimewait | |||
) |
VNET_DEFINE_STATIC | ( | struct rwlock | , |
tw_lock | |||
) |
VNET_DEFINE_STATIC | ( | TAILQ_HEAD(, tcptw) | , |
twq_2msl | |||
) |
VNET_DEFINE_STATIC | ( | uma_zone_t | , |
tcptw_zone | |||
) |
|
static |
Definition at line 109 of file tcp_timewait.c.
Referenced by sysctl_maxtcptw(), tcp_tw_init(), and tcp_tw_zone_change().