FreeBSD kernel netgraph code
ng_checksum.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.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 <sys/socket.h>
#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_vlan_var.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <machine/in_cksum.h>
#include <netgraph/ng_message.h>
#include <netgraph/ng_parse.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_checksum.h>
Include dependency graph for ng_checksum.c:

Go to the source code of this file.

Data Structures

struct  ng_checksum_priv
 

Macros

#define ERROUT(x)   { error = (x); goto done; }
 
#define PULLUP_CHECK(mbuf, length)
 
#define PULLUP_CHECK(mbuf, length)
 

Typedefs

typedef struct ng_checksum_privpriv_p
 

Functions

 __FBSDID ("$FreeBSD$")
 
 NETGRAPH_INIT (checksum, &typestruct)
 
static int ng_checksum_constructor (node_p node)
 
static int ng_checksum_newhook (node_p node, hook_p hook, const char *name)
 
static int ng_checksum_rcvmsg (node_p node, item_p item, hook_p lasthook)
 
static int ng_checksum_rcvdata (hook_p hook, item_p item)
 
static int ng_checksum_shutdown (node_p node)
 
static int ng_checksum_disconnect (hook_p hook)
 

Variables

static ng_constructor_t ng_checksum_constructor
 
static ng_rcvmsg_t ng_checksum_rcvmsg
 
static ng_shutdown_t ng_checksum_shutdown
 
static ng_newhook_t ng_checksum_newhook
 
static ng_rcvdata_t ng_checksum_rcvdata
 
static ng_disconnect_t ng_checksum_disconnect
 
static const struct ng_parse_struct_field ng_checksum_config_type_fields [] = NG_CHECKSUM_CONFIG_TYPE
 
static const struct ng_parse_type ng_checksum_config_type
 
static const struct ng_parse_struct_field ng_checksum_stats_fields [] = NG_CHECKSUM_STATS_TYPE
 
static const struct ng_parse_type ng_checksum_stats_type
 
static const struct ng_cmdlist ng_checksum_cmdlist []
 
static struct ng_type typestruct
 

Macro Definition Documentation

◆ ERROUT

#define ERROUT (   x)    { error = (x); goto done; }

Definition at line 78 of file ng_checksum.c.

◆ PULLUP_CHECK [1/2]

#define PULLUP_CHECK (   mbuf,
  length 
)
Value:
do { \
pullup_len += length; \
if (((mbuf)->m_pkthdr.len < pullup_len) || \
(pullup_len > MHLEN)) { \
return (EINVAL); \
} \
if ((mbuf)->m_len < pullup_len && \
(((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \
return (ENOBUFS); \
} \
} while (0)
uint8_t length
Definition: ng_ubt_var.h:1

Definition at line 293 of file ng_checksum.c.

◆ PULLUP_CHECK [2/2]

#define PULLUP_CHECK (   mbuf,
  length 
)
Value:
do { \
pullup_len += length; \
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)

Definition at line 293 of file ng_checksum.c.

Typedef Documentation

◆ priv_p

typedef struct ng_checksum_priv* priv_p

Definition at line 69 of file ng_checksum.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ NETGRAPH_INIT()

NETGRAPH_INIT ( checksum  ,
typestruct 
)

◆ ng_checksum_constructor()

static int ng_checksum_constructor ( node_p  node)
static

Definition at line 162 of file ng_checksum.c.

References NG_NODE_SET_PRIVATE.

◆ ng_checksum_disconnect()

static int ng_checksum_disconnect ( hook_p  hook)
static

Definition at line 711 of file ng_checksum.c.

References NG_HOOK_NODE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, and ng_rmnode_self().

Here is the call graph for this function:

◆ ng_checksum_newhook()

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

Definition at line 175 of file ng_checksum.c.

References name, NG_CHECKSUM_HOOK_IN, NG_CHECKSUM_HOOK_OUT, and NG_NODE_PRIVATE.

◆ ng_checksum_rcvdata()

◆ ng_checksum_rcvmsg()

◆ ng_checksum_shutdown()

static int ng_checksum_shutdown ( node_p  node)
static

Definition at line 695 of file ng_checksum.c.

References NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, and NG_NODE_UNREF.

Variable Documentation

◆ ng_checksum_cmdlist

const struct ng_cmdlist ng_checksum_cmdlist[]
static

Definition at line 94 of file ng_checksum.c.

◆ ng_checksum_config_type

const struct ng_parse_type ng_checksum_config_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_checksum_config_type_fields[]
Definition: ng_checksum.c:81
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222

Definition at line 82 of file ng_checksum.c.

◆ ng_checksum_config_type_fields

const struct ng_parse_struct_field ng_checksum_config_type_fields[] = NG_CHECKSUM_CONFIG_TYPE
static

Definition at line 80 of file ng_checksum.c.

◆ ng_checksum_constructor

ng_constructor_t ng_checksum_constructor
static

Definition at line 72 of file ng_checksum.c.

◆ ng_checksum_disconnect

ng_disconnect_t ng_checksum_disconnect
static

Definition at line 77 of file ng_checksum.c.

◆ ng_checksum_newhook

ng_newhook_t ng_checksum_newhook
static

Definition at line 75 of file ng_checksum.c.

◆ ng_checksum_rcvdata

ng_rcvdata_t ng_checksum_rcvdata
static

Definition at line 76 of file ng_checksum.c.

◆ ng_checksum_rcvmsg

ng_rcvmsg_t ng_checksum_rcvmsg
static

Definition at line 73 of file ng_checksum.c.

◆ ng_checksum_shutdown

ng_shutdown_t ng_checksum_shutdown
static

Definition at line 74 of file ng_checksum.c.

◆ ng_checksum_stats_fields

const struct ng_parse_struct_field ng_checksum_stats_fields[] = NG_CHECKSUM_STATS_TYPE
static

Definition at line 87 of file ng_checksum.c.

◆ ng_checksum_stats_type

const struct ng_parse_type ng_checksum_stats_type
static
Initial value:
= {
}
static const struct ng_parse_struct_field ng_checksum_stats_fields[]
Definition: ng_checksum.c:88

Definition at line 89 of file ng_checksum.c.

◆ typestruct

struct ng_type typestruct
static
Initial value:
= {
.version = NG_ABI_VERSION,
.constructor = ng_checksum_constructor,
.rcvmsg = ng_checksum_rcvmsg,
.shutdown = ng_checksum_shutdown,
.newhook = ng_checksum_newhook,
.rcvdata = ng_checksum_rcvdata,
.disconnect = ng_checksum_disconnect,
.cmdlist = ng_checksum_cmdlist,
}
#define NG_ABI_VERSION
Definition: netgraph.h:77
static ng_shutdown_t ng_checksum_shutdown
Definition: ng_checksum.c:74
static const struct ng_cmdlist ng_checksum_cmdlist[]
Definition: ng_checksum.c:94
static ng_disconnect_t ng_checksum_disconnect
Definition: ng_checksum.c:77
static ng_newhook_t ng_checksum_newhook
Definition: ng_checksum.c:75
static ng_rcvmsg_t ng_checksum_rcvmsg
Definition: ng_checksum.c:73
static ng_constructor_t ng_checksum_constructor
Definition: ng_checksum.c:72
static ng_rcvdata_t ng_checksum_rcvdata
Definition: ng_checksum.c:76
#define NG_CHECKSUM_NODE_TYPE
Definition: ng_checksum.h:33

Definition at line 147 of file ng_checksum.c.