FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_route.h"
#include "opt_rss.h"
#include <sys/param.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/sdt.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/route/nhop.h>
#include <net/rss_config.h>
#include <netinet/in.h>
#include <netinet/in_kdtrace.h>
#include <netinet/in_fib.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/icmp_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <netinet/udplite.h>
#include <netinet/in_rss.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_udpcb_zone VNET(udpcb_zone) |
#define | UDBHASHSIZE 128 |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE (int, udp_cksum) | |
SYSCTL_INT (_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(udp_cksum), 0, "compute udp checksum") | |
VNET_DEFINE (int, udp_log_in_vain)=0 | |
SYSCTL_INT (_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(udp_log_in_vain), 0, "Log all incoming UDP packets") | |
VNET_DEFINE (int, udp_blackhole)=0 | |
SYSCTL_INT (_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(udp_blackhole), 0, "Do not send port unreachables for refused connects") | |
VNET_DEFINE (bool, udp_blackhole_local) | |
SYSCTL_BOOL (_net_inet_udp, OID_AUTO, blackhole_local, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(udp_blackhole_local), false, "Enforce net.inet.udp.blackhole for locally originated packets") | |
SYSCTL_ULONG (_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW, &udp_sendspace, 0, "Maximum outgoing UDP datagram size") | |
SYSCTL_ULONG (_net_inet_udp, UDPCTL_RECVSPACE, recvspace, CTLFLAG_RW, &udp_recvspace, 0, "Maximum space for incoming UDP datagrams") | |
VNET_DEFINE (struct inpcbinfo, udbinfo) | |
VNET_DEFINE (struct inpcbinfo, ulitecbinfo) | |
VNET_DEFINE_STATIC (uma_zone_t, udpcb_zone) | |
VNET_PCPUSTAT_DEFINE (struct udpstat, udpstat) | |
VNET_PCPUSTAT_SYSINIT (udpstat) | |
SYSCTL_VNET_PCPUSTAT (_net_inet_udp, UDPCTL_STATS, stats, struct udpstat, udpstat, "UDP statistics (struct udpstat, netinet/udp_var.h)") | |
INPCBSTORAGE_DEFINE (udpcbstor, "udpinp", "udp_inpcb", "udp", "udphash") | |
INPCBSTORAGE_DEFINE (udplitecbstor, "udpliteinp", "udplite_inpcb", "udplite", "udplitehash") | |
static void | udp_init (void *arg __unused) |
VNET_SYSINIT (udp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, udp_init, NULL) | |
void | kmod_udpstat_inc (int statnum) |
int | udp_newudpcb (struct inpcb *inp) |
void | udp_discardcb (struct udpcb *up) |
struct inpcb * | udp_notify (struct inpcb *inp, int errno) |
static int | udp_pcblist (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_net_inet_udp, UDPCTL_PCBLIST, pcblist, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, udp_pcblist, "S,xinpcb", "List of active UDP sockets") | |
int | udp_ctloutput (struct socket *so, struct sockopt *sopt) |
int | udp_set_kernel_tunneling (struct socket *so, udp_tun_func_t f, udp_tun_icmp_t i, void *ctx) |
int | udp_shutdown (struct socket *so) |
Variables | |
u_long | udp_sendspace = 9216 |
u_long | udp_recvspace |
#define UDBHASHSIZE 128 |
Definition at line 156 of file udp_usrreq.c.
#define V_udpcb_zone VNET(udpcb_zone) |
Definition at line 153 of file udp_usrreq.c.
__FBSDID | ( | "$FreeBSD$" | ) |
INPCBSTORAGE_DEFINE | ( | udpcbstor | , |
"udpinp" | , | ||
"udp_inpcb" | , | ||
"udp" | , | ||
"udphash" | |||
) |
INPCBSTORAGE_DEFINE | ( | udplitecbstor | , |
"udpliteinp" | , | ||
"udplite_inpcb" | , | ||
"udplite" | , | ||
"udplitehash" | |||
) |
void kmod_udpstat_inc | ( | int | statnum | ) |
Definition at line 208 of file udp_usrreq.c.
SYSCTL_BOOL | ( | _net_inet_udp | , |
OID_AUTO | , | ||
blackhole_local | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEudp_blackhole_local, | ||
false | , | ||
"Enforce net.inet.udp.blackhole for locally originated packets" | |||
) |
SYSCTL_INT | ( | _net_inet_udp | , |
OID_AUTO | , | ||
blackhole | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEudp_blackhole, | ||
0 | , | ||
"Do not send port unreachables for refused connects" | |||
) |
SYSCTL_INT | ( | _net_inet_udp | , |
OID_AUTO | , | ||
log_in_vain | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEudp_log_in_vain, | ||
0 | , | ||
"Log all incoming UDP packets" | |||
) |
SYSCTL_INT | ( | _net_inet_udp | , |
UDPCTL_CHECKSUM | , | ||
checksum | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEudp_cksum, | ||
0 | , | ||
"compute udp checksum" | |||
) |
SYSCTL_PROC | ( | _net_inet_udp | , |
UDPCTL_PCBLIST | , | ||
pcblist | , | ||
CTLTYPE_OPAQUE|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
udp_pcblist | , | ||
" | S, | ||
xinpcb" | , | ||
"List of active UDP sockets" | |||
) |
SYSCTL_ULONG | ( | _net_inet_udp | , |
UDPCTL_MAXDGRAM | , | ||
maxdgram | , | ||
CTLFLAG_RW | , | ||
& | udp_sendspace, | ||
0 | , | ||
"Maximum outgoing UDP datagram size" | |||
) |
SYSCTL_ULONG | ( | _net_inet_udp | , |
UDPCTL_RECVSPACE | , | ||
recvspace | , | ||
CTLFLAG_RW | , | ||
& | udp_recvspace, | ||
0 | , | ||
"Maximum space for incoming UDP datagrams" | |||
) |
SYSCTL_VNET_PCPUSTAT | ( | _net_inet_udp | , |
UDPCTL_STATS | , | ||
stats | , | ||
struct udpstat | , | ||
udpstat | , | ||
"UDP statistics (struct udpstat, netinet/udp_var.h)" | |||
) |
int udp_ctloutput | ( | struct socket * | so, |
struct sockopt * | sopt | ||
) |
Definition at line 925 of file udp_usrreq.c.
References INP_CHECK_SOCKAF, INP_WLOCK, INP_WUNLOCK, intoudpcb, ip_ctloutput(), sotoinpcb, udpcb::u_rxcslen, udpcb::u_txcslen, UDP_ENCAP, UDPLITE_RECV_CSCOV, and UDPLITE_SEND_CSCOV.
void udp_discardcb | ( | struct udpcb * | up | ) |
Definition at line 227 of file udp_usrreq.c.
References V_udpcb_zone.
|
static |
Definition at line 178 of file udp_usrreq.c.
References in_pcbinfo_init(), UDBHASHSIZE, V_udbinfo, V_udpcb_zone, and V_ulitecbinfo.
int udp_newudpcb | ( | struct inpcb * | inp | ) |
Definition at line 215 of file udp_usrreq.c.
References inpcb::inp_ppcb, and V_udpcb_zone.
Definition at line 721 of file udp_usrreq.c.
References inpcb::inp_route, inpcb::inp_socket, and INP_WLOCK_ASSERT.
|
static |
Definition at line 814 of file udp_usrreq.c.
References cr_canseeinpcb(), in_pcbtoxinpcb(), INP_ALL_ITERATOR, inpcb::inp_gencnt, inp_next(), INP_RUNLOCK, INPLOOKUP_RLOCKPCB, and V_udbinfo.
int udp_set_kernel_tunneling | ( | struct socket * | so, |
udp_tun_func_t | f, | ||
udp_tun_icmp_t | i, | ||
void * | ctx | ||
) |
Definition at line 1547 of file udp_usrreq.c.
References INP_WLOCK, INP_WUNLOCK, intoudpcb, sotoinpcb, udpcb::u_icmp_func, udpcb::u_tun_ctx, and udpcb::u_tun_func.
Referenced by in_gre_setup_socket(), sctp_over_udp_start(), and tcp_over_udp_start().
int udp_shutdown | ( | struct socket * | so | ) |
Definition at line 1736 of file udp_usrreq.c.
References INP_WLOCK, INP_WUNLOCK, and sotoinpcb.
VNET_DEFINE | ( | bool | , |
udp_blackhole_local | |||
) |
|
pure virtual |
VNET_DEFINE | ( | int | , |
udp_cksum | |||
) |
|
pure virtual |
VNET_DEFINE | ( | struct inpcbinfo | , |
udbinfo | |||
) |
VNET_DEFINE | ( | struct inpcbinfo | , |
ulitecbinfo | |||
) |
VNET_DEFINE_STATIC | ( | uma_zone_t | , |
udpcb_zone | |||
) |
VNET_PCPUSTAT_SYSINIT | ( | udpstat | ) |
u_long udp_recvspace |
Definition at line 139 of file udp_usrreq.c.
u_long udp_sendspace = 9216 |
Definition at line 135 of file udp_usrreq.c.