FreeBSD kernel netgraph code
|
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/random.h>
#include <sys/rmlock.h>
#include <sys/sockio.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/libkern.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/bpf.h>
#include <net/netisr.h>
#include <net/route.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_iface.h>
Go to the source code of this file.
Data Structures | |
struct | iffam |
struct | ng_iface_private |
Macros | |
#define | M_NETGRAPH_IFACE M_NETGRAPH |
#define | V_ng_iface_max_nest VNET(ng_iface_max_nest) |
#define | NUM_FAMILIES nitems(gFamilies) |
#define | PRIV_RLOCK(priv, t) rm_rlock(&priv->lock, t) |
#define | PRIV_RUNLOCK(priv, t) rm_runlock(&priv->lock, t) |
#define | PRIV_WLOCK(priv) rm_wlock(&priv->lock) |
#define | PRIV_WUNLOCK(priv) rm_wunlock(&priv->lock) |
#define | V_ng_iface_unit VNET(ng_iface_unit) |
Typedefs | |
typedef const struct iffam * | iffam_p |
typedef struct ng_iface_private * | priv_p |
Functions | |
static | SYSCTL_NODE (_net_graph, OID_AUTO, iface, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Point to point netgraph interface") |
VNET_DEFINE_STATIC (int, ng_iface_max_nest) | |
SYSCTL_INT (_net_graph_iface, OID_AUTO, max_nesting, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ng_iface_max_nest), 0, "Max nested tunnels") | |
static void | ng_iface_start (struct ifnet *ifp) |
static int | ng_iface_ioctl (struct ifnet *ifp, u_long cmd, caddr_t data) |
static int | ng_iface_output (struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, struct route *ro) |
static void | ng_iface_bpftap (struct ifnet *ifp, struct mbuf *m, sa_family_t family) |
static int | ng_iface_send (struct ifnet *ifp, struct mbuf *m, sa_family_t sa) |
static int | ng_iface_mod_event (module_t, int, void *) |
static iffam_p | get_iffam_from_af (sa_family_t family) |
static iffam_p | get_iffam_from_hook (priv_p priv, hook_p hook) |
static iffam_p | get_iffam_from_name (const char *name) |
static hook_p * | get_hook_from_iffam (priv_p priv, iffam_p iffam) |
NETGRAPH_INIT (iface, &typestruct) | |
VNET_DEFINE_STATIC (struct unrhdr *, ng_iface_unit) | |
static int | ng_iface_constructor (node_p node) |
static int | ng_iface_newhook (node_p node, hook_p hook, const char *name) |
static int | ng_iface_rcvmsg (node_p node, item_p item, hook_p lasthook) |
static int | ng_iface_rcvdata (hook_p hook, item_p item) |
static int | ng_iface_shutdown (node_p node) |
static int | ng_iface_disconnect (hook_p hook) |
static void | vnet_ng_iface_init (const void *unused) |
VNET_SYSINIT (vnet_ng_iface_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_ng_iface_init, NULL) | |
static void | vnet_ng_iface_uninit (const void *unused) |
VNET_SYSUNINIT (vnet_ng_iface_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_ng_iface_uninit, NULL) | |
Variables | |
static const struct iffam | gFamilies [] |
static ng_constructor_t | ng_iface_constructor |
static ng_rcvmsg_t | ng_iface_rcvmsg |
static ng_shutdown_t | ng_iface_shutdown |
static ng_newhook_t | ng_iface_newhook |
static ng_rcvdata_t | ng_iface_rcvdata |
static ng_disconnect_t | ng_iface_disconnect |
static const struct ng_cmdlist | ng_iface_cmds [] |
static struct ng_type | typestruct |
#define M_NETGRAPH_IFACE M_NETGRAPH |
Definition at line 93 of file ng_iface.c.
#define NUM_FAMILIES nitems(gFamilies) |
Definition at line 115 of file ng_iface.c.
Definition at line 127 of file ng_iface.c.
Definition at line 128 of file ng_iface.c.
Definition at line 129 of file ng_iface.c.
Definition at line 130 of file ng_iface.c.
#define V_ng_iface_max_nest VNET(ng_iface_max_nest) |
Definition at line 99 of file ng_iface.c.
#define V_ng_iface_unit VNET(ng_iface_unit) |
Definition at line 209 of file ng_iface.c.
Definition at line 108 of file ng_iface.c.
typedef struct ng_iface_private* priv_p |
Definition at line 125 of file ng_iface.c.
Definition at line 251 of file ng_iface.c.
References gFamilies.
Referenced by ng_iface_disconnect(), ng_iface_newhook(), and ng_iface_send().
|
static |
Definition at line 219 of file ng_iface.c.
References iffam::family, gFamilies, and NUM_FAMILIES.
Referenced by ng_iface_send().
Definition at line 236 of file ng_iface.c.
References gFamilies, and NUM_FAMILIES.
Referenced by ng_iface_disconnect(), and ng_iface_rcvdata().
|
static |
Definition at line 260 of file ng_iface.c.
References gFamilies, iffam::hookname, name, and NUM_FAMILIES.
Referenced by ng_iface_newhook().
NETGRAPH_INIT | ( | iface | , |
& | typestruct | ||
) |
|
static |
Definition at line 419 of file ng_iface.c.
Referenced by ng_iface_output(), and ng_iface_rcvdata().
|
static |
Definition at line 520 of file ng_iface.c.
References ifqmaxlen, M_NETGRAPH_IFACE, NG_IFACE_IFACE_NAME, ng_iface_ioctl(), NG_IFACE_MTU_DEFAULT, ng_iface_output(), ng_iface_start(), ng_name_node(), NG_NODE_SET_PRIVATE, and V_ng_iface_unit.
|
static |
Definition at line 770 of file ng_iface.c.
References get_hook_from_iffam(), get_iffam_from_hook(), NG_HOOK_NODE, NG_NODE_PRIVATE, PRIV_WLOCK, and PRIV_WUNLOCK.
|
static |
Definition at line 281 of file ng_iface.c.
References data, NG_IFACE_MTU_MAX, and NG_IFACE_MTU_MIN.
Referenced by ng_iface_constructor().
|
static |
Definition at line 787 of file ng_iface.c.
References event.
Definition at line 578 of file ng_iface.c.
References get_hook_from_iffam(), get_iffam_from_name(), name, NG_HOOK_HI_STACK, NG_HOOK_SET_TO_INBOUND, NG_NODE_PRIVATE, PRIV_WLOCK, and PRIV_WUNLOCK.
|
static |
Definition at line 349 of file ng_iface.c.
References ng_iface_bpftap(), ng_iface_send(), NGM_IFACE_COOKIE, and V_ng_iface_max_nest.
Referenced by ng_iface_constructor().
Definition at line 684 of file ng_iface.c.
References iffam::family, get_iffam_from_hook(), NG_FREE_ITEM, NG_FREE_M, NG_HOOK_NODE, ng_iface_bpftap(), NG_NODE_PRIVATE, and NGI_GET_M.
Definition at line 603 of file ng_iface.c.
References ng_mesg::ng_msghdr::cmd, ng_mesg::data, ng_mesg::header, NG_FREE_MSG, NG_MKRESPONSE, NG_NODE_PRIVATE, NG_RESPOND_MSG, NGI_GET_MSG, NGM_FLOW_COOKIE, NGM_IFACE_BROADCAST, NGM_IFACE_COOKIE, NGM_IFACE_GET_IFINDEX, NGM_IFACE_GET_IFNAME, NGM_IFACE_POINT2POINT, NGM_LINK_IS_DOWN, NGM_LINK_IS_UP, and ng_mesg::ng_msghdr::typecookie.
|
static |
Definition at line 434 of file ng_iface.c.
References get_hook_from_iffam(), get_iffam_from_af(), NG_FREE_M, NG_HOOK_REF, NG_HOOK_UNREF, NG_OUTBOUND_THREAD_REF, NG_OUTBOUND_THREAD_UNREF, NG_SEND_DATA_ONLY, PRIV_RLOCK, and PRIV_RUNLOCK.
Referenced by ng_iface_output(), and ng_iface_start().
|
static |
Definition at line 743 of file ng_iface.c.
References M_NETGRAPH_IFACE, NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, NG_NODE_UNREF, and V_ng_iface_unit.
|
static |
Definition at line 397 of file ng_iface.c.
References ng_iface_send().
Referenced by ng_iface_constructor().
SYSCTL_INT | ( | _net_graph_iface | , |
OID_AUTO | , | ||
max_nesting | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEng_iface_max_nest, | ||
0 | , | ||
"Max nested tunnels" | |||
) |
|
static |
VNET_DEFINE_STATIC | ( | int | , |
ng_iface_max_nest | |||
) |
VNET_DEFINE_STATIC | ( | struct unrhdr * | , |
ng_iface_unit | |||
) |
|
static |
Definition at line 803 of file ng_iface.c.
References V_ng_iface_unit.
|
static |
Definition at line 812 of file ng_iface.c.
References V_ng_iface_unit.
VNET_SYSINIT | ( | vnet_ng_iface_init | , |
SI_SUB_PSEUDO | , | ||
SI_ORDER_ANY | , | ||
vnet_ng_iface_init | , | ||
NULL | |||
) |
VNET_SYSUNINIT | ( | vnet_ng_iface_uninit | , |
SI_SUB_INIT_IF | , | ||
SI_ORDER_ANY | , | ||
vnet_ng_iface_uninit | , | ||
NULL | |||
) |
|
static |
Definition at line 111 of file ng_iface.c.
Referenced by get_hook_from_iffam(), get_iffam_from_af(), get_iffam_from_hook(), and get_iffam_from_name().
|
static |
Definition at line 161 of file ng_iface.c.
|
static |
Definition at line 147 of file ng_iface.c.
|
static |
Definition at line 152 of file ng_iface.c.
|
static |
Definition at line 150 of file ng_iface.c.
|
static |
Definition at line 151 of file ng_iface.c.
|
static |
Definition at line 148 of file ng_iface.c.
|
static |
Definition at line 149 of file ng_iface.c.
|
static |
Definition at line 194 of file ng_iface.c.