#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/endian.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <net/bpf.h>
#include <net/ethernet.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_patch.h>
Go to the source code of this file.
|
| __FBSDID ("$FreeBSD$") |
|
static int | ng_patch_config_getlen (const struct ng_parse_type *type, const u_char *start, const u_char *buf) |
|
| NETGRAPH_INIT (patch, &typestruct) |
|
static int | ng_patch_constructor (node_p node) |
|
static int | ng_patch_newhook (node_p node, hook_p hook, const char *name) |
|
static int | ng_patch_rcvmsg (node_p node, item_p item, hook_p lasthook) |
|
static void | do_patch (priv_p privp, struct mbuf *m, int global_offset) |
|
static int | ng_patch_rcvdata (hook_p hook, item_p item) |
|
static int | ng_patch_shutdown (node_p node) |
|
static int | ng_patch_disconnect (hook_p hook) |
|
◆ ERROUT
#define ERROUT |
( |
|
x | ) |
{ error = (x); goto done; } |
◆ PULLUP_CHECK
#define PULLUP_CHECK |
( |
|
mbuf, |
|
|
|
length |
|
) |
| |
Value: do { \
if (((mbuf)->m_pkthdr.len < pullup_len) || \
(pullup_len > MHLEN)) { \
error = EINVAL; \
goto bypass; \
} \
if ((mbuf)->m_len < pullup_len && \
(((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \
error = ENOBUFS; \
goto drop; \
} \
} while (0)
◆ priv_p
◆ __FBSDID()
◆ do_patch()
static void do_patch |
( |
priv_p |
privp, |
|
|
struct mbuf * |
m, |
|
|
int |
global_offset |
|
) |
| |
|
static |
Definition at line 354 of file ng_patch.c.
References NG_PATCH_MODE_ADD, NG_PATCH_MODE_AND, NG_PATCH_MODE_DIV, NG_PATCH_MODE_MUL, NG_PATCH_MODE_NEG, NG_PATCH_MODE_OR, NG_PATCH_MODE_SET, NG_PATCH_MODE_SHL, NG_PATCH_MODE_SHR, NG_PATCH_MODE_SUB, and NG_PATCH_MODE_XOR.
Referenced by ng_patch_rcvdata().
◆ NETGRAPH_INIT()
NETGRAPH_INIT |
( |
patch |
, |
|
|
& |
typestruct |
|
) |
| |
◆ ng_patch_config_getlen()
static int ng_patch_config_getlen |
( |
const struct ng_parse_type * |
type, |
|
|
const u_char * |
start, |
|
|
const u_char * |
buf |
|
) |
| |
|
static |
◆ ng_patch_constructor()
static int ng_patch_constructor |
( |
node_p |
node | ) |
|
|
static |
◆ ng_patch_disconnect()
static int ng_patch_disconnect |
( |
hook_p |
hook | ) |
|
|
static |
◆ ng_patch_newhook()
static int ng_patch_newhook |
( |
node_p |
node, |
|
|
hook_p |
hook, |
|
|
const char * |
name |
|
) |
| |
|
static |
◆ ng_patch_rcvdata()
Definition at line 552 of file ng_patch.c.
References do_patch(), ERROUT, ng_patch_vlan_header::etype, NG_FREE_ITEM, NG_FREE_M, NG_FWD_NEW_DATA, NG_HOOK_NODE, NG_NODE_PRIVATE, NGI_GET_M, PULLUP_CHECK, and priv::stats.
◆ ng_patch_rcvmsg()
Definition at line 209 of file ng_patch.c.
References ng_mesg::ng_msghdr::arglen, ng_mesg::ng_msghdr::cmd, ng_patch_config::count, ng_patch_config::csum_flags, ng_mesg::data, ERROUT, ng_mesg::header, ng_patch_op::length, NG_FREE_MSG, NG_MKRESPONSE, NG_NODE_PRIVATE, NG_PATCH_CONF_SIZE, NG_PATCH_CSUM_IPV4, NG_PATCH_CSUM_IPV6, NG_RESPOND_MSG, NGI_GET_MSG, NGM_PATCH_CLR_STATS, NGM_PATCH_COOKIE, NGM_PATCH_GET_STATS, NGM_PATCH_GETCLR_STATS, NGM_PATCH_GETCONFIG, NGM_PATCH_GETDLT, NGM_PATCH_SETCONFIG, NGM_PATCH_SETDLT, ng_patch_config::ops, ng_patch_config::relative_offset, ng_mesg::ng_msghdr::typecookie, ng_patch_op_val::v1, ng_patch_op_val::v2, ng_patch_op_val::v4, ng_patch_op_val::v8, and ng_patch_op::val.
◆ ng_patch_shutdown()
static int ng_patch_shutdown |
( |
node_p |
node | ) |
|
|
static |
◆ ng_patch_cmdlist
◆ ng_patch_config_type
Initial value:= {
}
const struct ng_parse_type ng_parse_struct_type
static const struct ng_parse_struct_field ng_patch_config_type_fields[]
Definition at line 100 of file ng_patch.c.
◆ ng_patch_config_type_fields
◆ ng_patch_constructor
◆ ng_patch_disconnect
◆ ng_patch_newhook
◆ ng_patch_op_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_patch_op_type_fields[]
Definition at line 84 of file ng_patch.c.
◆ ng_patch_op_type_fields
◆ ng_patch_ops_array_info
Initial value:= {
}
static int ng_patch_config_getlen(const struct ng_parse_type *type, const u_char *start, const u_char *buf)
static const struct ng_parse_type ng_patch_op_type
Definition at line 89 of file ng_patch.c.
◆ ng_patch_ops_array_type
Initial value:= {
}
const struct ng_parse_type ng_parse_array_type
static const struct ng_parse_array_info ng_patch_ops_array_info
Definition at line 93 of file ng_patch.c.
◆ ng_patch_rcvdata
◆ ng_patch_rcvmsg
◆ ng_patch_shutdown
◆ ng_patch_stats_fields
◆ ng_patch_stats_type
Initial value:= {
}
static const struct ng_parse_struct_field ng_patch_stats_fields[]
Definition at line 107 of file ng_patch.c.
◆ typestruct
Initial value:= {
}
static ng_newhook_t ng_patch_newhook
static ng_rcvdata_t ng_patch_rcvdata
static ng_shutdown_t ng_patch_shutdown
static ng_constructor_t ng_patch_constructor
static ng_disconnect_t ng_patch_disconnect
static const struct ng_cmdlist ng_patch_cmdlist[]
static ng_rcvmsg_t ng_patch_rcvmsg
#define NG_PATCH_NODE_TYPE
Definition at line 165 of file ng_patch.c.