FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
ip4_punt_drop.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/ip/ip.h>
17 #include <vnet/ip/ip_punt_drop.h>
18 #include <vnet/policer/policer.h>
20 
21 /* *INDENT-OFF* */
23 {
24  .arc_name = "ip4-punt",
25  .start_nodes = VNET_FEATURES ("ip4-punt"),
26 };
27 
28 VNET_FEATURE_ARC_INIT (ip4_drop) =
29 {
30  .arc_name = "ip4-drop",
31  .start_nodes = VNET_FEATURES ("ip4-drop", "ip4-not-enabled"),
32 };
33 /* *INDENT-ON* */
34 
38 
39 #ifndef CLIB_MARCH_VARIANT
40 u8 *
41 format_ip_punt_policer_trace (u8 * s, va_list * args)
42 {
43  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
44  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
45  ip_punt_policer_trace_t *t = va_arg (*args, ip_punt_policer_trace_t *);
46 
47  s = format (s, "policer_index %d next %d", t->policer_index, t->next);
48  return s;
49 }
50 
51 ip_punt_policer_t ip4_punt_policer_cfg = {
52  .policer_index = ~0,
53 };
54 #endif /* CLIB_MARCH_VARIANT */
55 
57 #define _(sym,string) string,
59 #undef _
60 };
61 
63  vlib_node_runtime_t * node,
64  vlib_frame_t * frame)
65 {
66  return (ip_punt_policer (vm, node, frame,
67  vnet_feat_arc_ip4_punt.feature_arc_index,
68  ip4_punt_policer_cfg.policer_index));
69 }
70 
71 /* *INDENT-OFF* */
73  .name = "ip4-punt-policer",
74  .vector_size = sizeof (u32),
75  .n_next_nodes = IP_PUNT_POLICER_N_NEXT,
76  .format_trace = format_ip_punt_policer_trace,
78  .error_strings = ip4_punt_policer_error_strings,
79 
80  .next_nodes = {
81  [IP_PUNT_POLICER_NEXT_DROP] = "ip4-drop",
82  },
83 };
84 
86  .arc_name = "ip4-punt",
87  .node_name = "ip4-punt-policer",
88  .runs_before = VNET_FEATURES("ip4-punt-redirect"),
89 };
90 /* *INDENT-ON* */
91 
92 #ifndef CLIB_MARCH_VARIANT
93 u8 *
94 format_ip_punt_redirect_trace (u8 * s, va_list * args)
95 {
96  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
97  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
99  vnet_main_t *vnm = vnet_get_main ();
101 
103 
104  if (NULL != si)
105  s = format (s, "via %U on %U using adj:%d",
108  t->redirect.adj_index);
109  else
110  s = format (s, "via %U on %d using adj:%d",
113 
114  return s;
115 }
116 
117 /* *INDENT-OFF* */
118 ip_punt_redirect_t ip4_punt_redirect_cfg = {
119  .any_rx_sw_if_index = {
120  .tx_sw_if_index = ~0,
121  .adj_index = ADJ_INDEX_INVALID,
122  },
123 };
124 /* *INDENT-ON* */
125 #endif /* CLIB_MARCH_VARIANT */
126 
127 
128 #define foreach_ip4_punt_redirect_error \
129 _(DROP, "ip4 punt redirect drop")
130 
131 typedef enum
132 {
133 #define _(sym,str) IP4_PUNT_REDIRECT_ERROR_##sym,
135 #undef _
138 
140 #define _(sym,string) string,
142 #undef _
143 };
144 
146  vlib_node_runtime_t * node,
147  vlib_frame_t * frame)
148 {
149  return (ip_punt_redirect (vm, node, frame,
150  vnet_feat_arc_ip4_punt.feature_arc_index,
151  &ip4_punt_redirect_cfg));
152 }
153 
154 /* *INDENT-OFF* */
156  .name = "ip4-punt-redirect",
157  .vector_size = sizeof (u32),
158  .n_next_nodes = IP_PUNT_REDIRECT_N_NEXT,
159  .format_trace = format_ip_punt_redirect_trace,
161  .error_strings = ip4_punt_redirect_error_strings,
162 
163  /* edit / add dispositions here */
164  .next_nodes = {
165  [IP_PUNT_REDIRECT_NEXT_DROP] = "ip4-drop",
166  [IP_PUNT_REDIRECT_NEXT_TX] = "ip4-rewrite",
167  [IP_PUNT_REDIRECT_NEXT_ARP] = "ip4-arp",
168  },
169 };
170 
172  .arc_name = "ip4-punt",
173  .node_name = "ip4-punt-redirect",
174  .runs_before = VNET_FEATURES("error-punt"),
175 };
176 /* *INDENT-ON* */
177 
179  vlib_frame_t * frame)
180 {
181  if (node->flags & VLIB_NODE_FLAG_TRACE)
182  ip4_forward_next_trace (vm, node, frame, VLIB_TX);
183 
184  return ip_drop_or_punt (vm, node, frame,
185  vnet_feat_arc_ip4_drop.feature_arc_index);
186 
187 }
188 
190  vlib_node_runtime_t * node,
191  vlib_frame_t * frame)
192 {
193  if (node->flags & VLIB_NODE_FLAG_TRACE)
194  ip4_forward_next_trace (vm, node, frame, VLIB_TX);
195 
196  return ip_drop_or_punt (vm, node, frame,
197  vnet_feat_arc_ip4_drop.feature_arc_index);
198 }
199 
200 static uword
202 {
203  if (node->flags & VLIB_NODE_FLAG_TRACE)
204  ip4_forward_next_trace (vm, node, frame, VLIB_TX);
205 
206  return ip_drop_or_punt (vm, node, frame,
207  vnet_feat_arc_ip4_punt.feature_arc_index);
208 }
209 
210 /* *INDENT-OFF* */
212 {
213  .name = "ip4-drop",
214  .vector_size = sizeof (u32),
215  .format_trace = format_ip4_forward_next_trace,
216  .n_next_nodes = 1,
217  .next_nodes = {
218  [0] = "error-drop",
219  },
220 };
221 
223 {
224  .name = "ip4-not-enabled",
225  .vector_size = sizeof (u32),
226  .format_trace = format_ip4_forward_next_trace,
227  .n_next_nodes = 1,
228  .next_nodes = {
229  [0] = "error-drop",
230  },
231 };
232 
234 {
235  .function = ip4_punt,
236  .name = "ip4-punt",
237  .vector_size = sizeof (u32),
238  .format_trace = format_ip4_forward_next_trace,
239  .n_next_nodes = 1,
240  .next_nodes = {
241  [0] = "error-punt",
242  },
243 };
244 
245 VNET_FEATURE_INIT (ip4_punt_end_of_arc, static) = {
246  .arc_name = "ip4-punt",
247  .node_name = "error-punt",
248  .runs_before = 0, /* not before any other features */
249 };
250 
251 VNET_FEATURE_INIT (ip4_drop_end_of_arc, static) = {
252  .arc_name = "ip4-drop",
253  .node_name = "error-drop",
254  .runs_before = 0, /* not before any other features */
255 };
256 /* *INDENT-ON */
257 
258 #ifndef CLIB_MARCH_VARIANT
259 void
261 {
262  ip4_punt_policer_cfg.policer_index = policer_index;
263 
264  vnet_feature_enable_disable ("ip4-punt", "ip4-punt-policer",
265  0, is_add, 0, 0);
266 }
267 #endif /* CLIB_MARCH_VARIANT */
268 
269 static clib_error_t *
271  unformat_input_t * main_input,
272  vlib_cli_command_t * cmd)
273 {
274  unformat_input_t _line_input, *line_input = &_line_input;
275  clib_error_t *error = 0;
276  u32 policer_index;
277  u8 is_add = 1;
278 
279  policer_index = ~0;
280 
281  if (!unformat_user (main_input, unformat_line_input, line_input))
282  return 0;
283 
284  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
285  {
286  if (unformat (line_input, "%d", &policer_index))
287  ;
288  else if (unformat (line_input, "del"))
289  is_add = 0;
290  else if (unformat (line_input, "add"))
291  is_add = 1;
292  else
293  {
294  error = unformat_parse_error (line_input);
295  goto done;
296  }
297  }
298 
299  if (is_add && ~0 == policer_index)
300  {
301  error = clib_error_return (0, "expected policer index `%U'",
302  format_unformat_error, line_input);
303  goto done;
304  }
305  if (!is_add)
306  policer_index = ~0;
307 
308  ip4_punt_policer_add_del(is_add, policer_index);
309 
310 done:
311  unformat_free (line_input);
312  return (error);
313 }
314 
315 /*?
316  *
317  * @cliexpar
318  * @cliexcmd{set ip punt policer <INDEX>}
319  ?*/
320 /* *INDENT-OFF* */
321 VLIB_CLI_COMMAND (ip4_punt_policer_command, static) =
322 {
323  .path = "ip punt policer",
324  .function = ip4_punt_police_cmd,
325  .short_help = "ip punt policer [add|del] <index>",
326 };
327 /* *INDENT-ON* */
328 
329 #ifndef CLIB_MARCH_VARIANT
330 /*
331  * an uninitalised rx-redirect strcut used to pad the vector
332  */
333 ip_punt_redirect_rx_t uninit_rx_redirect = {
334  .tx_sw_if_index = ~0,
335  .adj_index = ADJ_INDEX_INVALID,
336 };
337 
338 void
340  u32 rx_sw_if_index,
341  ip_punt_redirect_rx_t * redirect,
342  fib_protocol_t fproto, vnet_link_t linkt)
343 {
345 
346  if (~0 == rx_sw_if_index)
347  {
348  cfg->any_rx_sw_if_index = *redirect;
349  new = &cfg->any_rx_sw_if_index;
350  }
351  else
352  {
354  rx_sw_if_index, uninit_rx_redirect);
355  cfg->redirect_by_rx_sw_if_index[rx_sw_if_index] = *redirect;
356  new = &cfg->redirect_by_rx_sw_if_index[rx_sw_if_index];
357  }
358 
359  new->adj_index = adj_nbr_add_or_lock (fproto, linkt,
360  &redirect->nh,
361  redirect->tx_sw_if_index);
362 }
363 
364 void
366 {
368 
369  if (~0 == rx_sw_if_index)
370  {
371  old = &cfg->any_rx_sw_if_index;
372  }
373  else
374  {
375  old = &cfg->redirect_by_rx_sw_if_index[rx_sw_if_index];
376  }
377 
378  if ((old == NULL) || (old->adj_index == ADJ_INDEX_INVALID))
379  return;
380 
381  adj_unlock (old->adj_index);
382  *old = uninit_rx_redirect;
383 }
384 
385 void
386 ip4_punt_redirect_add (u32 rx_sw_if_index,
387  u32 tx_sw_if_index, ip46_address_t * nh)
388 {
389  ip_punt_redirect_rx_t rx = {
390  .tx_sw_if_index = tx_sw_if_index,
391  .nh = *nh,
392  };
393 
394  ip_punt_redirect_add (&ip4_punt_redirect_cfg,
395  rx_sw_if_index, &rx, FIB_PROTOCOL_IP4, VNET_LINK_IP4);
396 
397  vnet_feature_enable_disable ("ip4-punt", "ip4-punt-redirect", 0, 1, 0, 0);
398 }
399 
400 void
401 ip4_punt_redirect_del (u32 rx_sw_if_index)
402 {
403  vnet_feature_enable_disable ("ip4-punt", "ip4-punt-redirect", 0, 0, 0, 0);
404 
405  ip_punt_redirect_del (&ip4_punt_redirect_cfg, rx_sw_if_index);
406 }
407 #endif /* CLIB_MARCH_VARIANT */
408 
409 static clib_error_t *
411  unformat_input_t * main_input,
412  vlib_cli_command_t * cmd)
413 {
414  unformat_input_t _line_input, *line_input = &_line_input;
415  ip46_address_t nh = ip46_address_initializer;
416  clib_error_t *error = 0;
417  u32 rx_sw_if_index = 0;
418  u32 tx_sw_if_index = 0;
419  vnet_main_t *vnm;
420  u8 is_add;
421 
422  is_add = 1;
423  vnm = vnet_get_main ();
424 
425  if (!unformat_user (main_input, unformat_line_input, line_input))
426  return 0;
427 
428  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
429  {
430  if (unformat (line_input, "del"))
431  is_add = 0;
432  else if (unformat (line_input, "add"))
433  is_add = 1;
434  else if (unformat (line_input, "rx all"))
435  rx_sw_if_index = ~0;
436  else if (unformat (line_input, "rx %U",
437  unformat_vnet_sw_interface, vnm, &rx_sw_if_index))
438  ;
439  else if (unformat (line_input, "via %U %U",
441  &nh.ip4,
442  unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
443  ;
444  else if (unformat (line_input, "via %U",
445  unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
446  clib_memset (&nh, 0, sizeof (nh));
447  else
448  {
449  error = unformat_parse_error (line_input);
450  goto done;
451  }
452  }
453 
454  if (is_add)
455  {
456  if (rx_sw_if_index && tx_sw_if_index)
457  {
458  ip4_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh);
459  }
460  }
461  else
462  {
463  if (rx_sw_if_index)
464  {
465  ip4_punt_redirect_del (rx_sw_if_index);
466  }
467  }
468 
469 done:
470  unformat_free (line_input);
471  return (error);
472 }
473 
474 /*?
475  *
476  * @cliexpar
477  * @cliexcmd{set ip punt policer}
478  ?*/
479 /* *INDENT-OFF* */
480 VLIB_CLI_COMMAND (ip4_punt_redirect_command, static) =
481 {
482  .path = "ip punt redirect",
483  .function = ip4_punt_redirect_cmd,
484  .short_help = "ip punt redirect [add|del] rx [<interface>|all] via [<nh>] <tx_interface>",
485 };
486 /* *INDENT-ON* */
487 
488 #ifndef CLIB_MARCH_VARIANT
489 u8 *
490 format_ip_punt_redirect (u8 * s, va_list * args)
491 {
492  ip_punt_redirect_t *cfg = va_arg (*args, ip_punt_redirect_t *);
494  u32 rx_sw_if_index;
495  vnet_main_t *vnm = vnet_get_main ();
496 
497  vec_foreach_index (rx_sw_if_index, cfg->redirect_by_rx_sw_if_index)
498  {
499  rx = &cfg->redirect_by_rx_sw_if_index[rx_sw_if_index];
500  if (~0 != rx->tx_sw_if_index)
501  {
502  s = format (s, " rx %U redirect via %U %U\n",
504  vnet_get_sw_interface (vnm, rx_sw_if_index),
508  }
509  }
510  if (~0 != cfg->any_rx_sw_if_index.tx_sw_if_index)
511  {
512  s = format (s, " rx all redirect via %U %U\n",
516  cfg->
517  any_rx_sw_if_index.tx_sw_if_index));
518  }
519 
520  return (s);
521 }
522 
525 {
527  ip_punt_redirect_detail_t *prs = 0;
528  u32 rx_sw_if_index;
529 
530  vec_foreach_index (rx_sw_if_index,
531  ip4_punt_redirect_cfg.redirect_by_rx_sw_if_index)
532  {
533  if (sw_if_index == ~0 || sw_if_index == rx_sw_if_index)
534  {
535  pr =
536  &ip4_punt_redirect_cfg.redirect_by_rx_sw_if_index[rx_sw_if_index];
537  if (~0 != pr->tx_sw_if_index)
538  {
540  rx_sw_if_index,
541  .punt_redirect = *pr
542  };
543  vec_add1 (prs, detail);
544  }
545  }
546  }
547  if (~0 != ip4_punt_redirect_cfg.any_rx_sw_if_index.tx_sw_if_index)
548  {
549  pr = &ip4_punt_redirect_cfg.any_rx_sw_if_index;
551  .punt_redirect = *pr
552  };
553  vec_add1 (prs, detail);
554  }
555 
556  return prs;
557 }
558 #endif /* CLIB_MARCH_VARIANT */
559 
560 static clib_error_t *
562  unformat_input_t * main_input,
563  vlib_cli_command_t * cmd)
564 {
565  vlib_cli_output (vm, "%U", format_ip_punt_redirect, &ip4_punt_redirect_cfg);
566 
567  return (NULL);
568 }
569 
570 /*?
571  *
572  * @cliexpar
573  * @cliexcmd{set ip punt redierect}
574  ?*/
575 /* *INDENT-OFF* */
576 VLIB_CLI_COMMAND (show_ip4_punt_redirect_command, static) =
577 {
578  .path = "show ip punt redirect",
579  .function = ip4_punt_redirect_show_cmd,
580  .short_help = "show ip punt redirect",
581  .is_mp_safe = 1,
582 };
583 /* *INDENT-ON* */
584 
585 /*
586  * fd.io coding-style-patch-verification: ON
587  *
588  * Local Variables:
589  * eval: (c-set-style "gnu")
590  * End:
591  */
u32 sw_if_index
Definition: ipsec_gre.api:37
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define CLIB_UNUSED(x)
Definition: clib.h:82
static clib_error_t * ip4_punt_redirect_show_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
ip4_punt_redirect_error_t
vlib_node_registration_t ip4_drop_node
(constructor) VLIB_REGISTER_NODE (ip4_drop_node)
#define NULL
Definition: clib.h:58
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
ip_punt_redirect_rx_t uninit_rx_redirect
ip_punt_redirect_detail_t * ip4_punt_redirect_entries(u32 sw_if_index)
ip_punt_redirect_rx_t * redirect_by_rx_sw_if_index
per-RX interface configuration
Definition: ip_punt_drop.h:225
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
static uword ip_drop_or_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index)
Definition: ip_punt_drop.h:382
void ip_punt_redirect_del(ip_punt_redirect_t *cfg, u32 rx_sw_if_index)
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:983
format_function_t format_ip46_address
Definition: format.h:61
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
unformat_function_t unformat_vnet_sw_interface
#define VLIB_NODE_FN(node)
Definition: node.h:201
void ip4_punt_policer_add_del(u8 is_add, u32 policer_index)
unsigned char u8
Definition: types.h:56
#define foreach_ip4_punt_redirect_error
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * format_ip_punt_redirect_trace(u8 *s, va_list *args)
Definition: ip4_punt_drop.c:94
ip_punt_redirect_t ip4_punt_redirect_cfg
unformat_function_t unformat_ip4_address
Definition: format.h:70
vlib_node_registration_t ip4_punt_policer_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_policer_node)
Definition: ip4_punt_drop.c:72
vlib_node_registration_t ip4_not_enabled_node
(constructor) VLIB_REGISTER_NODE (ip4_not_enabled_node)
ip_punt_policer_t ip4_punt_policer_cfg
Definition: ip4_punt_drop.c:51
#define clib_error_return(e, args...)
Definition: error.h:99
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:318
ip46_address_t nh
The next-hop to send redirected packets to.
Definition: ip_punt_drop.h:199
unsigned int u32
Definition: types.h:88
#define foreach_ip_punt_policer_error
Definition: ip_punt_drop.h:44
static char * ip4_punt_redirect_error_strings[]
IP punt redirect configuration.
Definition: ip_punt_drop.h:215
static uword ip_punt_policer(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, u32 policer_index)
IP punt policing node function.
Definition: ip_punt_drop.h:61
unformat_function_t unformat_line_input
Definition: format.h:282
u8 * format_ip_punt_policer_trace(u8 *s, va_list *args)
Definition: ip4_punt_drop.c:41
format_function_t format_vnet_sw_interface_name
ip_punt_redirect_rx_t redirect
Definition: ip_punt_drop.h:244
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
Definition: adj_types.h:36
static char * ip4_punt_policer_error_strings[]
Definition: ip4_punt_drop.c:56
struct _unformat_input_t unformat_input_t
static clib_error_t * ip4_punt_redirect_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
#define ip46_address_initializer
Definition: ip6_packet.h:96
static uword ip_punt_redirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, ip_punt_redirect_t *redirect)
Definition: ip_punt_drop.h:301
IP Punt redirect trace.
Definition: ip_punt_drop.h:242
vlib_node_registration_t ip4_punt_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_node)
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
ip_punt_redirect_rx_t any_rx_sw_if_index
any RX interface redirect
Definition: ip_punt_drop.h:220
vlib_main_t * vm
Definition: buffer.c:312
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
Definition: ip_punt_drop.h:194
vlib_node_registration_t ip4_punt_redirect_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_redirect_node)
u32 tx_sw_if_index
the TX interface to send redirected packets
Definition: ip_punt_drop.h:204
#define ARRAY_LEN(x)
Definition: clib.h:62
VNET_FEATURE_INIT(ip4_punt_policer_node)
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
static uword ip4_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 is_add
Definition: ipsec_gre.api:36
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
Definition: ip_punt_drop.h:27
static clib_error_t * ip4_punt_police_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
void ip4_punt_redirect_del(u32 rx_sw_if_index)
#define VNET_FEATURES(...)
Definition: feature.h:435
#define unformat_parse_error(input)
Definition: format.h:268
Definition: defs.h:47
void ip4_punt_redirect_add(u32 rx_sw_if_index, u32 tx_sw_if_index, ip46_address_t *nh)
void ip_punt_redirect_add(ip_punt_redirect_t *cfg, u32 rx_sw_if_index, ip_punt_redirect_rx_t *redirect, fib_protocol_t fproto, vnet_link_t linkt)
Add a punt redirect entry.
void ip4_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
Definition: ip4_forward.c:1040
u64 uword
Definition: types.h:112
static void unformat_free(unformat_input_t *i)
Definition: format.h:162
u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
Definition: ip4_forward.c:990
u32 rx_sw_if_index
the RX interface
Definition: ip_punt_drop.h:253
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
Definition: adj_nbr.c:218
u8 * format_ip_punt_redirect(u8 *s, va_list *args)
u16 flags
Copy of main node flags.
Definition: node.h:507
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:301
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
Definition: vec.h:486
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:762
adj_index_t adj_index
redirect forwarding adjacency
Definition: ip_punt_drop.h:209
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
VNET_FEATURE_ARC_INIT(ip4_punt)
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
Definition: feature.c:274
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170