FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_sctp.h"
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <net/vnet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/netisr.h>
#include <netinet/in.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 <security/mac/mac_framework.h>
Go to the source code of this file.
Macros | |
#define | DIVSNDQ (65536 + 100) |
#define | DIVRCVQ (65536 + 100) |
#define | V_divcbinfo VNET(divcbinfo) |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE_STATIC (struct inpcbinfo, divcbinfo) | |
static int | div_output_inbound (int fmaily, struct socket *so, struct mbuf *m, struct sockaddr_in *sin) |
static int | div_output_outbound (int family, struct socket *so, struct mbuf *m) |
INPCBSTORAGE_DEFINE (divcbstor, "divinp", "divcb", "div", "divhash") | |
static void | div_init (void *arg __unused) |
VNET_SYSINIT (div_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, div_init, NULL) | |
static void | div_destroy (void *unused __unused) |
VNET_SYSUNINIT (divert, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, div_destroy, NULL) | |
static int | div_input (struct mbuf **mp, int *offp, int proto) |
static bool | div_port_match (const struct inpcb *inp, void *v) |
static void | divert_packet (struct mbuf *m, bool incoming) |
static int | div_output (struct socket *so, struct mbuf *m, struct sockaddr_in *sin, struct mbuf *control) |
static int | div_attach (struct socket *so, int proto, struct thread *td) |
static void | div_detach (struct socket *so) |
static int | div_bind (struct socket *so, struct sockaddr *nam, struct thread *td) |
static int | div_shutdown (struct socket *so) |
static int | div_send (struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td) |
static int | div_pcblist (SYSCTL_HANDLER_ARGS) |
static int | div_modevent (module_t mod, int type, void *unused) |
DECLARE_MODULE (ipdivert, ipdivertmod, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY) | |
MODULE_DEPEND (ipdivert, ipfw, 3, 3, 3) | |
MODULE_VERSION (ipdivert, 1) | |
Variables | |
static u_long | div_sendspace = DIVSNDQ |
static u_long | div_recvspace = DIVRCVQ |
struct pr_usrreqs | div_usrreqs |
struct protosw | div_protosw |
static moduledata_t | ipdivertmod |
#define DIVRCVQ (65536 + 100) |
Definition at line 85 of file ip_divert.c.
#define DIVSNDQ (65536 + 100) |
Definition at line 84 of file ip_divert.c.
#define V_divcbinfo VNET(divcbinfo) |
Definition at line 115 of file ip_divert.c.
__FBSDID | ( | "$FreeBSD$" | ) |
DECLARE_MODULE | ( | ipdivert | , |
ipdivertmod | , | ||
SI_SUB_PROTO_FIREWALL | , | ||
SI_ORDER_ANY | |||
) |
|
static |
Definition at line 574 of file ip_divert.c.
References div_recvspace, div_sendspace, in_pcballoc(), inpcb::inp_flags, INP_HDRINCL, inpcb::inp_ip_p, INP_IPV4, inpcb::inp_vflag, INP_WUNLOCK, sotoinpcb, and V_divcbinfo.
|
static |
Definition at line 613 of file ip_divert.c.
References in_pcbbind(), INADDR_ANY, INP_HASH_WLOCK, INP_HASH_WUNLOCK, INP_WLOCK, INP_WUNLOCK, sotoinpcb, and V_divcbinfo.
|
static |
Definition at line 143 of file ip_divert.c.
References in_pcbinfo_destroy(), and V_divcbinfo.
Referenced by div_modevent().
|
static |
Definition at line 601 of file ip_divert.c.
References in_pcbdetach(), in_pcbfree(), INP_WLOCK, and sotoinpcb.
|
static |
Definition at line 130 of file ip_divert.c.
References in_pcbinfo_init(), and V_divcbinfo.
|
static |
Definition at line 155 of file ip_divert.c.
References KMOD_IPSTAT_INC.
|
static |
Definition at line 766 of file ip_divert.c.
References div_destroy(), div_protosw, divert_packet(), INP_INFO_WLOCK, INP_INFO_WUNLOCK, ip_divert_ptr, and V_divcbinfo.
|
static |
Definition at line 311 of file ip_divert.c.
References ipfw_rule_ref::chain_id, div_output_inbound(), div_output_outbound(), ipfw_rule_ref::info, ip::ip_v, IPFW_INFO_IN, IPFW_INFO_OUT, IPFW_IS_DIVERT, IPV6_VERSION, IPVERSION, MTAG_IPFW_RULE, ipfw_rule_ref::rule_id, ipfw_rule_ref::rulenum, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_len, sockaddr_in::sin_port, sockaddr_in::sin_zero, and ipfw_rule_ref::slot.
Referenced by div_send().
|
static |
Definition at line 520 of file ip_divert.c.
References in_broadcast(), ip::ip_dst, in_addr::s_addr, sockaddr_in::sin_port, and sockaddr_in::sin_zero.
Referenced by div_output().
|
static |
Definition at line 417 of file ip_divert.c.
References inpcb::inp_moptions, inpcb::inp_options, INP_RLOCK, INP_RUNLOCK, IP_ALLOWBROADCAST, ip::ip_hl, ip::ip_len, ip_output(), IP_RAWOUTPUT, IP_ROUTETOIF, KMOD_IPSTAT_INC, and sotoinpcb.
Referenced by div_output().
|
static |
Definition at line 673 of file ip_divert.c.
References in_pcbtoxinpcb(), INP_ALL_ITERATOR, inpcb::inp_gencnt, inp_next(), INP_RUNLOCK, INPLOOKUP_RLOCKPCB, and V_divcbinfo.
|
static |
Definition at line 165 of file ip_divert.c.
Referenced by divert_packet().
|
static |
Definition at line 654 of file ip_divert.c.
References div_output(), and KMOD_IPSTAT_INC.
|
static |
Definition at line 641 of file ip_divert.c.
References INP_WLOCK, INP_WUNLOCK, and sotoinpcb.
|
static |
Definition at line 179 of file ip_divert.c.
References div_port_match(), in_delayed_cksum(), INP_ITERATOR, inp_next(), INP_RUNLOCK, inpcb::inp_socket, INPLOOKUP_RLOCKPCB, ip::ip_hl, KMOD_IPSTAT_DEC, KMOD_IPSTAT_INC, MTAG_IPFW_RULE, ipfw_rule_ref::rulenum, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_len, sockaddr_in::sin_port, sockaddr_in::sin_zero, and V_divcbinfo.
Referenced by div_modevent().
INPCBSTORAGE_DEFINE | ( | divcbstor | , |
"divinp" | , | ||
"divcb" | , | ||
"div" | , | ||
"divhash" | |||
) |
MODULE_DEPEND | ( | ipdivert | , |
ipfw | , | ||
3 | , | ||
3 | , | ||
3 | |||
) |
MODULE_VERSION | ( | ipdivert | , |
1 | |||
) |
VNET_DEFINE_STATIC | ( | struct inpcbinfo | , |
divcbinfo | |||
) |
VNET_SYSUNINIT | ( | divert | , |
SI_SUB_PROTO_DOMAIN | , | ||
SI_ORDER_THIRD | , | ||
div_destroy | , | ||
NULL | |||
) |
struct protosw div_protosw |
Definition at line 757 of file ip_divert.c.
Referenced by div_modevent().
|
static |
Definition at line 118 of file ip_divert.c.
Referenced by div_attach().
|
static |
Definition at line 117 of file ip_divert.c.
Referenced by div_attach().
struct pr_usrreqs div_usrreqs |
Definition at line 745 of file ip_divert.c.
|
static |
Definition at line 822 of file ip_divert.c.