FreeBSD kernel netgraph code
|
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/endian.h>
#include <sys/errno.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_mppc.h>
#include "opt_netgraph.h"
#include <crypto/sha1.h>
Go to the source code of this file.
Data Structures | |
struct | ng_mppc_dir |
struct | ng_mppc_private |
Macros | |
#define | M_NETGRAPH_MPPC M_NETGRAPH |
#define | MPPC_DECOMP_BUFSIZE 8092 /* allocate buffer this big */ |
#define | MPPC_DECOMP_SAFETY 100 /* plus this much margin */ |
#define | MPPC_HDRLEN 2 |
#define | KEYLEN(b) (((b) & MPPE_128) ? 16 : 8) |
#define | MPPE_MAX_REKEY 1000 |
#define | MPPC_FLAG_FLUSHED 0x8000 /* xmitter reset state */ |
#define | MPPC_FLAG_RESTART 0x4000 /* compress history restart */ |
#define | MPPC_FLAG_COMPRESSED 0x2000 /* packet is compresed */ |
#define | MPPC_FLAG_ENCRYPTED 0x1000 /* packet is encrypted */ |
#define | MPPC_CCOUNT_MASK 0x0fff /* sequence number mask */ |
#define | MPPC_CCOUNT_INC(d) ((d) = (((d) + 1) & MPPC_CCOUNT_MASK)) |
#define | MPPE_UPDATE_MASK 0xff /* coherency count when we're */ |
#define | MPPE_UPDATE_FLAG 0xff /* supposed to update key */ |
#define | MPPC_COMP_OK 0x05 |
#define | MPPC_DECOMP_OK 0x05 |
#define | ERROUT(x) do { error = (x); goto done; } while (0) |
Typedefs | |
typedef struct ng_mppc_private * | priv_p |
Functions | |
SYSCTL_NODE (_net_graph, OID_AUTO, mppe, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "MPPE") | |
SYSCTL_INT (_net_graph_mppe, OID_AUTO, block_on_max_rekey, CTLFLAG_RWTUN, &mppe_block_on_max_rekey, 0, "Block node on max MPPE key re-calculations") | |
SYSCTL_INT (_net_graph_mppe, OID_AUTO, log_max_rekey, CTLFLAG_RWTUN, &mppe_log_max_rekey, 0, "Log max MPPE key re-calculations event") | |
SYSCTL_INT (_net_graph_mppe, OID_AUTO, max_rekey, CTLFLAG_RWTUN, &mppe_max_rekey, 0, "Maximum number of MPPE key re-calculations") | |
static int | ng_mppc_compress (node_p node, struct mbuf **datap) |
static int | ng_mppc_decompress (node_p node, struct mbuf **datap) |
static void | ng_mppc_reset_req (node_p node) |
NETGRAPH_INIT (mppc, &ng_mppc_typestruct) | |
static int | ng_mppc_constructor (node_p node) |
static int | ng_mppc_newhook (node_p node, hook_p hook, const char *name) |
static int | ng_mppc_rcvmsg (node_p node, item_p item, hook_p lasthook) |
static int | ng_mppc_rcvdata (hook_p hook, item_p item) |
static int | ng_mppc_shutdown (node_p node) |
static int | ng_mppc_disconnect (hook_p hook) |
Variables | |
static int | mppe_block_on_max_rekey = 0 |
static int | mppe_log_max_rekey = 1 |
static int | mppe_max_rekey = MPPE_MAX_REKEY |
static ng_constructor_t | ng_mppc_constructor |
static ng_rcvmsg_t | ng_mppc_rcvmsg |
static ng_shutdown_t | ng_mppc_shutdown |
static ng_newhook_t | ng_mppc_newhook |
static ng_rcvdata_t | ng_mppc_rcvdata |
static ng_disconnect_t | ng_mppc_disconnect |
static struct ng_type | ng_mppc_typestruct |
static const u_char | ng_mppe_weakenkey [3] = { 0xd1, 0x26, 0x9e } |
#define ERROUT | ( | x | ) | do { error = (x); goto done; } while (0) |
#define MPPC_CCOUNT_INC | ( | d | ) | ((d) = (((d) + 1) & MPPC_CCOUNT_MASK)) |
#define MPPC_CCOUNT_MASK 0x0fff /* sequence number mask */ |
#define MPPC_DECOMP_BUFSIZE 8092 /* allocate buffer this big */ |
#define MPPC_FLAG_COMPRESSED 0x2000 /* packet is compresed */ |
#define MPPC_FLAG_ENCRYPTED 0x1000 /* packet is encrypted */ |
#define MPPC_FLAG_FLUSHED 0x8000 /* xmitter reset state */ |
#define MPPC_FLAG_RESTART 0x4000 /* compress history restart */ |
#define MPPE_UPDATE_FLAG 0xff /* supposed to update key */ |
#define MPPE_UPDATE_MASK 0xff /* coherency count when we're */ |
typedef struct ng_mppc_private* priv_p |
NETGRAPH_INIT | ( | mppc | , |
& | ng_mppc_typestruct | ||
) |
|
static |
Definition at line 477 of file ng_mppc.c.
References ng_mppc_config::bits, ng_mppc_dir::cc, ng_mppc_dir::cfg, flags, ng_mppc_dir::flushed, header, KEYLEN, M_NETGRAPH_MPPC, MPPC_BIT, MPPC_CCOUNT_INC, MPPC_COMP_OK, MPPC_FLAG_COMPRESSED, MPPC_FLAG_ENCRYPTED, MPPC_FLAG_FLUSHED, MPPC_FLAG_RESTART, MPPC_HDRLEN, MPPC_MAX_BLOWUP, MPPE_BITS, MPPE_STATELESS, MPPE_UPDATE_FLAG, MPPE_UPDATE_MASK, NG_NODE_PRIVATE, and ng_mppc_config::startkey.
Referenced by ng_mppc_rcvdata().
|
static |
Definition at line 214 of file ng_mppc.c.
References M_NETGRAPH_MPPC, NG_NODE_FORCE_WRITER, and NG_NODE_SET_PRIVATE.
|
static |
Definition at line 626 of file ng_mppc.c.
References ng_mppc_config::bits, ng_mppc_dir::cc, ng_mppc_dir::cfg, flags, header, KEYLEN, M_NETGRAPH_MPPC, MPPC_BIT, MPPC_CCOUNT_INC, MPPC_CCOUNT_MASK, MPPC_DECOMP_BUFSIZE, MPPC_DECOMP_OK, MPPC_DECOMP_SAFETY, MPPC_FLAG_COMPRESSED, MPPC_FLAG_ENCRYPTED, MPPC_FLAG_FLUSHED, MPPC_FLAG_RESTART, MPPC_HDRLEN, MPPE_BITS, mppe_block_on_max_rekey, mppe_log_max_rekey, mppe_max_rekey, MPPE_STATELESS, MPPE_UPDATE_FLAG, MPPE_UPDATE_MASK, NG_NODE_PRIVATE, and ng_mppc_config::startkey.
Referenced by ng_mppc_rcvdata().
|
static |
Definition at line 450 of file ng_mppc.c.
References NG_HOOK_NODE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, and ng_rmnode_self().
Definition at line 234 of file ng_mppc.c.
References name, NG_MPPC_HOOK_COMP, NG_MPPC_HOOK_DECOMP, and NG_NODE_PRIVATE.
Definition at line 371 of file ng_mppc.c.
References NG_FREE_ITEM, NG_FREE_M, NG_FWD_NEW_DATA, NG_HOOK_NODE, NG_MKMESSAGE, ng_mppc_compress(), ng_mppc_decompress(), NG_NODE_PRIVATE, NG_SEND_MSG_ID, NGI_GET_M, NGM_MPPC_COOKIE, and NGM_MPPC_RESETREQ.
Definition at line 260 of file ng_mppc.c.
References ng_mesg::ng_msghdr::arglen, ng_mppc_config::bits, ng_mesg::ng_msghdr::cmd, ng_mesg::data, ng_mppc_config::enable, ERROUT, ng_mesg::header, KEYLEN, M_NETGRAPH_MPPC, MPPC_BIT, MPPC_VALID_BITS, MPPE_40, MPPE_56, MPPE_BITS, NG_FREE_MSG, ng_mppc_reset_req(), ng_mppe_weakenkey, NG_NODE_PRIVATE, NG_RESPOND_MSG, NGI_GET_MSG, NGI_RETADDR, NGM_MPPC_CONFIG_COMP, NGM_MPPC_CONFIG_DECOMP, NGM_MPPC_COOKIE, NGM_MPPC_RESETREQ, ng_mppc_config::startkey, and ng_mesg::ng_msghdr::typecookie.
|
static |
Definition at line 842 of file ng_mppc.c.
References ng_mppc_config::bits, ng_mppc_dir::cfg, ng_mppc_dir::flushed, KEYLEN, MPPE_STATELESS, and NG_NODE_PRIVATE.
Referenced by ng_mppc_rcvmsg().
|
static |
Definition at line 428 of file ng_mppc.c.
References M_NETGRAPH_MPPC, NG_NODE_PRIVATE, NG_NODE_SET_PRIVATE, and NG_NODE_UNREF.
SYSCTL_INT | ( | _net_graph_mppe | , |
OID_AUTO | , | ||
block_on_max_rekey | , | ||
CTLFLAG_RWTUN | , | ||
& | mppe_block_on_max_rekey, | ||
0 | , | ||
"Block node on max MPPE key re-calculations" | |||
) |
SYSCTL_INT | ( | _net_graph_mppe | , |
OID_AUTO | , | ||
log_max_rekey | , | ||
CTLFLAG_RWTUN | , | ||
& | mppe_log_max_rekey, | ||
0 | , | ||
"Log max MPPE key re-calculations event" | |||
) |
SYSCTL_INT | ( | _net_graph_mppe | , |
OID_AUTO | , | ||
max_rekey | , | ||
CTLFLAG_RWTUN | , | ||
& | mppe_max_rekey, | ||
0 | , | ||
"Maximum number of MPPE key re-calculations" | |||
) |
SYSCTL_NODE | ( | _net_graph | , |
OID_AUTO | , | ||
mppe | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"MPPE" | |||
) |
|
static |
Definition at line 113 of file ng_mppc.c.
Referenced by ng_mppc_decompress().
|
static |
Definition at line 117 of file ng_mppc.c.
Referenced by ng_mppc_decompress().
|
static |
Definition at line 121 of file ng_mppc.c.
Referenced by ng_mppc_decompress().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 202 of file ng_mppc.c.
Referenced by ng_mppc_rcvmsg().