FreeBSD kernel netgraph code
ng_vlan.c File Reference
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_vlan_var.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_vlan.h>
#include <netgraph/netgraph.h>
Include dependency graph for ng_vlan.c:

Go to the source code of this file.

Data Structures

struct  ng_vlan_private
 

Macros

#define ETHER_VLAN_HDR_LEN   (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)
 
#define VLAN_TAG_MASK   0xFFFF
 
#define HOOK_VLAN_TAG_SET_MASK   ((uintptr_t)((~0) & ~(VLAN_TAG_MASK)))
 
#define IS_HOOK_VLAN_SET(hdata)    ((((uintptr_t)hdata) & HOOK_VLAN_TAG_SET_MASK) == HOOK_VLAN_TAG_SET_MASK)
 

Typedefs

typedef struct ng_vlan_privatepriv_p
 

Functions

static int ng_vlan_getTableLength (const struct ng_parse_type *type, const u_char *start, const u_char *buf)
 
 NETGRAPH_INIT (vlan, &ng_vlan_typestruct)
 
static __inline int m_chk (struct mbuf **mp, int len)
 
static int ng_vlan_constructor (node_p node)
 
static int ng_vlan_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_vlan_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_vlan_rcvdata (hook_p hook, item_p item)
 
static int ng_vlan_shutdown (node_p node)
 
static int ng_vlan_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_vlan_constructor
 
static ng_rcvmsg_t ng_vlan_rcvmsg
 
static ng_shutdown_t ng_vlan_shutdown
 
static ng_newhook_t ng_vlan_newhook
 
static ng_rcvdata_t ng_vlan_rcvdata
 
static ng_disconnect_t ng_vlan_disconnect
 
static const struct ng_parse_struct_field ng_vlan_filter_fields []
 
static const struct ng_parse_type ng_vlan_filter_type
 
static const struct ng_parse_array_info ng_vlan_table_array_info
 
static const struct ng_parse_type ng_vlan_table_array_type
 
static const struct ng_parse_struct_field ng_vlan_table_fields []
 
static const struct ng_parse_type ng_vlan_table_type
 
static const struct ng_cmdlist ng_vlan_cmdlist []
 
static struct ng_type ng_vlan_typestruct
 

Macro Definition Documentation

◆ ETHER_VLAN_HDR_LEN

#define ETHER_VLAN_HDR_LEN   (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)

Definition at line 62 of file ng_vlan.c.

◆ HOOK_VLAN_TAG_SET_MASK

#define HOOK_VLAN_TAG_SET_MASK   ((uintptr_t)((~0) & ~(VLAN_TAG_MASK)))

Definition at line 64 of file ng_vlan.c.

◆ IS_HOOK_VLAN_SET

#define IS_HOOK_VLAN_SET (   hdata)     ((((uintptr_t)hdata) & HOOK_VLAN_TAG_SET_MASK) == HOOK_VLAN_TAG_SET_MASK)

Definition at line 65 of file ng_vlan.c.

◆ VLAN_TAG_MASK

#define VLAN_TAG_MASK   0xFFFF

Definition at line 63 of file ng_vlan.c.

Typedef Documentation

◆ priv_p

typedef struct ng_vlan_private* priv_p

Definition at line 60 of file ng_vlan.c.

Function Documentation

◆ m_chk()

static __inline int m_chk ( struct mbuf **  mp,
int  len 
)
static

Definition at line 202 of file ng_vlan.c.

Referenced by ng_vlan_rcvdata().

Here is the caller graph for this function:

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( vlan  ,
ng_vlan_typestruct 
)

◆ ng_vlan_constructor()

static int ng_vlan_constructor ( node_p  node)
static

Definition at line 221 of file ng_vlan.c.

References NG_NODE_SET_PRIVATE, and VLAN_ENCAP_FROM_FILTER.

◆ ng_vlan_disconnect()

static int ng_vlan_disconnect ( hook_p  hook)
static

Definition at line 689 of file ng_vlan.c.

References IS_HOOK_VLAN_SET, NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_HOOK_SET_PRIVATE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, and ng_rmnode_self().

Here is the call graph for this function:

◆ ng_vlan_getTableLength()

static int ng_vlan_getTableLength ( const struct ng_parse_type type,
const u_char *  start,
const u_char *  buf 
)
static

Definition at line 84 of file ng_vlan.c.

References ng_vlan_table::n.

◆ ng_vlan_newhook()

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

◆ ng_vlan_rcvdata()

