FD.io VPP  v19.01.1-17-ge106252
Vector Packet Processing
l2_efp_filter.c
Go to the documentation of this file.
1 /*
2  * l2_efp_filter.c : layer 2 egress EFP Filter processing
3  *
4  * Copyright (c) 2013 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/vnet.h>
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/ethernet/packet.h>
22 #include <vnet/l2/feat_bitmap.h>
23 #include <vnet/l2/l2_output.h>
24 #include <vnet/ethernet/ethernet.h>
25 
26 #include <vppinfra/error.h>
27 #include <vppinfra/cache.h>
28 
29 /**
30  * @file
31  * @brief EFP-filter - Ethernet Flow Point Filter.
32  *
33  * It is possible to transmit a packet out a subinterface with VLAN tags
34  * that are not compatible with that subinterface. In other words, if that
35  * packet arrived on the output port, it would not be classified as coming
36  * from the output subinterface. This can happen in various ways: through
37  * misconfiguration, by putting subinterfaces with different VLAN encaps in
38  * the same bridge-domain, etc. The EFP Filter Check detects such packets
39  * and drops them. It consists of two checks, one that verifies the packet
40  * prior to output VLAN tag rewrite and one that verifies the packet after
41  * VLAN tag rewrite.
42  *
43  */
44 typedef struct
45 {
46  /* Next nodes for L2 output features */
47  u32 l2_out_feat_next[32];
48 
49  /* convenience variables */
53 
54 
55 typedef struct
56 {
57  /* per-pkt trace data */
58  u8 src[6];
59  u8 dst[6];
60  u8 raw[12]; /* raw data (vlans) */
63 
64 /* packet trace format function */
65 static u8 *
66 format_l2_efp_filter_trace (u8 * s, va_list * args)
67 {
68  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
69  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
70  l2_efp_filter_trace_t *t = va_arg (*args, l2_efp_filter_trace_t *);
71 
72  s = format (s, "l2-output-vtr: sw_if_index %d dst %U src %U data "
73  "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
74  t->sw_if_index,
77  t->raw[0], t->raw[1], t->raw[2], t->raw[3], t->raw[4],
78  t->raw[5], t->raw[6], t->raw[7], t->raw[8], t->raw[9],
79  t->raw[10], t->raw[11]);
80  return s;
81 }
82 
84 
86 
87 #define foreach_l2_efp_filter_error \
88 _(L2_EFP_FILTER, "L2 EFP filter packets") \
89 _(DROP, "L2 EFP filter post-rewrite drops")
90 
91 typedef enum
92 {
93 #define _(sym,str) L2_EFP_FILTER_ERROR_##sym,
95 #undef _
98 
99 static char *l2_efp_filter_error_strings[] = {
100 #define _(sym,string) string,
102 #undef _
103 };
104 
105 typedef enum
106 {
110 
111 
112 /**
113  * Extract fields from the packet that will be used in interface
114  * classification.
115  */
118  u32 sw_if_index0,
119  vlib_buffer_t * b0,
120  u32 * port_sw_if_index0,
121  u16 * first_ethertype0,
122  u16 * outer_id0, u16 * inner_id0, u32 * match_flags0)
123 {
124  ethernet_header_t *e0;
126  u32 tag_len;
127  u32 tag_num;
128 
129  *port_sw_if_index0 =
130  vnet_get_sup_sw_interface (vnet_main, sw_if_index0)->sw_if_index;
131 
132  e0 = vlib_buffer_get_current (b0);
133  h0 = (ethernet_vlan_header_t *) (e0 + 1);
134 
135  *first_ethertype0 = clib_net_to_host_u16 (e0->type);
136  *outer_id0 = clib_net_to_host_u16 (h0[0].priority_cfi_and_id);
137  *inner_id0 = clib_net_to_host_u16 (h0[1].priority_cfi_and_id);
138 
139  tag_len = vnet_buffer (b0)->l2.l2_len - sizeof (ethernet_header_t);
140  tag_num = tag_len / sizeof (ethernet_vlan_header_t);
141  *match_flags0 = eth_create_valid_subint_match_flags (tag_num);
142 }
143 
144 /*
145  * EFP filtering is a basic switch feature which prevents an interface from
146  * transmitting a packet that doesn't match the interface's ingress match
147  * criteria. The check has two parts, one performed before egress vlan tag
148  * rewrite and one after.
149  *
150  * The pre-rewrite check insures the packet matches what an ingress packet looks
151  * like after going through the interface's ingress tag rewrite operation. Only
152  * pushed tags are compared. So:
153  * - if the ingress vlan tag rewrite pushes no tags (or is not enabled),
154  * any packet passes the filter
155  * - if the ingress vlan tag rewrite pushes one tag,
156  * the packet must have at least one tag, and the outer tag must match the pushed tag
157  * - if the ingress vlan tag rewrite pushes two tags,
158  * the packet must have at least two tags, and the outer two tags must match the pushed tags
159  *
160  * The pre-rewrite check is performed in the l2-output node.
161  *
162  * The post-rewrite check insures the packet matches what an ingress packet looks
163  * like before going through the interface's ingress tag rewrite operation. It verifies
164  * that such a packet arriving on the wire at this port would be classified as arriving
165  * an input interface equal to the packet's output interface. This can be done by running
166  * the output packet's vlan tags and output port through the interface classification,
167  * and checking if the resulting interface matches the output interface.
168  *
169  * The post-rewrite check is performed here.
170  */
171 
172 static uword
174  vlib_node_runtime_t * node, vlib_frame_t * frame)
175 {
176  u32 n_left_from, *from, *to_next;
177  l2_efp_filter_next_t next_index;
180  u32 node_counter_base_index = n->error_heap_index;
181  vlib_error_main_t *em = &vm->error_main;
182 
183  from = vlib_frame_vector_args (frame);
184  n_left_from = frame->n_vectors; /* number of packets to process */
185  next_index = node->cached_next_index;
186 
187  while (n_left_from > 0)
188  {
189  u32 n_left_to_next;
190 
191  /* get space to enqueue frame to graph node "next_index" */
192  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
193 
194  while (n_left_from >= 6 && n_left_to_next >= 2)
195  {
196  u32 bi0, bi1;
197  vlib_buffer_t *b0, *b1;
198  u32 next0, next1;
199  u32 sw_if_index0, sw_if_index1;
200  u16 first_ethertype0, first_ethertype1;
201  u16 outer_id0, inner_id0, outer_id1, inner_id1;
202  u32 match_flags0, match_flags1;
203  u32 port_sw_if_index0, subint_sw_if_index0, port_sw_if_index1,
204  subint_sw_if_index1;
205  vnet_hw_interface_t *hi0, *hi1;
206  main_intf_t *main_intf0, *main_intf1;
207  vlan_intf_t *vlan_intf0, *vlan_intf1;
208  qinq_intf_t *qinq_intf0, *qinq_intf1;
209  u32 is_l20, is_l21;
210  __attribute__ ((unused)) u32 matched0, matched1;
211  u8 error0, error1;
212 
213  /* Prefetch next iteration. */
214  {
215  vlib_buffer_t *p2, *p3, *p4, *p5;
216  __attribute__ ((unused)) u32 sw_if_index2, sw_if_index3;
217 
218  p2 = vlib_get_buffer (vm, from[2]);
219  p3 = vlib_get_buffer (vm, from[3]);
220  p4 = vlib_get_buffer (vm, from[4]);
221  p5 = vlib_get_buffer (vm, from[5]);
222 
223  /* Prefetch the buffer header and packet for the N+2 loop iteration */
224  vlib_prefetch_buffer_header (p4, LOAD);
225  vlib_prefetch_buffer_header (p5, LOAD);
226 
229 
230  /*
231  * Prefetch the input config for the N+1 loop iteration
232  * This depends on the buffer header above
233  */
234  sw_if_index2 = vnet_buffer (p2)->sw_if_index[VLIB_TX];
235  sw_if_index3 = vnet_buffer (p3)->sw_if_index[VLIB_TX];
236  /*
237  * $$$ TODO
238  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index2), CLIB_CACHE_LINE_BYTES, LOAD);
239  * CLIB_PREFETCH (vec_elt_at_index(l2output_main.configs, sw_if_index3), CLIB_CACHE_LINE_BYTES, LOAD);
240  */
241  }
242 
243  /* speculatively enqueue b0 and b1 to the current next frame */
244  /* bi is "buffer index", b is pointer to the buffer */
245  to_next[0] = bi0 = from[0];
246  to_next[1] = bi1 = from[1];
247  from += 2;
248  to_next += 2;
249  n_left_from -= 2;
250  n_left_to_next -= 2;
251 
252  b0 = vlib_get_buffer (vm, bi0);
253  b1 = vlib_get_buffer (vm, bi1);
254 
255  /* TX interface handles */
256  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
257  sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
258 
259  /* process 2 packets */
260  em->counters[node_counter_base_index +
261  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
262 
263  /* Determine next node */
264  next0 = vnet_l2_feature_next (b0, msm->l2_out_feat_next,
265  L2OUTPUT_FEAT_EFP_FILTER);
266  next1 = vnet_l2_feature_next (b1, msm->l2_out_feat_next,
267  L2OUTPUT_FEAT_EFP_FILTER);
268 
269  /* perform the efp filter check on two packets */
270 
271  extract_keys (msm->vnet_main,
272  sw_if_index0,
273  b0,
274  &port_sw_if_index0,
275  &first_ethertype0,
276  &outer_id0, &inner_id0, &match_flags0);
277 
278  extract_keys (msm->vnet_main,
279  sw_if_index1,
280  b1,
281  &port_sw_if_index1,
282  &first_ethertype1,
283  &outer_id1, &inner_id1, &match_flags1);
284 
286  msm->vnet_main,
287  port_sw_if_index0,
288  first_ethertype0,
289  outer_id0,
290  inner_id0,
291  &hi0,
292  &main_intf0, &vlan_intf0, &qinq_intf0);
293 
295  msm->vnet_main,
296  port_sw_if_index1,
297  first_ethertype1,
298  outer_id1,
299  inner_id1,
300  &hi1,
301  &main_intf1, &vlan_intf1, &qinq_intf1);
302 
303  matched0 = eth_identify_subint (hi0,
304  match_flags0,
305  main_intf0,
306  vlan_intf0,
307  qinq_intf0,
308  &subint_sw_if_index0,
309  &error0, &is_l20);
310 
311  matched1 = eth_identify_subint (hi1,
312  match_flags1,
313  main_intf1,
314  vlan_intf1,
315  qinq_intf1,
316  &subint_sw_if_index1,
317  &error1, &is_l21);
318 
319  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
320  {
321  /* Drop packet */
322  next0 = L2_EFP_FILTER_NEXT_DROP;
323  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
324  }
325 
326  if (PREDICT_FALSE (sw_if_index1 != subint_sw_if_index1))
327  {
328  /* Drop packet */
329  next1 = L2_EFP_FILTER_NEXT_DROP;
330  b1->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
331  }
332 
333  if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
334  {
335  if (b0->flags & VLIB_BUFFER_IS_TRACED)
336  {
339  vlib_add_trace (vm, node, b0, sizeof (*t));
340  t->sw_if_index = sw_if_index0;
341  clib_memcpy_fast (t->src, h0->src_address, 6);
342  clib_memcpy_fast (t->dst, h0->dst_address, 6);
343  clib_memcpy_fast (t->raw, &h0->type, sizeof (t->raw));
344  }
345  if (b1->flags & VLIB_BUFFER_IS_TRACED)
346  {
349  vlib_add_trace (vm, node, b1, sizeof (*t));
350  t->sw_if_index = sw_if_index1;
351  clib_memcpy_fast (t->src, h1->src_address, 6);
352  clib_memcpy_fast (t->dst, h1->dst_address, 6);
353  clib_memcpy_fast (t->raw, &h1->type, sizeof (t->raw));
354  }
355  }
356 
357  /* verify speculative enqueues, maybe switch current next frame */
358  /* if next0==next1==next_index then nothing special needs to be done */
359  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
360  to_next, n_left_to_next,
361  bi0, bi1, next0, next1);
362  }
363 
364  while (n_left_from > 0 && n_left_to_next > 0)
365  {
366  u32 bi0;
367  vlib_buffer_t *b0;
368  u32 next0;
369  u32 sw_if_index0;
370  u16 first_ethertype0;
371  u16 outer_id0, inner_id0;
372  u32 match_flags0;
373  u32 port_sw_if_index0, subint_sw_if_index0;
374  vnet_hw_interface_t *hi0;
375  main_intf_t *main_intf0;
376  vlan_intf_t *vlan_intf0;
377  qinq_intf_t *qinq_intf0;
378  u32 is_l20;
379  __attribute__ ((unused)) u32 matched0;
380  u8 error0;
381 
382  /* speculatively enqueue b0 to the current next frame */
383  bi0 = from[0];
384  to_next[0] = bi0;
385  from += 1;
386  to_next += 1;
387  n_left_from -= 1;
388  n_left_to_next -= 1;
389 
390  b0 = vlib_get_buffer (vm, bi0);
391  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
392 
393  /* process 1 packet */
394  em->counters[node_counter_base_index +
395  L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
396 
397  /* Determine next node */
398  next0 = vnet_l2_feature_next (b0, msm->l2_out_feat_next,
399  L2OUTPUT_FEAT_EFP_FILTER);
400 
401  /* perform the efp filter check on one packet */
402 
403  extract_keys (msm->vnet_main,
404  sw_if_index0,
405  b0,
406  &port_sw_if_index0,
407  &first_ethertype0,
408  &outer_id0, &inner_id0, &match_flags0);
409 
411  msm->vnet_main,
412  port_sw_if_index0,
413  first_ethertype0,
414  outer_id0,
415  inner_id0,
416  &hi0,
417  &main_intf0, &vlan_intf0, &qinq_intf0);
418 
419  matched0 = eth_identify_subint (hi0,
420  match_flags0,
421  main_intf0,
422  vlan_intf0,
423  qinq_intf0,
424  &subint_sw_if_index0,
425  &error0, &is_l20);
426 
427  if (PREDICT_FALSE (sw_if_index0 != subint_sw_if_index0))
428  {
429  /* Drop packet */
430  next0 = L2_EFP_FILTER_NEXT_DROP;
431  b0->error = node->errors[L2_EFP_FILTER_ERROR_DROP];
432  }
433 
435  && (b0->flags & VLIB_BUFFER_IS_TRACED)))
436  {
439  vlib_add_trace (vm, node, b0, sizeof (*t));
440  t->sw_if_index = sw_if_index0;
441  clib_memcpy_fast (t->src, h0->src_address, 6);
442  clib_memcpy_fast (t->dst, h0->dst_address, 6);
443  clib_memcpy_fast (t->raw, &h0->type, sizeof (t->raw));
444  }
445 
446  /* verify speculative enqueue, maybe switch current next frame */
447  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
448  to_next, n_left_to_next,
449  bi0, next0);
450  }
451 
452  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
453  }
454 
455  return frame->n_vectors;
456 }
457 
458 
459 /* *INDENT-OFF* */
461  .function = l2_efp_filter_node_fn,
462  .name = "l2-efp-filter",
463  .vector_size = sizeof (u32),
464  .format_trace = format_l2_efp_filter_trace,
465  .type = VLIB_NODE_TYPE_INTERNAL,
466 
468  .error_strings = l2_efp_filter_error_strings,
469 
470  .n_next_nodes = L2_EFP_FILTER_N_NEXT,
471 
472  /* edit / add dispositions here */
473  .next_nodes = {
474  [L2_EFP_FILTER_NEXT_DROP] = "error-drop",
475  },
476 };
477 /* *INDENT-ON* */
478 
481 {
483 
484  mp->vlib_main = vm;
485  mp->vnet_main = vnet_get_main ();
486 
487  /* Initialize the feature next-node indexes */
489  l2_efp_filter_node.index,
492  mp->l2_out_feat_next);
493 
494  return 0;
495 }
496 
498 
499 
500 /** Enable/disable the EFP Filter check on the subinterface. */
501 void
503 {
504  /* set the interface flag */
505  l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_EFP_FILTER, enable);
506 }
507 
508 
509 /**
510  * Set subinterface egress efp filter enable/disable.
511  * The CLI format is:
512  * set interface l2 efp-filter <interface> [disable]]
513  */
514 static clib_error_t *
516  unformat_input_t * input, vlib_cli_command_t * cmd)
517 {
518  vnet_main_t *vnm = vnet_get_main ();
519  clib_error_t *error = 0;
521  u32 enable;
522 
523  if (!unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
524  {
525  error = clib_error_return (0, "unknown interface `%U'",
526  format_unformat_error, input);
527  goto done;
528  }
529 
530  enable = 1;
531  if (unformat (input, "disable"))
532  {
533  enable = 0;
534  }
535 
536  /* enable/disable the feature */
537  l2_efp_filter_configure (vnm, sw_if_index, enable);
538 
539 done:
540  return error;
541 }
542 
543 
544 /*?
545  * EFP filtering is a basic switch feature which prevents an interface from
546  * transmitting a packet that doesn't match the interface's ingress match
547  * criteria. The check has two parts, one performed before egress vlan tag
548  * rewrite and one after. This command enables or disables the EFP filtering
549  * for a given sub-interface.
550  *
551  * @cliexpar
552  * Example of how to enable a Layer 2 efp-filter on a sub-interface:
553  * @cliexcmd{set interface l2 efp-filter GigabitEthernet0/8/0.200}
554  * Example of how to disable a Layer 2 efp-filter on a sub-interface:
555  * @cliexcmd{set interface l2 efp-filter GigabitEthernet0/8/0.200 disable}
556 ?*/
557 /* *INDENT-OFF* */
558 VLIB_CLI_COMMAND (int_l2_efp_filter_cli, static) = {
559  .path = "set interface l2 efp-filter",
560  .short_help = "set interface l2 efp-filter <interface> [disable]",
561  .function = int_l2_efp_filter,
562 };
563 /* *INDENT-ON* */
564 
565 
566 /*
567  * fd.io coding-style-patch-verification: ON
568  *
569  * Local Variables:
570  * eval: (c-set-style "gnu")
571  * End:
572  */
u32 error_heap_index
Definition: node.h:348
vl_api_address_t src
Definition: vxlan_gbp.api:32
#define CLIB_UNUSED(x)
Definition: clib.h:82
char ** l2output_get_feat_names(void)
Definition: l2_output.c:39
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
#define clib_memcpy_fast(a, b, c)
Definition: string.h:81
u8 src_address[6]
Definition: packet.h:56
l2_efp_filter_next_t
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:983
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
unformat_function_t unformat_vnet_sw_interface
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:494
unsigned char u8
Definition: types.h:56
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
Definition: feat_bitmap.h:94
static u8 * format_l2_efp_filter_trace(u8 *s, va_list *args)
Definition: l2_efp_filter.c:66
ethernet_main_t ethernet_main
Definition: init.c:45
#define static_always_inline
Definition: clib.h:99
u8 * format_ethernet_address(u8 *s, va_list *args)
Definition: format.c:44
#define foreach_l2_efp_filter_error
Definition: l2_efp_filter.c:87
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
u32 sw_if_index
Definition: vxlan_gbp.api:37
u8 dst_address[6]
Definition: packet.h:55
static vlib_node_registration_t l2_efp_filter_node
(constructor) VLIB_REGISTER_NODE (l2_efp_filter_node)
Definition: l2_efp_filter.c:85
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:188
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_error_return(e, args...)
Definition: error.h:99
static_always_inline void extract_keys(vnet_main_t *vnet_main, u32 sw_if_index0, vlib_buffer_t *b0, u32 *port_sw_if_index0, u16 *first_ethertype0, u16 *outer_id0, u16 *inner_id0, u32 *match_flags0)
Extract fields from the packet that will be used in interface classification.
l2_efp_filter_error_t
Definition: l2_efp_filter.c:91
unsigned int u32
Definition: types.h:88
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
Definition: node.h:223
clib_error_t * l2_efp_filter_init(vlib_main_t *vm)
vlib_error_main_t error_main
Definition: main.h:143
struct _unformat_input_t unformat_input_t
unsigned short u16
Definition: types.h:57
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:214
#define PREDICT_FALSE(x)
Definition: clib.h:111
vnet_main_t vnet_main
Definition: misc.c:43
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
Definition: buffer_node.h:70
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:218
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:368
vnet_main_t * vnet_main
Definition: l2_efp_filter.c:51
void l2output_intf_bitmap_enable(u32 sw_if_index, l2output_feat_masks_t feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
Definition: l2_output.c:626
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:139
u64 * counters
Definition: error.h:78
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:420
static char * l2_efp_filter_error_strings[]
Definition: l2_efp_filter.c:99
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:79
vlib_main_t * vm
Definition: buffer.c:301
vl_api_address_t dst
Definition: vxlan_gbp.api:33
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
Definition: feat_bitmap.h:43
static u32 eth_create_valid_subint_match_flags(u32 num_tags)
Definition: ethernet.h:238
static u32 eth_identify_subint(vnet_hw_interface_t *hi, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
Definition: ethernet.h:519
#define ARRAY_LEN(x)
Definition: clib.h:62
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:459
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
static void eth_vlan_table_lookups(ethernet_main_t *em, vnet_main_t *vnm, u32 port_sw_if_index0, u16 first_ethertype, u16 outer_id, u16 inner_id, vnet_hw_interface_t **hi, main_intf_t **main_intf, vlan_intf_t **vlan_intf, qinq_intf_t **qinq_intf)
Definition: ethernet.h:480
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:538
vlib_main_t * vlib_main
Definition: l2_efp_filter.c:50
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:57
struct _vlib_node_registration vlib_node_registration_t
Definition: defs.h:47
static uword l2_efp_filter_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u8 enable)
Enable/disable the EFP Filter check on the subinterface.
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:274
static clib_error_t * int_l2_efp_filter(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface egress efp filter enable/disable.
#define vnet_buffer(b)
Definition: buffer.h:368
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
l2_efp_filter_main_t l2_efp_filter_main
Definition: l2_efp_filter.c:83
u8 data[0]
Packet data.
Definition: buffer.h:176
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
Definition: node_funcs.h:59
u16 flags
Copy of main node flags.
Definition: node.h:532
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:326
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:117
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:62
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972