FreeBSD kernel netgraph code
ng_ipfw.c File Reference
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/ctype.h>
#include <sys/errno.h>
#include <sys/rwlock.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <net/if.h>
#include <net/if_var.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip_fw.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netpfil/ipfw/ip_fw_private.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_ipfw.h>
#include <netgraph/netgraph.h>
Include dependency graph for ng_ipfw.c:

Go to the source code of this file.

Data Structures

struct  ng_ipfw_hook_priv
 

Typedefs

typedef struct ng_ipfw_hook_privhpriv_p
 

Functions

static int ng_ipfw_mod_event (module_t mod, int event, void *data)
 
static hook_p ng_ipfw_findhook1 (node_p, u_int16_t)
 
static int ng_ipfw_input (struct mbuf **, struct ip_fw_args *, bool)
 
 NETGRAPH_INIT (ipfw, &ng_ipfw_typestruct)
 
 MODULE_DEPEND (ng_ipfw, ipfw, 3, 3, 3)
 
static int ng_ipfw_constructor (node_p node)
 
static int ng_ipfw_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_ipfw_connect (hook_p hook)
 
static hook_p ng_ipfw_findhook (node_p node, const char *name)
 
static int ng_ipfw_rcvdata (hook_p hook, item_p item)
 
static int ng_ipfw_shutdown (node_p node)
 
static int ng_ipfw_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_ipfw_constructor
 
static ng_shutdown_t ng_ipfw_shutdown
 
static ng_newhook_t ng_ipfw_newhook
 
static ng_connect_t ng_ipfw_connect
 
static ng_findhook_t ng_ipfw_findhook
 
static ng_rcvdata_t ng_ipfw_rcvdata
 
static ng_disconnect_t ng_ipfw_disconnect
 
static node_p fw_node
 
static struct ng_type ng_ipfw_typestruct
 

Typedef Documentation

◆ hpriv_p

typedef struct ng_ipfw_hook_priv* hpriv_p

Definition at line 101 of file ng_ipfw.c.

Function Documentation

◆ MODULE_DEPEND()

MODULE_DEPEND ( ng_ipfw  ,
ipfw  ,
,
,
 
)

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( ipfw  ,
ng_ipfw_typestruct 
)

◆ ng_ipfw_connect()

static int ng_ipfw_connect ( hook_p  hook)
static

Definition at line 193 of file ng_ipfw.c.

References ng_ipfw_hook_priv::hook, and NG_HOOK_FORCE_QUEUE.

◆ ng_ipfw_constructor()

static int ng_ipfw_constructor ( node_p  node)
static

Definition at line 148 of file ng_ipfw.c.

◆ ng_ipfw_disconnect()

static int ng_ipfw_disconnect ( hook_p  hook)
static

Definition at line 351 of file ng_ipfw.c.

References NG_HOOK_PRIVATE, and NG_HOOK_SET_PRIVATE.

◆ ng_ipfw_findhook()

static hook_p ng_ipfw_findhook ( node_p  node,
const char *  name 
)
static

Definition at line 201 of file ng_ipfw.c.

References name, and ng_ipfw_findhook1().

Here is the call graph for this function:

◆ ng_ipfw_findhook1()

static hook_p ng_ipfw_findhook1 ( node_p  node,
u_int16_t  rulenum 
)
static

Definition at line 214 of file ng_ipfw.c.

References ng_ipfw_hook_priv::hook, NG_HOOK_IS_VALID, NG_HOOK_PRIVATE, and ng_ipfw_hook_priv::rulenum.

Referenced by ng_ipfw_findhook(), and ng_ipfw_input().

Here is the caller graph for this function:

◆ ng_ipfw_input()

static int ng_ipfw_input ( struct mbuf **  m0,
struct ip_fw_args *  fwa,
bool  tee 
)
static

Definition at line 286 of file ng_ipfw.c.

References fw_node, ng_ipfw_findhook1(), NG_SEND_DATA_ONLY, and r.

Referenced by ng_ipfw_mod_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ng_ipfw_mod_event()

static int ng_ipfw_mod_event ( module_t  mod,
int  event,
void *  data 
)
static

Definition at line 104 of file ng_ipfw.c.

References event, fw_node, ng_ipfw_input(), ng_ipfw_typestruct, ng_make_node_common(), and ng_name_node().

Here is the call graph for this function:

◆ ng_ipfw_newhook()

static int ng_ipfw_newhook ( node_p  node,
hook_p  hook,
const char *  name 
)
static

◆ ng_ipfw_rcvdata()

static int ng_ipfw_rcvdata ( hook_p  hook,
item_p  item 
)
static

Definition at line 229 of file ng_ipfw.c.

References NG_FREE_ITEM, NG_FREE_M, NGI_GET_M, and r.

◆ ng_ipfw_shutdown()

static int ng_ipfw_shutdown ( node_p  node)
static

Definition at line 337 of file ng_ipfw.c.

References NG_NODE_UNREF.

Variable Documentation

◆ fw_node

node_p fw_node
static

Definition at line 78 of file ng_ipfw.c.

Referenced by ng_ipfw_input(), and ng_ipfw_mod_event().

◆ ng_ipfw_connect

ng_connect_t ng_ipfw_connect
static

Definition at line 69 of file ng_ipfw.c.

◆ ng_ipfw_constructor

ng_constructor_t ng_ipfw_constructor
static

Definition at line 66 of file ng_ipfw.c.

◆ ng_ipfw_disconnect

ng_disconnect_t ng_ipfw_disconnect
static

Definition at line 72 of file ng_ipfw.c.

◆ ng_ipfw_findhook

ng_findhook_t ng_ipfw_findhook
static

Definition at line 70 of file ng_ipfw.c.

◆ ng_ipfw_newhook

ng_newhook_t ng_ipfw_newhook
static

Definition at line 68 of file ng_ipfw.c.

◆ ng_ipfw_rcvdata

ng_rcvdata_t ng_ipfw_rcvdata
static

Definition at line 71 of file ng_ipfw.c.

◆ ng_ipfw_shutdown

ng_shutdown_t ng_ipfw_shutdown
static

Definition at line 67 of file ng_ipfw.c.

◆ ng_ipfw_typestruct

struct ng_type ng_ipfw_typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.mod_event = ng_ipfw_mod_event,
.constructor = ng_ipfw_constructor,
.shutdown = ng_ipfw_shutdown,
.newhook = ng_ipfw_newhook,
.connect = ng_ipfw_connect,
.findhook = ng_ipfw_findhook,
.rcvdata = ng_ipfw_rcvdata,
.disconnect = ng_ipfw_disconnect,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_connect_t ng_ipfw_connect
Definition: ng_ipfw.c:69
static ng_shutdown_t ng_ipfw_shutdown
Definition: ng_ipfw.c:67
static ng_newhook_t ng_ipfw_newhook
Definition: ng_ipfw.c:68
static ng_disconnect_t ng_ipfw_disconnect
Definition: ng_ipfw.c:72
static int ng_ipfw_mod_event(module_t mod, int event, void *data)
Definition: ng_ipfw.c:104
static ng_rcvdata_t ng_ipfw_rcvdata
Definition: ng_ipfw.c:71
static ng_constructor_t ng_ipfw_constructor
Definition: ng_ipfw.c:66
static ng_findhook_t ng_ipfw_findhook
Definition: ng_ipfw.c:70
#define NG_IPFW_NODE_TYPE
Definition: ng_ipfw.h:33

Definition at line 81 of file ng_ipfw.c.

Referenced by ng_ipfw_mod_event().