static int ng_vlan_rcvdata ( hook_p  hook,
item_p  item 
)
static

◆ ng_vlan_rcvmsg()

◆ ng_vlan_shutdown()

static int ng_vlan_shutdown ( node_p  node)
static

Definition at line 678 of file ng_vlan.c.

References NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, and NG_NODE_UNREF.

Variable Documentation

◆ ng_vlan_cmdlist

const struct ng_cmdlist ng_vlan_cmdlist[]
static

Definition at line 110 of file ng_vlan.c.

◆ ng_vlan_constructor

ng_constructor_t ng_vlan_constructor
static

Definition at line 68 of file ng_vlan.c.

◆ ng_vlan_disconnect

ng_disconnect_t ng_vlan_disconnect
static

Definition at line 73 of file ng_vlan.c.

◆ ng_vlan_filter_fields

const struct ng_parse_struct_field ng_vlan_filter_fields[]
static
Initial value:
=
#define NG_VLAN_FILTER_FIELDS
Definition: ng_vlan.h:78

Definition at line 76 of file ng_vlan.c.

◆ ng_vlan_filter_type

const struct ng_parse_type ng_vlan_filter_type
static
Initial value:
= {
}
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222
static const struct ng_parse_struct_field ng_vlan_filter_fields[]
Definition: ng_vlan.c:76

Definition at line 78 of file ng_vlan.c.

◆ ng_vlan_newhook

ng_newhook_t ng_vlan_newhook
static

Definition at line 71 of file ng_vlan.c.

◆ ng_vlan_rcvdata

ng_rcvdata_t ng_vlan_rcvdata
static

Definition at line 72 of file ng_vlan.c.

◆ ng_vlan_rcvmsg

ng_rcvmsg_t ng_vlan_rcvmsg
static

Definition at line 69 of file ng_vlan.c.

◆ ng_vlan_shutdown

ng_shutdown_t ng_vlan_shutdown
static

Definition at line 70 of file ng_vlan.c.

◆ ng_vlan_table_array_info

const struct ng_parse_array_info ng_vlan_table_array_info
static
Initial value:
= {
}
static int ng_vlan_getTableLength(const struct ng_parse_type *type, const u_char *start, const u_char *buf)
Definition: ng_vlan.c:84
static const struct ng_parse_type ng_vlan_filter_type
Definition: ng_vlan.c:78

Definition at line 94 of file ng_vlan.c.

◆ ng_vlan_table_array_type

const struct ng_parse_type ng_vlan_table_array_type
static
Initial value:
= {
}
const struct ng_parse_type ng_parse_array_type
Definition: ng_parse.c:318
static const struct ng_parse_array_info ng_vlan_table_array_info
Definition: ng_vlan.c:94

Definition at line 98 of file ng_vlan.c.

◆ ng_vlan_table_fields

const struct ng_parse_struct_field ng_vlan_table_fields[]
static
Initial value:
=
#define NG_VLAN_TABLE_FIELDS
Definition: ng_vlan.h:103

Definition at line 102 of file ng_vlan.c.

◆ ng_vlan_table_type

const struct ng_parse_type ng_vlan_table_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_vlan_table_fields[]
Definition: ng_vlan.c:102

Definition at line 104 of file ng_vlan.c.

◆ ng_vlan_typestruct

struct ng_type ng_vlan_typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.constructor = ng_vlan_constructor,
.rcvmsg = ng_vlan_rcvmsg,
.shutdown = ng_vlan_shutdown,
.newhook = ng_vlan_newhook,
.rcvdata = ng_vlan_rcvdata,
.disconnect = ng_vlan_disconnect,
.cmdlist = ng_vlan_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_disconnect_t ng_vlan_disconnect
Definition: ng_vlan.c:73
static ng_shutdown_t ng_vlan_shutdown
Definition: ng_vlan.c:70
static ng_rcvmsg_t ng_vlan_rcvmsg
Definition: ng_vlan.c:69
static const struct ng_cmdlist ng_vlan_cmdlist[]
Definition: ng_vlan.c:110
static ng_newhook_t ng_vlan_newhook
Definition: ng_vlan.c:71
static ng_constructor_t ng_vlan_constructor
Definition: ng_vlan.c:68
static ng_rcvdata_t ng_vlan_rcvdata
Definition: ng_vlan.c:72
#define NG_VLAN_NODE_TYPE
Definition: ng_vlan.h:41

Definition at line 184 of file ng_vlan.c.