20 #include <vnet/devices/pci/ixgev.h> 21 #include <vnet/devices/pci/ixge.h> 22 #include <vnet/devices/pci/ige.h> 23 #include <vnet/devices/pci/vice.h> 35 #define foreach_l2t_ip6_error \ 36 _(USER_TO_NETWORK, "User (v6) to L2 network pkts") \ 37 _(SESSION_ID_MISMATCH, "l2tpv3 local session id mismatches") \ 38 _(COOKIE_MISMATCH, "l2tpv3 local cookie mismatches") 41 #define _(sym,string) string, 47 #define _(sym,str) L2T_IP6_ERROR_##sym, 89 l2tpv3_header_t * l2t;
106 l2t = (l2tpv3_header_t*)(ip6+1);
117 session_index = p[0];
139 l2tpv3_header_t * l2t;
143 u16 payload_ethertype;
144 u8 dst_mac_address[6];
145 u8 src_mac_address[6];
152 em->
counters[node_counter_base_index + L2T_IP6_ERROR_USER_TO_NETWORK] += 1;
173 b->
error = lm->ip6_error_node->
174 errors[L2T_IP6_ERROR_SESSION_ID_MISMATCH];
179 ((session->
cookie_flags & L2TP_COOKIE_ROLLOVER_LOCAL) &&
180 (l2t->cookie == session->lcl_ro_cookie))))) {
181 b->
error = lm->ip6_error_node->
182 errors[L2T_IP6_ERROR_COOKIE_MISMATCH];
196 payload_ethertype = l2_payload->
type;
199 #define _(i) dst_mac_address[i] = l2_payload->dst_address[i]; 200 _(0) _(1) _(2) _(3) _(4) _(5);
202 #define _(i) src_mac_address[i] = l2_payload->src_address[i]; 203 _(0) _(1) _(2) _(3) _(4) _(5);
211 #define _(i) l2_payload->dst_address[i] = dst_mac_address[i]; 212 _(0) _(1) _(2) _(3) _(4) _(5);
214 #define _(i) l2_payload->src_address[i] = src_mac_address[i]; 215 _(0) _(1) _(2) _(3) _(4) _(5);
218 l2_payload->
type = clib_host_to_net_u16 (0x8100);
219 vlan_header_pos = (
u8 *)(l2_payload+1);
222 vlan_header_pos : vlan_header_pos - 4;
226 vh->
type = payload_ethertype;
240 t->vlan_id_host_byte_order = clib_net_to_host_u16 (session->vlan_id);
243 return session->l2_output_next_index;
255 return dispatch_pipeline (vm, node, frame);
260 .name =
"ip6-l2t-input",
261 .vector_size =
sizeof (
u32),
283 if (
unformat (input,
"lookup-v6-src"))
285 else if (
unformat (input,
"lookup-v6-dst"))
287 else if (
unformat (input,
"lookup-session-id"))
317 vice_set_next_node (VICE_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
318 ixgev_set_next_node (IXGEV_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
319 ixge_set_next_node (IXGE_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
320 ige_set_next_node (IGE_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
ip6_address_t client_address
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vlib_node_registration_t l2t_ip6_node
uword * session_by_session_id
struct _vlib_node_registration vlib_node_registration_t
static u32 session_index_to_counter_index(u32 session_index, u32 counter_id)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define foreach_l2t_ip6_error
clib_error_t * l2t_ip6_init(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
static char * l2t_ip6_error_strings[]
#define VLIB_INIT_FUNCTION(x)
void dpdk_set_next_node(dpdk_rx_next_t, char *)
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define hash_create_mem(elts, key_bytes, value_bytes)
#define pool_elt_at_index(p, i)
vlib_error_main_t error_main
u8 * format_l2t_trace(u8 *s, va_list *args)
#define VLIB_CONFIG_FUNCTION(x, n,...)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
ip6_to_l2_lookup_t lookup_type
static void stage1(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
static void stage0(vlib_main_t *vm, vlib_node_runtime_t *node, u32 buffer_index)
ip6_address_t our_address
static clib_error_t * l2tp_config(vlib_main_t *vm, unformat_input_t *input)
#define CLIB_PREFETCH(addr, size, type)
static u32 last_stage(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
static vlib_node_registration_t sw6_ip6_node
(constructor) VLIB_REGISTER_NODE (sw6_ip6_node)
#define hash_create(elts, value_bytes)
static uword ip6_l2t_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
uword * session_by_dst_address
#define VLIB_BUFFER_IS_TRACED
vlib_combined_counter_main_t counter_main
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define hash_get_mem(h, key)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
always_inline vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
#define clib_error_return(e, args...)
uword * session_by_src_address
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
always_inline u32 counter_index(vlib_main_t *vm, vlib_error_t e)