26 #define foreach_l2t_decap_error \ 27 _(USER_TO_NETWORK, "L2TP user (ip6) to L2 network pkts") \ 28 _(SESSION_ID_MISMATCH, "l2tpv3 local session id mismatches") \ 29 _(COOKIE_MISMATCH, "l2tpv3 local cookie mismatches") \ 30 _(NO_SESSION, "l2tpv3 session not found") \ 31 _(ADMIN_DOWN, "l2tpv3 tunnel is down") 34 #define _(sym,string) string, 41 #define _(sym,str) L2T_DECAP_ERROR_##sym, 94 l2t = (l2tpv3_header_t *) (ip6 + 1);
108 session_index = p[0];
113 vnet_buffer (b)->l2t.session_index = session_index;
127 l2tpv3_header_t *l2tp;
141 em->
counters[node_counter_base_index + L2T_DECAP_ERROR_USER_TO_NETWORK] +=
144 session_index =
vnet_buffer (b)->l2t.session_index;
164 em->
counters[node_counter_base_index +
165 L2T_DECAP_ERROR_SESSION_ID_MISMATCH] += 1;
175 b->
error = node->
errors[L2T_DECAP_ERROR_COOKIE_MISMATCH];
185 b->
error = node->
errors[L2T_DECAP_ERROR_ADMIN_DOWN];
213 if (l2tp_decap_local)
215 b->
error = node->
errors[L2T_DECAP_ERROR_NO_SESSION];
245 return dispatch_pipeline (vm, node, frame);
257 .name =
"l2tp-decap",
258 .vector_size =
sizeof (
u32),
279 .name =
"l2tp-decap-local",
280 .vector_size =
sizeof (
u32),
ip6_address_t client_address
void ip6_register_protocol(u32 protocol, u32 node_index)
static u32 last_stage(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
uword * session_by_session_id
vlib_node_registration_t l2t_decap_node
(constructor) VLIB_REGISTER_NODE (l2t_decap_node)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static u32 session_index_to_counter_index(u32 session_index, u32 counter_id)
static char * l2t_decap_error_strings[]
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static void stage1(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_error_main_t error_main
u8 * format_l2t_trace(u8 *s, va_list *args)
uword os_get_cpu_number(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 node_index
Node index.
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
ip6_to_l2_lookup_t lookup_type
ip6_address_t our_address
#define CLIB_PREFETCH(addr, size, type)
static void stage0(vlib_main_t *vm, vlib_node_runtime_t *node, u32 buffer_index)
#define VLIB_BUFFER_IS_TRACED
vlib_node_registration_t l2t_decap_local_node
(constructor) VLIB_REGISTER_NODE (l2t_decap_local_node)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
#define foreach_l2t_decap_error
static uword l2t_decap_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
uword * session_by_dst_address
vlib_combined_counter_main_t counter_main
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void l2tp_decap_init(void)
#define hash_get_mem(h, key)
VLIB_NODE_FUNCTION_MULTIARCH(l2t_decap_node, l2t_decap_node_fn)
#define VLIB_REGISTER_NODE(x,...)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
uword * session_by_src_address
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.