FreeBSD kernel IPv4 code
udp_var.h File Reference
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <sys/counter.h>
#include <netinet/in_pcb.h>
Include dependency graph for udp_var.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  udpiphdr
 
struct  udpcb
 
struct  udpstat
 

Macros

#define ui_x1   ui_i.ih_x1
 
#define ui_v   ui_i.ih_x1[0]
 
#define ui_pr   ui_i.ih_pr
 
#define ui_len   ui_i.ih_len
 
#define ui_src   ui_i.ih_src
 
#define ui_dst   ui_i.ih_dst
 
#define ui_sport   ui_u.uh_sport
 
#define ui_dport   ui_u.uh_dport
 
#define ui_ulen   ui_u.uh_ulen
 
#define ui_sum   ui_u.uh_sum
 
#define intoudpcb(ip)   ((struct udpcb *)(ip)->inp_ppcb)
 
#define sotoudpcb(so)   (intoudpcb(sotoinpcb(so)))
 
#define UF_ESPINUDP_NON_IKE   0x00000001 /* w/ non-IKE marker .. */
 
#define UF_ESPINUDP   0x00000002 /* w/ non-ESP marker. */
 
#define UDPSTAT_ADD(name, val)    VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val))
 
#define UDPSTAT_INC(name)   UDPSTAT_ADD(name, 1)
 
#define KMOD_UDPSTAT_INC(name)    kmod_udpstat_inc(offsetof(struct udpstat, name) / sizeof(uint64_t))
 
#define UDPCTL_CHECKSUM   1 /* checksum UDP packets */
 
#define UDPCTL_STATS   2 /* statistics (read-only) */
 
#define UDPCTL_MAXDGRAM   3 /* max datagram size */
 
#define UDPCTL_RECVSPACE   4 /* default receive buffer space */
 
#define UDPCTL_PCBLIST   5 /* list of PCBs for UDP sockets */
 
#define V_udbinfo   VNET(udbinfo)
 
#define V_ulitecbinfo   VNET(ulitecbinfo)
 
#define V_udp_cksum   VNET(udp_cksum)
 
#define V_udp_blackhole   VNET(udp_blackhole)
 
#define V_udp_blackhole_local   VNET(udp_blackhole_local)
 
#define V_udp_log_in_vain   VNET(udp_log_in_vain)
 
#define V_zero_checksum_port   VNET(zero_checksum_port)
 

Typedefs

typedef void(* udp_tun_func_t) (struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *)
 
typedef void(* udp_tun_icmp_t) (int, struct sockaddr *, void *, void *)
 

Functions

 VNET_PCPUSTAT_DECLARE (struct udpstat, udpstat)
 
void kmod_udpstat_inc (int statnum)
 
 SYSCTL_DECL (_net_inet_udp)
 
 VNET_DECLARE (struct inpcbinfo, udbinfo)
 
 VNET_DECLARE (struct inpcbinfo, ulitecbinfo)
 
 VNET_DECLARE (int, udp_cksum)
 
 VNET_DECLARE (int, udp_blackhole)
 
 VNET_DECLARE (bool, udp_blackhole_local)
 
 VNET_DECLARE (int, udp_log_in_vain)
 
 VNET_DECLARE (int, zero_checksum_port)
 
static __inline struct inpcbinfoudp_get_inpcbinfo (int protocol)
 
int udp_newudpcb (struct inpcb *)
 
void udp_discardcb (struct udpcb *)
 
void udp_ctlinput (int, struct sockaddr *, void *)
 
void udplite_ctlinput (int, struct sockaddr *, void *)
 
int udp_ctloutput (struct socket *, struct sockopt *)
 
int udp_input (struct mbuf **, int *, int)
 
void udplite_input (struct mbuf *, int)
 
struct inpcbudp_notify (struct inpcb *inp, int errno)
 
int udp_shutdown (struct socket *so)
 
int udp_set_kernel_tunneling (struct socket *so, udp_tun_func_t f, udp_tun_icmp_t i, void *ctx)
 

Variables

