40#include <sys/kernel.h>
42#include <sys/malloc.h>
46#include <sys/syslog.h>
48#include <net/ethernet.h>
57#ifdef NG_SEPARATE_MALLOC
60#define M_NETGRAPH_ETF M_NETGRAPH
142#define HASH(et) ((((et)>>12)+((et)>>8)+((et)>>4)+(et)) & 0x0f)
160 struct filterhead *chain = etfp->
hashtable +
HASH(ethertype);
163 LIST_FOREACH(fil, chain, next) {
164 if (fil->ethertype == ethertype) {
185 LIST_INIT((
privdata->hashtable + i));
217 hpriv = malloc(
sizeof(*hpriv),
278 etfp->
flags = *((u_int32_t *) msg->
data);
317 fil = malloc(
sizeof(*fil),
324 fil->match_hook = hook;
327 +
HASH(fil->ethertype),
367 struct ether_header *eh;
385 if (m->m_len <
sizeof(*eh) ) {
386 m = m_pullup(m,
sizeof(*eh));
393 eh = mtod(m,
struct ether_header *);
394 ethertype = eh->ether_type;
403 if (fil && fil->match_hook) {
415 if ((fil && (fil->match_hook != hook))
454 struct filter *fil1, *fil2;
459 while (fil1 != NULL) {
460 fil2 = LIST_NEXT(fil1, next);
461 if (fil1->match_hook == hook) {
462 LIST_REMOVE(fil1, next);
#define NG_HOOK_NODE(hook)
int ng_rcvmsg_t(node_p node, item_p item, hook_p lasthook)
int ng_disconnect_t(hook_p hook)
#define NG_NODE_SET_PRIVATE(node, val)
#define NG_RESPOND_MSG(error, here, item, resp)
#define NG_NODE_IS_VALID(node)
#define NG_NODE_UNREF(node)
#define NG_HOOK_SET_PRIVATE(hook, val)
int ng_rmnode_self(node_p here)
#define NG_FWD_NEW_DATA(error, item, hook, m)
int ng_rcvdata_t(hook_p hook, item_p item)
int ng_shutdown_t(node_p node)
#define NG_FREE_ITEM(item)
int ng_constructor_t(node_p node)
#define NG_NODE_NUMHOOKS(node)
#define NGI_GET_MSG(i, m)
#define NG_NODE_PRIVATE(node)
int ng_newhook_t(node_p node, hook_p hook, const char *name)
hook_p ng_findhook(node_p node, const char *name)
#define NG_HOOK_PRIVATE(hook)
MALLOC_DEFINE(M_NG_CCATM, "ng_ccatm", "netgraph uni api node")
NETGRAPH_INIT(etf, &typestruct)
static struct filter * ng_etf_findentry(etf_p etfp, u_int16_t ethertype)
static ng_disconnect_t ng_etf_disconnect
static const struct ng_parse_type ng_etf_stat_type
LIST_HEAD(filterhead, filter)
static const struct ng_parse_struct_field ng_etf_stat_type_fields[]
static struct ng_type typestruct
static ng_shutdown_t ng_etf_shutdown
static const struct ng_parse_struct_field ng_etf_filter_type_fields[]
static ng_rcvmsg_t ng_etf_rcvmsg
static ng_rcvdata_t ng_etf_rcvdata
static const struct ng_parse_type ng_etf_filter_type
static ng_newhook_t ng_etf_newhook
static const struct ng_cmdlist ng_etf_cmdlist[]
static ng_constructor_t ng_etf_constructor
#define NG_ETF_STATS_TYPE_INFO
#define NG_ETF_HOOK_NOMATCH
#define NG_ETF_FILTER_TYPE_INFO
#define NG_ETF_HOOK_DOWNSTREAM
#define NG_MKRESPONSE(rsp, msg, len, how)
const struct ng_parse_type ng_parse_int32_type
const struct ng_parse_type ng_parse_struct_type
struct ETF_hookinfo downstream_hook
struct ETF_hookinfo nomatch_hook
struct filterhead hashtable[HASHSIZE]
char matchhook[NG_HOOKSIZ]
struct ng_mesg::ng_msghdr header