FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_kern_tls.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/arb.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/refcount.h>
#include <sys/kernel.h>
#include <sys/ktls.h>
#include <sys/qmath.h>
#include <sys/sysctl.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
#include <sys/proc.h>
#include <sys/jail.h>
#include <sys/stats.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_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.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_log_buf.h>
#include <netinet/tcpip.h>
#include <netinet/cc/cc.h>
#include <netinet/tcp_fastopen.h>
#include <netinet/tcp_hpts.h>
#include <netipsec/ipsec_support.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
Go to the source code of this file.
Macros | |
#define | TCPDEBUG0 |
#define | TCPDEBUG1() |
#define | TCPDEBUG2(req) |
#define | V_tcp_require_unique_port VNET(tcp_require_unique_port) |
#define | INP_WLOCK_RECHECK_CLEANUP(inp, cleanup) |
#define | INP_WLOCK_RECHECK(inp) INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | tcp_disconnect (struct tcpcb *) |
static void | tcp_usrclosed (struct tcpcb *) |
static void | tcp_fill_info (struct tcpcb *, struct tcp_info *) |
static int | tcp_pru_options_support (struct tcpcb *tp, int flags) |
VNET_DEFINE (int, tcp_require_unique_port)=0 | |
SYSCTL_INT (_net_inet_tcp, OID_AUTO, require_unique_port, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_require_unique_port), 0, "Require globally-unique ephemeral port for outgoing connections") | |
static int | tcp_usr_attach (struct socket *so, int proto, struct thread *td) |
static void | tcp_usr_detach (struct socket *so) |
static int | tcp_usr_disconnect (struct socket *so) |
static int | tcp_usr_shutdown (struct socket *so) |
static int | tcp_usr_rcvd (struct socket *so, int flags) |
static int | tcp_usr_send (struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td) |
static int | tcp_usr_ready (struct socket *so, struct mbuf *m, int count) |
static void | tcp_usr_abort (struct socket *so) |
static void | tcp_usr_close (struct socket *so) |
static int | tcp_usr_rcvoob (struct socket *so, struct mbuf *m, int flags) |
int | tcp_ctloutput_set (struct inpcb *inp, struct sockopt *sopt) |
static int | tcp_ctloutput_get (struct inpcb *inp, struct sockopt *sopt) |
int | tcp_ctloutput (struct socket *so, struct sockopt *sopt) |
static int | tcp_set_cc_mod (struct inpcb *inp, struct sockopt *sopt) |
int | tcp_default_ctloutput (struct inpcb *inp, struct sockopt *sopt) |
Variables | |
struct cc_algo | newreno_cc_algo |
#define INP_WLOCK_RECHECK | ( | inp | ) | INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */) |
Definition at line 1714 of file tcp_usrreq.c.
#define INP_WLOCK_RECHECK_CLEANUP | ( | inp, | |
cleanup | |||
) |
Definition at line 1705 of file tcp_usrreq.c.
#define TCPDEBUG0 |
Definition at line 144 of file tcp_usrreq.c.
#define TCPDEBUG1 | ( | ) |
Definition at line 145 of file tcp_usrreq.c.
#define TCPDEBUG2 | ( | req | ) |
Definition at line 146 of file tcp_usrreq.c.
#define V_tcp_require_unique_port VNET(tcp_require_unique_port) |
Definition at line 157 of file tcp_usrreq.c.
__FBSDID | ( | "$FreeBSD$" | ) |
SYSCTL_INT | ( | _net_inet_tcp | , |
OID_AUTO | , | ||
require_unique_port | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEtcp_require_unique_port, | ||
0 | , | ||
"Require globally-unique ephemeral port for outgoing connections" | |||
) |
int tcp_ctloutput | ( | struct socket * | so, |
struct sockopt * | sopt | ||
) |
Definition at line 1944 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, sotoinpcb, tcp_ctloutput_get(), and tcp_ctloutput_set().
|
static |
Definition at line 1894 of file tcp_usrreq.c.
References find_tcp_function_alias(), tcp_function_set::function_set_name, INP_DROPPED, inpcb::inp_flags, INP_IPV6PROTO, inpcb::inp_socket, INP_TIMEWAIT, inpcb::inp_vflag, INP_WLOCK_ASSERT, INP_WUNLOCK, intotcpcb, ip_ctloutput(), IPPROTO_TCP, tcp_function_set::pcbcnt, tcpcb::t_fb, TCP_FUNCTION_NAME_LEN_MAX, tcp_function_block::tfb_refcnt, tcp_function_block::tfb_tcp_block_name, and tcp_function_block::tfb_tcp_ctloutput.
Referenced by tcp_ctloutput().
int tcp_ctloutput_set | ( | struct inpcb * | inp, |
struct sockopt * | sopt | ||
) |
Definition at line 1717 of file tcp_usrreq.c.
References find_and_ref_tcp_functions(), INP_DROPPED, inpcb::inp_flags, inpcb::inp_ip_tos, INP_IPV6PROTO, inpcb::inp_socket, INP_TIMEWAIT, inpcb::inp_vflag, INP_WLOCK, INP_WLOCK_ASSERT, INP_WUNLOCK, intotcpcb, ip_ctloutput(), IPPROTO_IP, IPPROTO_TCP, tcpcb::t_fb, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_state, TCP_FUNC_BEING_REMOVED, tcp_hpts_remove(), tcp_offload_ctloutput(), TCPS_CLOSED, TF_TOE, tcp_function_block::tfb_flags, tcp_function_block::tfb_refcnt, tcp_function_block::tfb_tcp_ctloutput, tcp_function_block::tfb_tcp_fb_fini, tcp_function_block::tfb_tcp_fb_init, and tcp_function_block::tfb_tcp_handoff_ok.
Referenced by tcp_ctloutput(), and tcp_sysctl_setsockopt().
int tcp_default_ctloutput | ( | struct inpcb * | inp, |
struct sockopt * | sopt | ||
) |
Definition at line 2120 of file tcp_usrreq.c.
References CC_ALGO, CC_ALGOOPT_LIMIT, tcpcb::ccv, tcpcb::client, in_pcblbgroup_numa(), INP_DROPPED, inpcb::inp_flags, INP_IPV6PROTO, inpcb::inp_socket, INP_TIMEWAIT, inpcb::inp_vflag, INP_WLOCK_ASSERT, INP_WLOCK_RECHECK, INP_WLOCK_RECHECK_CLEANUP, INP_WUNLOCK, intotcpcb, IPPROTO_IP, tcpcb::t_flags, tcpcb::t_keepcnt, tcpcb::t_keepidle, tcpcb::t_keepinit, tcpcb::t_keepintvl, tcpcb::t_logstate, tcpcb::t_maxseg, tcpcb::t_port, tcpcb::t_state, tcpcb::t_stats, tcpcb::t_tfo_client_cookie_len, tcpcb::t_tfo_cookie, tcpcb::t_tfo_pending, tcp6_use_min_mtu(), tcp_fastopen_alloc_counter(), tcp_fill_info(), tcp_log_dump_tp_bucket_logbufs(), tcp_log_dump_tp_logbuf(), tcp_log_get_id(), tcp_log_getlogbuf(), TCP_LOG_REASON_LEN, tcp_log_set_id(), tcp_log_state_change(), TCP_NODELAY, tcp_offload_ctloutput(), tcp_pcap_get_sock_max(), tcp_pcap_set_sock_max(), tcp_set_cc_mod(), tcp_timer_activate(), TCP_TUNNELING_PORT_MAX, TCP_TUNNELING_PORT_MIN, TCPS_CLOSED, TCPS_CLOSING, TCPS_FIN_WAIT_2, TCPS_HAVEESTABLISHED, TCPS_LISTEN, TCPS_SYN_RECEIVED, TCPS_SYN_SENT, TF_FASTOPEN, TF_LRD, TF_NODELAY, TF_NOOPT, TF_NOPUSH, TF_TOE, TP_KEEPCNT, TP_KEEPIDLE, TP_KEEPINIT, TP_KEEPINTVL, TP_MAXIDLE, TT_2MSL, TT_KEEP, V_tcp_fastopen_client_enable, V_tcp_fastopen_server_enable, V_tcp_minmss, and V_tcp_udp_tunneling_port.
Referenced by bbr_get_sockopt(), bbr_set_sockopt(), rack_get_sockopt(), and rack_set_sockopt().
|
static |
Definition at line 2761 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, inpcb::inp_socket, INP_WLOCK_ASSERT, IS_FASTOPEN, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_state, tcp_close(), tcp_drop(), tcp_usrclosed(), TCPS_ESTABLISHED, and TCPS_LISTEN.
Referenced by tcp_usr_close(), and tcp_usr_disconnect().
|
static |
Definition at line 1651 of file tcp_usrreq.c.
References INP_WLOCK_ASSERT, tcpcb::rcv_nxt, tcpcb::rcv_scale, tcpcb::rcv_wnd, tcpcb::snd_cwnd, tcpcb::snd_nxt, tcpcb::snd_scale, tcpcb::snd_ssthresh, tcpcb::snd_wnd, tcpcb::t_flags, tcpcb::t_flags2, tcpcb::t_inpcb, tcpcb::t_maxseg, tcpcb::t_rcvoopack, tcpcb::t_rcvtime, tcpcb::t_rttvar, tcpcb::t_rxtcur, tcpcb::t_sndrexmitpack, tcpcb::t_sndzerowin, tcpcb::t_srtt, tcpcb::t_state, tcp_offload_tcp_info(), TCP_RTT_SHIFT, TCP_RTTVAR_SHIFT, TF2_ACE_PERMIT, TF2_ECN_PERMIT, TF_RCVD_SCALE, TF_RCVD_TSTMP, TF_REQ_SCALE, TF_REQ_TSTMP, TF_SACK_PERMIT, and TF_TOE.
Referenced by tcp_default_ctloutput().
|
static |
Definition at line 1409 of file tcp_usrreq.c.
References tcpcb::t_fb, and tcp_function_block::tfb_pru_options.
Referenced by tcp_usr_rcvoob(), and tcp_usr_send().
|
static |
Definition at line 2007 of file tcp_usrreq.c.
References cc_algo::cb_init, CC_ALGO, cc_attach(), cc_algo::cc_data_sz, cc_detach(), cc_list, CC_LIST_RLOCK, CC_LIST_RUNLOCK, CC_MODULE_BEING_REMOVED, cc_refer(), cc_release(), tcpcb::ccv, cc_var::ccvc, cc_algo::flags, INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, cc_algo::name, tcpcb::t_state, cc_var::ccv_container::tcp, and TCPS_HAVEESTABLISHED.
Referenced by tcp_default_ctloutput().
|
static |
Definition at line 1328 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, inpcb::inp_socket, INP_SOCKREF, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, tcp_drop(), TCP_PROBE2, TCPDEBUG0, TCPDEBUG1, and TCPDEBUG2.
|
static |
Definition at line 164 of file tcp_usrreq.c.
References inpcb::in6p_hops, IN6P_IPV6_V6ONLY, in_pcballoc(), in_pcbdetach(), in_pcbfree(), inpcb::inp_flags, INP_IPV4, INP_IPV6, INP_IPV6PROTO, inpcb::inp_vflag, INP_WUNLOCK, sotoinpcb, tcpcb::t_state, tcp_newtcpcb(), TCP_PROBE2, TCPDEBUG0, TCPDEBUG1, TCPDEBUG2, TCPS_CLOSED, TCPSTATES_INC, V_tcbinfo, V_tcp_recvspace, and V_tcp_sendspace.
|
static |
Definition at line 1371 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, inpcb::inp_socket, INP_SOCKREF, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, tcp_disconnect(), TCP_PROBE2, TCPDEBUG0, TCPDEBUG1, and TCPDEBUG2.
|
static |
Definition at line 220 of file tcp_usrreq.c.
References in_pcbdetach(), in_pcbfree(), INP_DROPPED, inpcb::inp_flags, inpcb::inp_socket, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, tcpcb::t_state, tcp_discardcb(), and TCPS_SYN_SENT.
|
static |
Definition at line 756 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, tcp_disconnect(), TCP_PROBE2, TCPDEBUG0, TCPDEBUG1, and TCPDEBUG2.
|
static |
Definition at line 926 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, IS_FASTOPEN, sotoinpcb, tcpcb::t_flags, tcpcb::t_state, tcp_offload_rcvd(), TCP_PROBE2, TCPDEBUG0, TCPDEBUG1, TCPDEBUG2, TCPS_SYN_RECEIVED, and TF_TOE.
|
static |
Definition at line 1430 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, tcpcb::t_iobc, tcpcb::t_oobflags, TCP_PROBE2, tcp_pru_options_support(), TCPDEBUG0, TCPDEBUG1, TCPDEBUG2, TCPOOB_HADDATA, and TCPOOB_HAVEDATA.
|
static |
Definition at line 1294 of file tcp_usrreq.c.
References count, INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, and sotoinpcb.
|
static |
Definition at line 976 of file tcp_usrreq.c.
References IN6P_IPV6_V6ONLY, INADDR_BROADCAST, in_conninfo::inc_flags, INC_ISIPV6, INP_DROPPED, inpcb::inp_flags, inpcb::inp_inc, INP_IPV4, INP_IPV6, INP_IPV6PROTO, inpcb::inp_socket, INP_TIMEWAIT, inpcb::inp_vflag, INP_WLOCK, INP_WUNLOCK, intotcpcb, IS_FASTOPEN, prison_remote_ip4(), in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_len, tcpcb::snd_una, tcpcb::snd_up, tcpcb::snd_wnd, sotoinpcb, tcpcb::t_fbyte_in, tcpcb::t_fbyte_out, tcpcb::t_flags, tcpcb::t_flags2, tcpcb::t_state, tcp_fastopen_connect(), TCP_LOG_EVENT, TCP_LOG_USERSEND, tcp_mss(), TCP_PROBE2, tcp_pru_options_support(), tcp_usrclosed(), TCPDEBUG0, TCPDEBUG1, TCPDEBUG2, TCPS_CLOSED, TCPS_HAVEESTABLISHED, TCPS_LISTEN, TCPS_SYN_SENT, TF2_FBYTES_COMPLETE, TF_FORCEDATA, and TF_MORETOCOME.
|
static |
Definition at line 892 of file tcp_usrreq.c.
References INP_DROPPED, inpcb::inp_flags, INP_TIMEWAIT, INP_WLOCK, INP_WUNLOCK, intotcpcb, sotoinpcb, TCP_PROBE2, tcp_usrclosed(), TCPDEBUG0, TCPDEBUG1, and TCPDEBUG2.
|
static |
Definition at line 2803 of file tcp_usrreq.c.
References inpcb::inp_socket, INP_WLOCK_ASSERT, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_state, tcp_close(), tcp_fast_finwait2_recycle, tcp_finwait2_timeout, tcp_offload_listen_stop(), tcp_state_change(), tcp_timer_activate(), TCPS_CLOSE_WAIT, TCPS_CLOSED, TCPS_ESTABLISHED, TCPS_FIN_WAIT_1, TCPS_FIN_WAIT_2, TCPS_LAST_ACK, TCPS_LISTEN, TCPS_SYN_RECEIVED, TCPS_SYN_SENT, TF_NEEDFIN, TP_MAXIDLE, and TT_2MSL.
Referenced by tcp_disconnect(), tcp_usr_send(), and tcp_usr_shutdown().
|
pure virtual |
|
extern |
Definition at line 105 of file cc_newreno.c.
Referenced by newreno_ctl_output().