struct pr_usrreqs udp_usrreqs
 
u_long udp_sendspace
 
u_long udp_recvspace
 

Macro Definition Documentation

◆ intoudpcb

#define intoudpcb (   ip)    ((struct udpcb *)(ip)->inp_ppcb)

Definition at line 79 of file udp_var.h.

◆ KMOD_UDPSTAT_INC

#define KMOD_UDPSTAT_INC (   name)     kmod_udpstat_inc(offsetof(struct udpstat, name) / sizeof(uint64_t))

Definition at line 124 of file udp_var.h.

◆ sotoudpcb

#define sotoudpcb (   so)    (intoudpcb(sotoinpcb(so)))

Definition at line 80 of file udp_var.h.

◆ UDPCTL_CHECKSUM

#define UDPCTL_CHECKSUM   1 /* checksum UDP packets */

Definition at line 131 of file udp_var.h.

◆ UDPCTL_MAXDGRAM

#define UDPCTL_MAXDGRAM   3 /* max datagram size */

Definition at line 133 of file udp_var.h.

◆ UDPCTL_PCBLIST

#define UDPCTL_PCBLIST   5 /* list of PCBs for UDP sockets */

Definition at line 135 of file udp_var.h.

◆ UDPCTL_RECVSPACE

#define UDPCTL_RECVSPACE   4 /* default receive buffer space */

Definition at line 134 of file udp_var.h.

◆ UDPCTL_STATS

#define UDPCTL_STATS   2 /* statistics (read-only) */

Definition at line 132 of file udp_var.h.

◆ UDPSTAT_ADD

#define UDPSTAT_ADD (   name,
  val 
)     VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val))

Definition at line 116 of file udp_var.h.

◆ UDPSTAT_INC

#define UDPSTAT_INC (   name)    UDPSTAT_ADD(name, 1)

Definition at line 118 of file udp_var.h.

◆ UF_ESPINUDP

#define UF_ESPINUDP   0x00000002 /* w/ non-ESP marker. */

Definition at line 86 of file udp_var.h.

◆ UF_ESPINUDP_NON_IKE

#define UF_ESPINUDP_NON_IKE   0x00000001 /* w/ non-IKE marker .. */

Definition at line 83 of file udp_var.h.

◆ ui_dport

#define ui_dport   ui_u.uh_dport

Definition at line 56 of file udp_var.h.

◆ ui_dst

#define ui_dst   ui_i.ih_dst

Definition at line 54 of file udp_var.h.

◆ ui_len

#define ui_len   ui_i.ih_len

Definition at line 52 of file udp_var.h.

◆ ui_pr

#define ui_pr   ui_i.ih_pr

Definition at line 51 of file udp_var.h.

◆ ui_sport

#define ui_sport   ui_u.uh_sport

Definition at line 55 of file udp_var.h.

◆ ui_src

#define ui_src   ui_i.ih_src

Definition at line 53 of file udp_var.h.

◆ ui_sum

#define ui_sum   ui_u.uh_sum

Definition at line 58 of file udp_var.h.

◆ ui_ulen

#define ui_ulen   ui_u.uh_ulen

Definition at line 57 of file udp_var.h.

◆ ui_v

#define ui_v   ui_i.ih_x1[0]

Definition at line 50 of file udp_var.h.

◆ ui_x1

#define ui_x1   ui_i.ih_x1

Definition at line 49 of file udp_var.h.

◆ V_udbinfo

#define V_udbinfo   VNET(udbinfo)

Definition at line 144 of file udp_var.h.

◆ V_udp_blackhole

#define V_udp_blackhole   VNET(udp_blackhole)

Definition at line 154 of file udp_var.h.

◆ V_udp_blackhole_local

#define V_udp_blackhole_local   VNET(udp_blackhole_local)

Definition at line 155 of file udp_var.h.

◆ V_udp_cksum

#define V_udp_cksum   VNET(udp_cksum)

Definition at line 153 of file udp_var.h.

◆ V_udp_log_in_vain

