FreeBSD kernel netgraph code
|
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/time.h>
#include <sys/conf.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#include <sys/epoch.h>
#include <sys/libkern.h>
#include <net/vnet.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
#include <netgraph/ng_l2tp.h>
Go to the source code of this file.
Data Structures | |
struct | ng_l2tp_hook_private |
struct | l2tp_seq |
struct | ng_l2tp_private |
Macros | |
#define | M_NETGRAPH_L2TP M_NETGRAPH |
#define | L2TP_HDR_CTRL 0x8000 /* control packet */ |
#define | L2TP_HDR_LEN 0x4000 /* has length field */ |
#define | L2TP_HDR_SEQ 0x0800 /* has ns, nr fields */ |
#define | L2TP_HDR_OFF 0x0200 /* has offset field */ |
#define | L2TP_HDR_PRIO 0x0100 /* give priority */ |
#define | L2TP_HDR_VERS_MASK 0x000f /* version field mask */ |
#define | L2TP_HDR_VERSION 0x0002 /* version field */ |
#define | L2TP_CTRL_0BITS 0x030d /* ctrl: must be 0 */ |
#define | L2TP_CTRL_1BITS 0xc802 /* ctrl: must be 1 */ |
#define | L2TP_DATA_0BITS 0x800d /* data: must be 0 */ |
#define | L2TP_DATA_1BITS 0x0002 /* data: must be 1 */ |
#define | L2TP_CTRL_HDR |
#define | L2TP_DATA_HDR (L2TP_HDR_VERSION) /* optional: len, seq */ |
#define | L2TP_MAX_XWIN 128 /* my max xmit window */ |
#define | L2TP_MAX_REXMIT 5 /* default max rexmit */ |
#define | L2TP_MAX_REXMIT_TO 30 /* default rexmit to */ |
#define | L2TP_DELAYED_ACK ((hz + 19) / 20) /* delayed ack: 50 ms */ |
#define | L2TP_CONTROL_DSEQ 1 /* we are the lns */ |
#define | L2TP_ENABLE_DSEQ 1 /* enable data seq # */ |
#define | L2TP_SEQ_DIFF(x, y) ((int16_t)((x) - (y))) |
#define | SESSHASHSIZE 0x0020 |
#define | SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) |
#define | SEQ_LOCK(seq) mtx_lock(&(seq)->mtx) |
#define | SEQ_UNLOCK(seq) mtx_unlock(&(seq)->mtx) |
#define | SEQ_LOCK_ASSERT(seq) mtx_assert(&(seq)->mtx, MA_OWNED) |
#define | L2TP_COPY_MBUF m_copypacket |
#define | ERROUT(x) do { error = (x); goto done; } while (0) |
Typedefs | |
typedef struct ng_l2tp_hook_private * | hookpriv_p |
typedef struct ng_l2tp_private * | priv_p |
#define ERROUT | ( | x | ) | do { error = (x); goto done; } while (0) |
#define L2TP_CTRL_HDR |
#define L2TP_DATA_HDR (L2TP_HDR_VERSION) /* optional: len, seq */ |
#define L2TP_DELAYED_ACK ((hz + 19) / 20) /* delayed ack: 50 ms */ |
#define SEQ_LOCK_ASSERT | ( | seq | ) | mtx_assert(&(seq)->mtx, MA_OWNED) |
#define SESSHASH | ( | x | ) | (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) |
typedef struct ng_l2tp_hook_private* hookpriv_p |
typedef struct ng_l2tp_private* priv_p |
NETGRAPH_INIT | ( | l2tp | , |
& | ng_l2tp_typestruct | ||
) |
|
static |
Definition at line 365 of file ng_l2tp.c.
References L2TP_MAX_REXMIT, L2TP_MAX_REXMIT_TO, M_NETGRAPH_L2TP, ng_l2tp_seq_init(), NG_NODE_SET_PRIVATE, and SESSHASHSIZE.
|
static |
Definition at line 682 of file ng_l2tp.c.
References priv::lower, M_NETGRAPH_L2TP, NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_HOOK_SET_PRIVATE, NG_NODE_IS_VALID, NG_NODE_NUMHOOKS, NG_NODE_PRIVATE, and ng_rmnode_self().
|
static |
Definition at line 713 of file ng_l2tp.c.
References ng_l2tp_hook_private::conf, SESSHASH, and ng_l2tp_sess_config::session_id.
Referenced by ng_l2tp_rcvdata_lower(), and ng_l2tp_rcvmsg().
Definition at line 394 of file ng_l2tp.c.
References ng_l2tp_hook_private::conf, ng_l2tp_sess_config::control_dseq, ng_l2tp_sess_config::enable_dseq, ng_l2tp_hook_private::hook, L2TP_CONTROL_DSEQ, L2TP_ENABLE_DSEQ, priv::lower, M_NETGRAPH_L2TP, name, NG_HOOK_SET_PRIVATE, NG_HOOK_SET_RCVDATA, NG_L2TP_HOOK_CTRL, NG_L2TP_HOOK_LOWER, NG_L2TP_HOOK_SESSION_P, ng_l2tp_rcvdata_ctrl, ng_l2tp_rcvdata_lower, NG_NODE_PRIVATE, SESSHASH, and ng_l2tp_sess_config::session_id.
Definition at line 1088 of file ng_l2tp.c.
References ng_l2tp_hook_private::conf, ng_l2tp_sess_config::enable_dseq, priv::enabled, ERROUT, ng_l2tp_sess_config::include_length, L2TP_DATA_HDR, L2TP_HDR_LEN, L2TP_HDR_SEQ, priv::lower, NG_FREE_ITEM, NG_FREE_M, NG_FWD_NEW_DATA, NG_HOOK_NODE, NG_HOOK_PRIVATE, NG_NODE_PRIVATE, NGI_GET_M, ng_l2tp_hook_private::nr, ng_l2tp_hook_private::ns, ng_l2tp_sess_config::peer_id, priv::stats, ng_l2tp_hook_private::stats, ng_l2tp_session_stats::xmitOctets, and ng_l2tp_session_stats::xmitPackets.
Definition at line 1012 of file ng_l2tp.c.
References l2tp_seq::cwnd, priv::enabled, ERROUT, L2TP_COPY_MBUF, L2TP_MAX_XWIN, NG_FREE_ITEM, NG_HOOK_NODE, ng_l2tp_seq_rack_timeout(), ng_l2tp_xmit_ctrl(), NG_NODE_PRIVATE, NGI_GET_M, l2tp_seq::ns, l2tp_seq::rack_timer, SEQ_LOCK, SEQ_UNLOCK, priv::stats, and l2tp_seq::xwin.
Definition at line 748 of file ng_l2tp.c.
References ng_l2tp_hook_private::conf, ng_l2tp_sess_config::control_dseq, ng_l2tp_sess_config::enable_dseq, priv::enabled, ERROUT, ng_l2tp_hook_private::hook, l2tp_seq::inproc, L2TP_CTRL_0BITS, L2TP_CTRL_1BITS, L2TP_DATA_0BITS, L2TP_DATA_1BITS, L2TP_DELAYED_ACK, L2TP_HDR_CTRL, L2TP_HDR_LEN, L2TP_HDR_OFF, L2TP_HDR_SEQ, L2TP_SEQ_DIFF, NG_FREE_ITEM, NG_FREE_M, NG_FWD_NEW_DATA, NG_HOOK_NODE, ng_l2tp_find_session(), ng_l2tp_seq_recv_nr(), ng_l2tp_seq_xack_timeout(), ng_l2tp_xmit_ctrl(), NG_NODE_PRIVATE, NGI_GET_M, ng_l2tp_hook_private::nr, l2tp_seq::nr, l2tp_seq::ns, ng_l2tp_session_stats::recvOctets, ng_l2tp_session_stats::recvPackets, SEQ_LOCK, SEQ_UNLOCK, priv::stats, ng_l2tp_hook_private::stats, and l2tp_seq::xack_timer.
Definition at line 454 of file ng_l2tp.c.
References ng_mesg::ng_msghdr::arglen, ng_mesg::ng_msghdr::cmd, ng_l2tp_hook_private::conf, ng_mesg::data, priv::enabled, ng_l2tp_config::enabled, ng_mesg::header, ng_l2tp_config::match_id, NG_FREE_MSG, ng_l2tp_find_session(), ng_l2tp_seq_adjust(), ng_l2tp_seq_set(), NG_MKRESPONSE, NG_NODE_PRIVATE, NG_RESPOND_MSG, NGI_GET_MSG, NGI_RETADDR, NGM_L2TP_CLR_SESSION_STATS, NGM_L2TP_CLR_STATS, NGM_L2TP_COOKIE, NGM_L2TP_GET_CONFIG, NGM_L2TP_GET_SESS_CONFIG, NGM_L2TP_GET_SESSION_STATS, NGM_L2TP_GET_STATS, NGM_L2TP_GETCLR_SESSION_STATS, NGM_L2TP_GETCLR_STATS, NGM_L2TP_SET_CONFIG, NGM_L2TP_SET_SEQ, NGM_L2TP_SET_SESS_CONFIG, ng_l2tp_seq_config::nr, ng_l2tp_seq_config::ns, ng_l2tp_config::peer_id, ng_l2tp_seq_config::rack, ng_l2tp_sess_config::session_id, priv::stats, ng_l2tp_hook_private::stats, ng_l2tp_config::tunnel_id, ng_mesg::ng_msghdr::typecookie, and ng_l2tp_seq_config::xack.
|
static |
Definition at line 730 of file ng_l2tp.c.
References ng_l2tp_hook_private::conf, ng_l2tp_sess_config::control_dseq, ng_l2tp_sess_config::enable_dseq, NG_HOOK_PRIVATE, ng_l2tp_hook_private::nr, ng_l2tp_hook_private::ns, and ng_l2tp_hook_private::stats.
|
static |
Definition at line 1230 of file ng_l2tp.c.
References ng_l2tp_config::enabled, ERROUT, L2TP_MAX_XWIN, ng_l2tp_seq_reset(), ng_l2tp_config::peer_win, SEQ_LOCK, SEQ_UNLOCK, and l2tp_seq::wmax.
Referenced by ng_l2tp_rcvmsg().
|
static |
Definition at line 1165 of file ng_l2tp.c.
References NG_MKMESSAGE, NG_SEND_MSG_ID, NGM_L2TP_ACK_FAILURE, and NGM_L2TP_COOKIE.
Referenced by ng_l2tp_seq_rack_timeout().
|
static |
Definition at line 1184 of file ng_l2tp.c.
References l2tp_seq::cwnd, L2TP_MAX_XWIN, l2tp_seq::mtx, l2tp_seq::rack_timer, l2tp_seq::ssth, l2tp_seq::wmax, and l2tp_seq::xack_timer.
Referenced by ng_l2tp_constructor().
|
static |
Definition at line 1434 of file ng_l2tp.c.
References l2tp_seq::acks, l2tp_seq::cwnd, L2TP_COPY_MBUF, ng_node::nd_vnet, ng_l2tp_seq_failure(), ng_l2tp_seq_rack_timeout(), ng_l2tp_xmit_ctrl(), NG_NODE_PRIVATE, l2tp_seq::ns, l2tp_seq::rack, l2tp_seq::rack_timer, l2tp_seq::rexmits, SEQ_LOCK_ASSERT, SEQ_UNLOCK, l2tp_seq::ssth, priv::stats, and l2tp_seq::xwin.
Referenced by ng_l2tp_rcvdata_ctrl(), ng_l2tp_seq_rack_timeout(), and ng_l2tp_seq_recv_nr().
|
static |
Definition at line 1302 of file ng_l2tp.c.
References l2tp_seq::acks, l2tp_seq::cwnd, L2TP_COPY_MBUF, L2TP_MAX_XWIN, L2TP_SEQ_DIFF, ng_l2tp_seq_rack_timeout(), ng_l2tp_xmit_ctrl(), l2tp_seq::ns, l2tp_seq::rack, l2tp_seq::rack_timer, l2tp_seq::rexmits, SEQ_LOCK, SEQ_LOCK_ASSERT, l2tp_seq::ssth, priv::stats, l2tp_seq::wmax, and l2tp_seq::xwin.
Referenced by ng_l2tp_rcvdata_lower().
|
static |
Definition at line 1263 of file ng_l2tp.c.
References l2tp_seq::acks, l2tp_seq::cwnd, L2TP_MAX_XWIN, ng_l2tp_reset_session, NG_NODE_FOREACH_HOOK, l2tp_seq::nr, l2tp_seq::ns, l2tp_seq::rack, l2tp_seq::rack_timer, l2tp_seq::rexmits, SEQ_LOCK_ASSERT, l2tp_seq::ssth, l2tp_seq::wmax, l2tp_seq::xack, l2tp_seq::xack_timer, and l2tp_seq::xwin.
Referenced by ng_l2tp_seq_adjust(), and ng_l2tp_shutdown().
|
static |
Definition at line 1205 of file ng_l2tp.c.
References priv::enabled, l2tp_seq::nr, ng_l2tp_seq_config::nr, l2tp_seq::ns, ng_l2tp_seq_config::ns, l2tp_seq::rack, ng_l2tp_seq_config::rack, l2tp_seq::xack, and ng_l2tp_seq_config::xack.
Referenced by ng_l2tp_rcvmsg().
|
static |
Definition at line 1407 of file ng_l2tp.c.
References ng_node::nd_vnet, ng_l2tp_xmit_ctrl(), NG_NODE_PRIVATE, l2tp_seq::ns, SEQ_LOCK_ASSERT, and l2tp_seq::xack_timer.
Referenced by ng_l2tp_rcvdata_lower().
|
static |
Definition at line 655 of file ng_l2tp.c.
References M_NETGRAPH_L2TP, l2tp_seq::mtx, ng_l2tp_seq_reset(), NG_NODE_PRIVATE, NG_NODE_UNREF, l2tp_seq::rack_timer, SEQ_LOCK, SEQ_UNLOCK, and l2tp_seq::xack_timer.
|
static |
Definition at line 1491 of file ng_l2tp.c.
References L2TP_CTRL_HDR, priv::lower, NG_SEND_DATA_ONLY, l2tp_seq::nr, l2tp_seq::ns, SEQ_LOCK_ASSERT, SEQ_UNLOCK, priv::stats, l2tp_seq::xack, and l2tp_seq::xack_timer.
Referenced by ng_l2tp_rcvdata_ctrl(), ng_l2tp_rcvdata_lower(), ng_l2tp_seq_rack_timeout(), ng_l2tp_seq_recv_nr(), and ng_l2tp_seq_xack_timeout().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 172 of file ng_l2tp.c.
Referenced by ng_l2tp_newhook().
|
static |
Definition at line 171 of file ng_l2tp.c.
Referenced by ng_l2tp_newhook().
|
static |
|
static |
Definition at line 190 of file ng_l2tp.c.
Referenced by ng_l2tp_seq_reset().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |