FreeBSD kernel IPv4 code
raw_ip.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_route.h"
#include <sys/param.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/eventhandler.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/rwlock.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sx.h>
#include <sys/sysctl.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/route_ctl.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_fib.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_mroute.h>
#include <netinet/ip_icmp.h>
#include <netipsec/ipsec_support.h>
#include <machine/stdarg.h>
#include <security/mac/mac_framework.h>
Include dependency graph for raw_ip.c:

Go to the source code of this file.

Macros

#define V_ripcbinfo   VNET(ripcbinfo)
 
#define INP_PCBHASH_RAW_SIZE   256
 
#define INP_PCBHASH_RAW(proto, laddr, faddr, mask)    (((proto) + (laddr) + (faddr)) % (mask) + 1)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 VNET_DEFINE (int, ip_defttl)
 
 SYSCTL_INT (_net_inet_ip, IPCTL_DEFTTL, ttl, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ip_defttl), 0, "Maximum TTL on IP packets")
 
 VNET_DEFINE (struct inpcbinfo, ripcbinfo)
 
 VNET_DEFINE (ip_fw_chk_ptr_t, ip_fw_chk_ptr)
 
 VNET_DEFINE (ip_fw_ctl_ptr_t, ip_fw_ctl_ptr)
 
 SYSCTL_ULONG (_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, &rip_sendspace, 0, "Maximum outgoing raw IP datagram size")
 
 SYSCTL_ULONG (_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW, &rip_recvspace, 0, "Maximum space for incoming raw IP datagrams")
 
 INPCBSTORAGE_DEFINE (ripcbstor, "rawinp", "ripcb", "rip", "riphash")
 
static void rip_init (void *arg __unused)
 
 VNET_SYSINIT (rip_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rip_init, NULL)
 
static int rip_pcblist (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_inet_raw, OID_AUTO, pcblist, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, rip_pcblist, "S,xinpcb", "List of active raw IP sockets")
 

Variables

int(* ip_dn_ctl_ptr )(struct sockopt *)
 
int(* ip_dn_io_ptr )(struct mbuf **, struct ip_fw_args *)
 
void(* ip_divert_ptr )(struct mbuf *, bool)
 
int(* ng_ipfw_input_p )(struct mbuf **, struct ip_fw_args *, bool)
 
struct protosw inetsw []
 
u_long rip_sendspace = 9216
 
u_long rip_recvspace = 9216
 

Macro Definition Documentation

◆ INP_PCBHASH_RAW

#define INP_PCBHASH_RAW (   proto,
  laddr,
  faddr,
  mask 
)     (((proto) + (laddr) + (faddr)) % (mask) + 1)

Definition at line 149 of file raw_ip.c.

◆ INP_PCBHASH_RAW_SIZE

#define INP_PCBHASH_RAW_SIZE   256

Definition at line 148 of file raw_ip.c.

◆ V_ripcbinfo

#define V_ripcbinfo   VNET(ripcbinfo)

Definition at line 91 of file raw_ip.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ INPCBSTORAGE_DEFINE()

INPCBSTORAGE_DEFINE ( ripcbstor  ,
"rawinp"  ,
"ripcb"  ,
"rip"  ,
"riphash"   
)

◆ rip_init()

static void rip_init ( void *arg  __unused)
static

Definition at line 188 of file raw_ip.c.

References in_pcbinfo_init(), INP_PCBHASH_RAW_SIZE, and V_ripcbinfo.

Here is the call graph for this function:

◆ rip_pcblist()

static int rip_pcblist ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1075 of file raw_ip.c.

References cr_canseeinpcb(), in_pcbtoxinpcb(), INP_ALL_ITERATOR, inpcb::inp_gencnt, inp_next(), INP_RUNLOCK, INPLOOKUP_RLOCKPCB, and V_ripcbinfo.

Here is the call graph for this function:

◆ SYSCTL_INT()

SYSCTL_INT ( _net_inet_ip  ,
IPCTL_DEFTTL  ,
ttl  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEip_defttl,
,
"Maximum TTL on IP packets"   
)

◆ SYSCTL_PROC()

SYSCTL_PROC ( _net_inet_raw  ,
OID_AUTO  ,
pcblist  ,
CTLTYPE_OPAQUE|CTLFLAG_RD|  CTLFLAG_MPSAFE,
NULL  ,
,
rip_pcblist  ,
S,
xinpcb"  ,
"List of active raw IP sockets"   
)

◆ SYSCTL_ULONG() [1/2]

SYSCTL_ULONG ( _net_inet_raw  ,
OID_AUTO  ,
maxdgram  ,
CTLFLAG_RW  ,
rip_sendspace,
,
"Maximum outgoing raw IP datagram size"   
)

◆ SYSCTL_ULONG() [2/2]

SYSCTL_ULONG ( _net_inet_raw  ,
OID_AUTO  ,
recvspace  ,
CTLFLAG_RW  ,
rip_recvspace,
,
"Maximum space for incoming raw IP datagrams"   
)

◆ VNET_DEFINE() [1/4]

VNET_DEFINE ( int  ,
ip_defttl   
)

◆ VNET_DEFINE() [2/4]

VNET_DEFINE ( ip_fw_chk_ptr_t  ,
ip_fw_chk_ptr   
)

◆ VNET_DEFINE() [3/4]

VNET_DEFINE ( ip_fw_ctl_ptr_t  ,
ip_fw_ctl_ptr   
)

◆ VNET_DEFINE() [4/4]

VNET_DEFINE ( struct inpcbinfo  ,
ripcbinfo   
)

◆ VNET_SYSINIT()

VNET_SYSINIT ( rip_init  ,
SI_SUB_PROTO_DOMAIN  ,
SI_ORDER_THIRD  ,
rip_init  ,
NULL   
)

Variable Documentation

◆ inetsw

struct protosw inetsw[]
extern

◆ ip_divert_ptr

void(* ip_divert_ptr) (struct mbuf *, bool) ( struct mbuf *  m,
bool  incoming 
)

Definition at line 103 of file raw_ip.c.

Referenced by div_modevent().

◆ ip_dn_ctl_ptr

int(* ip_dn_ctl_ptr) (struct sockopt *) ( struct sockopt *  )

Definition at line 101 of file raw_ip.c.

◆ ip_dn_io_ptr

int(* ip_dn_io_ptr) (struct mbuf **, struct ip_fw_args *) ( struct mbuf **  ,
struct ip_fw_args *   
)

Definition at line 102 of file raw_ip.c.

◆ ng_ipfw_input_p

int(* ng_ipfw_input_p) (struct mbuf **, struct ip_fw_args *, bool) ( struct mbuf **  ,
struct ip_fw_args *  ,
bool   
)

Definition at line 104 of file raw_ip.c.

◆ rip_recvspace

u_long rip_recvspace = 9216

Definition at line 140 of file raw_ip.c.

◆ rip_sendspace

u_long rip_sendspace = 9216

Definition at line 136 of file raw_ip.c.