#define V_udp_log_in_vain   VNET(udp_log_in_vain)

Definition at line 156 of file udp_var.h.

◆ V_ulitecbinfo

#define V_ulitecbinfo   VNET(ulitecbinfo)

Definition at line 145 of file udp_var.h.

◆ V_zero_checksum_port

#define V_zero_checksum_port   VNET(zero_checksum_port)

Definition at line 159 of file udp_var.h.

Typedef Documentation

◆ udp_tun_func_t

typedef void(* udp_tun_func_t) (struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *)

Definition at line 63 of file udp_var.h.

◆ udp_tun_icmp_t

typedef void(* udp_tun_icmp_t) (int, struct sockaddr *, void *, void *)

Definition at line 65 of file udp_var.h.

Function Documentation

◆ kmod_udpstat_inc()

void kmod_udpstat_inc ( int  statnum)

Definition at line 208 of file udp_usrreq.c.

◆ SYSCTL_DECL()

SYSCTL_DECL ( _net_inet_udp  )

◆ udp_ctlinput()

void udp_ctlinput ( int  ,
struct sockaddr *  ,
void *   
)

◆ udp_ctloutput()

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.

Here is the call graph for this function:

◆ udp_discardcb()

void udp_discardcb ( struct udpcb up)

Definition at line 227 of file udp_usrreq.c.

References V_udpcb_zone.

◆ udp_get_inpcbinfo()

static __inline struct inpcbinfo * udp_get_inpcbinfo ( int  protocol)
static

Definition at line 162 of file udp_var.h.

References IPPROTO_UDP, V_udbinfo, and V_ulitecbinfo.

◆ udp_input()

int udp_input ( struct mbuf **  ,
int *  ,
int   
)

◆ udp_newudpcb()

int udp_newudpcb ( struct inpcb inp)

Definition at line 215 of file udp_usrreq.c.

References inpcb::inp_ppcb, and V_udpcb_zone.

◆ udp_notify()

struct inpcb * udp_notify ( struct inpcb inp,
int  errno 
)

Definition at line 721 of file udp_usrreq.c.

References inpcb::inp_route, inpcb::inp_socket, and INP_WLOCK_ASSERT.

◆ udp_set_kernel_tunneling()

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().

Here is the caller graph for this function:

◆ udp_shutdown()

int udp_shutdown ( struct socket *  so)

Definition at line 1736 of file udp_usrreq.c.

References INP_WLOCK, INP_WUNLOCK, and sotoinpcb.

◆ udplite_ctlinput()

void udplite_ctlinput ( int  ,
struct sockaddr *  ,
void *   
)

◆ udplite_input()

void udplite_input ( struct mbuf *  ,
int   
)

◆ VNET_DECLARE() [1/7]

VNET_DECLARE ( bool  ,
udp_blackhole_local   
)

◆ VNET_DECLARE() [2/7]

VNET_DECLARE ( int  ,
udp_blackhole   
)

◆ VNET_DECLARE() [3/7]

VNET_DECLARE ( int  ,
udp_cksum   
)

◆ VNET_DECLARE() [4/7]

VNET_DECLARE ( int  ,
udp_log_in_vain   
)

◆ VNET_DECLARE() [5/7]

VNET_DECLARE ( int  ,
zero_checksum_port   
)

◆ VNET_DECLARE() [6/7]

VNET_DECLARE ( struct inpcbinfo  ,
udbinfo   
)

◆ VNET_DECLARE() [7/7]

VNET_DECLARE ( struct inpcbinfo  ,
ulitecbinfo   
)

◆ VNET_PCPUSTAT_DECLARE()

VNET_PCPUSTAT_DECLARE ( struct udpstat  ,
udpstat   
)

Variable Documentation

◆ udp_recvspace

u_long udp_recvspace
extern

Definition at line 139 of file udp_usrreq.c.

◆ udp_sendspace

u_long udp_sendspace
extern

Definition at line 135 of file udp_usrreq.c.

◆ udp_usrreqs

struct pr_usrreqs udp_usrreqs
extern