FD.io VPP  v16.12-rc0-308-g931be3a
Vector Packet Processing
ip4_source_check.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  * ip/ip4_source_check.c: IP v4 check source address (unicast RPF check)
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #include <vnet/ip/ip.h>
41 #include <vnet/fib/ip4_fib.h>
42 #include <vnet/fib/fib_urpf_list.h>
43 #include <vnet/dpo/load_balance.h>
44 
45 /**
46  * @file
47  * @brief IPv4 Unicast Source Check.
48  *
49  * This file contains the IPv4 interface unicast source check.
50  */
51 
52 
53 typedef struct {
54  u8 packet_data[64];
57 
58 static u8 * format_ip4_source_check_trace (u8 * s, va_list * va)
59 {
60  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *);
61  CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
63 
64  s = format (s, "%U",
66  t->packet_data, sizeof (t->packet_data));
67 
68  return s;
69 }
70 
71 typedef enum {
75 
76 typedef enum {
80 
81 typedef union {
84 
87  vlib_node_runtime_t * node,
88  vlib_frame_t * frame,
89  ip4_source_check_type_t source_check_type)
90 {
91  ip4_main_t * im = &ip4_main;
92  ip_lookup_main_t * lm = &im->lookup_main;
94  u32 n_left_from, * from, * to_next;
95  u32 next_index;
96  vlib_node_runtime_t * error_node = vlib_node_get_runtime (vm, ip4_input_node.index);
97 
98  from = vlib_frame_vector_args (frame);
99  n_left_from = frame->n_vectors;
100  next_index = node->cached_next_index;
101 
102  if (node->flags & VLIB_NODE_FLAG_TRACE)
103  vlib_trace_frame_buffers_only (vm, node, from, frame->n_vectors,
104  /* stride */ 1,
105  sizeof (ip4_source_check_trace_t));
106 
107  while (n_left_from > 0)
108  {
109  u32 n_left_to_next;
110 
111  vlib_get_next_frame (vm, node, next_index,
112  to_next, n_left_to_next);
113 
114  while (n_left_from >= 4 && n_left_to_next >= 2)
115  {
116  vlib_buffer_t * p0, * p1;
117  ip4_header_t * ip0, * ip1;
118  ip4_fib_mtrie_t * mtrie0, * mtrie1;
119  ip4_fib_mtrie_leaf_t leaf0, leaf1;
120  ip4_source_check_config_t * c0, * c1;
121  const load_balance_t * lb0, * lb1;
122  u32 pi0, next0, pass0, lb_index0;
123  u32 pi1, next1, pass1, lb_index1;
124 
125  /* Prefetch next iteration. */
126  {
127  vlib_buffer_t * p2, * p3;
128 
129  p2 = vlib_get_buffer (vm, from[2]);
130  p3 = vlib_get_buffer (vm, from[3]);
131 
132  vlib_prefetch_buffer_header (p2, LOAD);
133  vlib_prefetch_buffer_header (p3, LOAD);
134 
135  CLIB_PREFETCH (p2->data, sizeof (ip0[0]), LOAD);
136  CLIB_PREFETCH (p3->data, sizeof (ip1[0]), LOAD);
137  }
138 
139  pi0 = to_next[0] = from[0];
140  pi1 = to_next[1] = from[1];
141  from += 2;
142  to_next += 2;
143  n_left_from -= 2;
144  n_left_to_next -= 2;
145 
146  p0 = vlib_get_buffer (vm, pi0);
147  p1 = vlib_get_buffer (vm, pi1);
148 
149  ip0 = vlib_buffer_get_current (p0);
150  ip1 = vlib_buffer_get_current (p1);
151 
154  &next0,
155  sizeof (c0[0]));
158  &next1,
159  sizeof (c1[0]));
160 
161  mtrie0 = &ip4_fib_get (c0->fib_index)->mtrie;
162  mtrie1 = &ip4_fib_get (c1->fib_index)->mtrie;
163 
164  leaf0 = leaf1 = IP4_FIB_MTRIE_LEAF_ROOT;
165 
166  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 0);
167  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, &ip1->src_address, 0);
168 
169  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 1);
170  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, &ip1->src_address, 1);
171 
172  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 2);
173  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, &ip1->src_address, 2);
174 
175  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 3);
176  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, &ip1->src_address, 3);
177 
178  lb_index0 = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
179  lb_index1 = ip4_fib_mtrie_leaf_get_adj_index (leaf1);
180 
181  lb0 = load_balance_get(lb_index0);
182  lb1 = load_balance_get(lb_index1);
183 
184  /* Pass multicast. */
185  pass0 = ip4_address_is_multicast (&ip0->src_address) || ip0->src_address.as_u32 == clib_host_to_net_u32(0xFFFFFFFF);
186  pass1 = ip4_address_is_multicast (&ip1->src_address) || ip1->src_address.as_u32 == clib_host_to_net_u32(0xFFFFFFFF);
187 
188  if (IP4_SOURCE_CHECK_REACHABLE_VIA_RX == source_check_type)
189  {
190  pass0 |= fib_urpf_check(lb0->lb_urpf,
191  vnet_buffer (p0)->sw_if_index[VLIB_RX]);
192  pass1 |= fib_urpf_check(lb1->lb_urpf,
193  vnet_buffer (p1)->sw_if_index[VLIB_RX]);
194  }
195  else
196  {
197  pass0 |= fib_urpf_check_size(lb0->lb_urpf);
198  pass1 |= fib_urpf_check_size(lb1->lb_urpf);
199  }
200  next0 = (pass0 ? next0 : IP4_SOURCE_CHECK_NEXT_DROP);
201  next1 = (pass1 ? next1 : IP4_SOURCE_CHECK_NEXT_DROP);
202 
203  p0->error = error_node->errors[IP4_ERROR_UNICAST_SOURCE_CHECK_FAILS];
204  p1->error = error_node->errors[IP4_ERROR_UNICAST_SOURCE_CHECK_FAILS];
205 
206  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
207  to_next, n_left_to_next,
208  pi0, pi1, next0, next1);
209  }
210 
211  while (n_left_from > 0 && n_left_to_next > 0)
212  {
213  vlib_buffer_t * p0;
214  ip4_header_t * ip0;
215  ip4_fib_mtrie_t * mtrie0;
216  ip4_fib_mtrie_leaf_t leaf0;
218  u32 pi0, next0, pass0, lb_index0;
219  const load_balance_t * lb0;
220 
221  pi0 = from[0];
222  to_next[0] = pi0;
223  from += 1;
224  to_next += 1;
225  n_left_from -= 1;
226  n_left_to_next -= 1;
227 
228  p0 = vlib_get_buffer (vm, pi0);
229  ip0 = vlib_buffer_get_current (p0);
230 
233  &next0,
234  sizeof (c0[0]));
235 
236  mtrie0 = &ip4_fib_get (c0->fib_index)->mtrie;
237 
238  leaf0 = IP4_FIB_MTRIE_LEAF_ROOT;
239 
240  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 0);
241 
242  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 1);
243 
244  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 2);
245 
246  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 3);
247 
248  lb_index0 = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
249 
250  lb0 = load_balance_get(lb_index0);
251 
252  /* Pass multicast. */
253  pass0 = ip4_address_is_multicast (&ip0->src_address) || ip0->src_address.as_u32 == clib_host_to_net_u32(0xFFFFFFFF);
254 
255  if (IP4_SOURCE_CHECK_REACHABLE_VIA_RX == source_check_type)
256  {
257  pass0 |= fib_urpf_check(lb0->lb_urpf,
258  vnet_buffer (p0)->sw_if_index[VLIB_RX]);
259  }
260  else
261  {
262  pass0 |= fib_urpf_check_size(lb0->lb_urpf);
263  }
264 
265  next0 = (pass0 ? next0 : IP4_SOURCE_CHECK_NEXT_DROP);
266  p0->error = error_node->errors[IP4_ERROR_UNICAST_SOURCE_CHECK_FAILS];
267 
268  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
269  to_next, n_left_to_next,
270  pi0, next0);
271  }
272 
273  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
274  }
275 
276  return frame->n_vectors;
277 }
278 
279 static uword
281  vlib_node_runtime_t * node,
282  vlib_frame_t * frame)
283 {
285 }
286 
287 static uword
289  vlib_node_runtime_t * node,
290  vlib_frame_t * frame)
291 {
293 }
294 
297  .name = "ip4-source-check-via-any",
298  .vector_size = sizeof (u32),
299 
300  .n_next_nodes = IP4_SOURCE_CHECK_N_NEXT,
301  .next_nodes = {
302  [IP4_SOURCE_CHECK_NEXT_DROP] = "error-drop",
303  },
304 
305  .format_buffer = format_ip4_header,
306  .format_trace = format_ip4_source_check_trace,
307 };
308 
311 
312 VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx) = {
314  .name = "ip4-source-check-via-rx",
315  .vector_size = sizeof (u32),
316 
317  .n_next_nodes = IP4_SOURCE_CHECK_N_NEXT,
318  .next_nodes = {
319  [IP4_SOURCE_CHECK_NEXT_DROP] = "error-drop",
320  },
321 
322  .format_buffer = format_ip4_header,
323  .format_trace = format_ip4_source_check_trace,
324 };
325 
326 VLIB_NODE_FUNCTION_MULTIARCH (ip4_check_source_reachable_via_rx,
328 
329 static clib_error_t *
330 set_ip_source_check (vlib_main_t * vm,
331  unformat_input_t * input,
332  vlib_cli_command_t * cmd)
333 {
334  unformat_input_t _line_input, * line_input = &_line_input;
335  vnet_main_t * vnm = vnet_get_main();
336  ip4_main_t * im = &ip4_main;
337  ip_lookup_main_t * lm = &im->lookup_main;
339  clib_error_t * error = 0;
340  u32 sw_if_index, is_del, ci;
342  u32 feature_index;
343 
344  sw_if_index = ~0;
345  is_del = 0;
347 
348  if (! unformat_user (input, unformat_line_input, line_input))
349  return 0;
350 
351  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
352  {
353  if (unformat_user (line_input, unformat_vnet_sw_interface, vnm, &sw_if_index))
354  ;
355  else if (unformat (line_input, "del"))
356  is_del = 1;
357  else if (unformat (line_input, "strict"))
359  else if (unformat (line_input, "loose"))
361  else
362  {
363  error = unformat_parse_error (line_input);
364  goto done;
365  }
366  }
367 
368  if (~0 == sw_if_index)
369  {
370  error = clib_error_return (0, "unknown interface `%U'",
371  format_unformat_error, line_input);
372  goto done;
373  }
374 
375  config.fib_index = im->fib_index_by_sw_if_index[sw_if_index];
376  ci = rx_cm->config_index_by_sw_if_index[sw_if_index];
377  ci = (is_del
380  (vm, &rx_cm->config_main,
381  ci,
382  feature_index,
383  &config,
384  sizeof (config));
385  rx_cm->config_index_by_sw_if_index[sw_if_index] = ci;
386 
387  done:
388  return error;
389 }
390 
391 /*?
392  * This command adds the 'ip4-source-check-via-rx' graph node for
393  * a given interface. By adding the IPv4 source check graph node to
394  * an interface, the code verifies that the source address of incoming
395  * unicast packets are reachable over the incoming interface. Two flavours
396  * are supported (the default is strict):
397  * - loose: accept ingress packet if there is a route to reach the source
398  * - strict: accept ingress packet if it arrived on an interface which
399  * the route to the source uses. i.e. an interface that the source
400  * is reachable via.
401  *
402  * @cliexpar
403  * @parblock
404  * Example of graph node before range checking is enabled:
405  * @cliexstart{show vlib graph ip4-source-check-via-rx}
406  * Name Next Previous
407  * ip4-source-check-via-rx error-drop [0]
408  * @cliexend
409  *
410  * Example of how to enable unicast source checking on an interface:
411  * @cliexcmd{set interface ip source-check GigabitEthernet2/0/0 loose}
412  *
413  * Example of graph node after range checking is enabled:
414  * @cliexstart{show vlib graph ip4-source-check-via-rx}
415  * Name Next Previous
416  * ip4-source-check-via-rx error-drop [0] ip4-input-no-checksum
417  * ip4-source-and-port-range- ip4-input
418  * @cliexend
419  *
420  * Example of how to display the feature enabed on an interface:
421  * @cliexstart{show ip interface features GigabitEthernet2/0/0}
422  * IP feature paths configured on GigabitEthernet2/0/0...
423  *
424  * ipv4 unicast:
425  * ip4-source-check-via-rx
426  * ip4-lookup
427  *
428  * ipv4 multicast:
429  * ip4-lookup-multicast
430  *
431  * ipv4 multicast:
432  * interface-output
433  *
434  * ipv6 unicast:
435  * ip6-lookup
436  *
437  * ipv6 multicast:
438  * ip6-lookup
439  *
440  * ipv6 multicast:
441  * interface-output
442  * @cliexend
443  *
444  * Example of how to disable unicast source checking on an interface:
445  * @cliexcmd{set interface ip source-check GigabitEthernet2/0/0 del}
446  * @endparblock
447 ?*/
448 /* *INDENT-OFF* */
449 VLIB_CLI_COMMAND (set_interface_ip_source_check_command, static) = {
450  .path = "set interface ip source-check",
451  .function = set_ip_source_check,
452  .short_help = "set interface ip source-check <interface> [strict|loose] [del]",
453 };
454 /* *INDENT-ON* */
455 
456 static clib_error_t *
458  unformat_input_t * input,
459  vlib_cli_command_t * cmd)
460 {
461  unformat_input_t _line_input, * line_input = &_line_input;
462  fib_prefix_t pfx = {
464  };
465  clib_error_t * error = NULL;
466  u32 table_id, is_add, fib_index;
467 
468  is_add = 1;
469  table_id = ~0;
470 
471  /* Get a line of input. */
472  if (! unformat_user (input, unformat_line_input, line_input))
473  return 0;
474 
475  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
476  {
477  if (unformat (line_input, "table %d", &table_id))
478  ;
479  else if (unformat (line_input, "del"))
480  is_add = 0;
481  else if (unformat (line_input, "add"))
482  is_add = 1;
483  else if (unformat (line_input, "%U/%d",
485  &pfx.fp_addr.ip4,
486  &pfx.fp_len))
488  else
489  {
490  error = unformat_parse_error (line_input);
491  goto done;
492  }
493  }
494 
495  if (~0 != table_id)
496  {
497  fib_index = fib_table_id_find_fib_index(pfx.fp_proto, table_id);
498  if (~0 == fib_index)
499  {
500  error = clib_error_return (0,
501  "Nonexistent table id %d",
502  table_id);
503  goto done;
504  }
505  }
506  else
507  {
508  fib_index = 0;
509  }
510 
511  if (is_add)
512  {
513  fib_table_entry_special_add(fib_index,
514  &pfx,
518  }
519  else
520  {
522  &pfx,
524  }
525 
526 done:
527  return (error);
528 }
529 
530 /*?
531  * Add an exemption for a prefix to pass the Unicast Reverse Path
532  * Forwarding (uRPF) loose check. This is for testing purposes only.
533  * If the '<em>table</em>' is not enter it is defaulted to 0. Default
534  * is to '<em>add</em>'. VPP always performs a loose uRPF check for
535  * for-us traffic.
536  *
537  * @cliexpar
538  * Example of how to add a uRPF exception to a FIB table to pass the
539  * loose RPF tests:
540  * @cliexcmd{ip urpf-accept table 7 add}
541 ?*/
542 /* *INDENT-OFF* */
543 VLIB_CLI_COMMAND (ip_source_check_accept_command, static) = {
544  .path = "ip urpf-accept",
545  .function = ip_source_check_accept,
546  .short_help = "ip urpf-accept [table <table-id>] [add|del]",
547 };
548 /* *INDENT-ON* */
549 
550 
551 /* Dummy init function to get us linked in. */
553 { return 0; }
554 
vnet_config_main_t config_main
Definition: feature.h:55
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:457
u32 fib_table_id_find_fib_index(fib_protocol_t proto, u32 table_id)
Definition: lookup.c:316
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:158
#define CLIB_UNUSED(x)
Definition: clib.h:79
uword unformat(unformat_input_t *i, char *fmt,...)
Definition: unformat.c:966
static int fib_urpf_check_size(index_t ui)
Data-Plane function to check the size of an uRPF list, (i.e.
u32 ip4_unicast_rx_feature_source_reachable_via_any
Built-in unicast feature path index, see vnet_feature_arc_init()
Definition: ip4.h:127
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
Definition: buffer.h:124
ip4_address_t src_address
Definition: ip4_packet.h:138
#define UNFORMAT_END_OF_INPUT
Definition: format.h:143
#define NULL
Definition: clib.h:55
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
Definition: config.c:300
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
static int fib_urpf_check(index_t ui, u32 sw_if_index)
Data-Plane function to check an input interface against an uRPF list.
ip_lookup_main_t lookup_main
Definition: ip4.h:96
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip4.h:104
unformat_function_t unformat_vnet_sw_interface
vlib_error_t * errors
Definition: node.h:419
uRPF bypass/exemption.
Definition: fib_entry.h:109
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step(ip4_fib_mtrie_t *m, ip4_fib_mtrie_leaf_t current_leaf, const ip4_address_t *dst_address, u32 dst_address_byte_index)
Definition: ip4_mtrie.h:146
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a &#39;special&#39; entry from the FIB.
Definition: fib_table.c:399
#define always_inline
Definition: clib.h:84
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:190
u32 ip4_fib_mtrie_leaf_t
Definition: ip4_mtrie.h:52
Aggregrate type for a prefix.
Definition: fib_types.h:149
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:977
u16 fp_len
The mask length.
Definition: fib_types.h:153
static u32 ip4_fib_mtrie_leaf_get_adj_index(ip4_fib_mtrie_leaf_t n)
Definition: ip4_mtrie.h:66
unformat_function_t unformat_ip4_address
Definition: format.h:75
static uword ip4_source_check_reachable_via_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
ip4_source_check_next_t
#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
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, adj_index_t adj_index)
Add a &#39;special&#39; entry to the FIB that links to the adj passed A special entry is an entry that the FI...
Definition: fib_table.c:369
vlib_node_registration_t ip4_input_node
Global ip4 input node.
Definition: ip4_input.c:388
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:172
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
Definition: config.h:122
The FIB DPO provieds;.
Definition: load_balance.h:83
#define unformat_parse_error(input)
Definition: format.h:267
static uword ip4_address_is_multicast(ip4_address_t *a)
Definition: ip4_packet.h:263
#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
VLIB_NODE_FUNCTION_MULTIARCH(ip4_check_source_reachable_via_any, ip4_source_check_reachable_via_any)
(constructor) VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx)
#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:216
#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:350
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:121
vnet_feature_config_main_t feature_config_mains[VNET_N_IP_FEAT]
rx unicast, multicast, tx interface/feature configuration.
Definition: lookup.h:360
u16 n_vectors
Definition: node.h:344
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
clib_error_t * ip4_source_check_init(vlib_main_t *vm)
u32 ip4_unicast_rx_feature_source_reachable_via_rx
Built-in unicast feature path index, see vnet_feature_arc_init()
Definition: ip4.h:125
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
Definition: ip4_fib.h:71
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
Definition: node_funcs.h:88
Definition: fib_entry.h:218
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:154
u16 cached_next_index
Definition: node.h:463
#define IP4_FIB_MTRIE_LEAF_ROOT
Definition: ip4_mtrie.h:55
index_t lb_urpf
This is the index of the uRPF list for this LB.
Definition: load_balance.h:117
format_function_t format_ip4_header
Definition: format.h:85
unsigned int u32
Definition: types.h:88
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define vnet_buffer(b)
Definition: buffer.h:333
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:185
static clib_error_t * ip_source_check_accept(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
IPv4 main type.
Definition: ip4.h:95
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:259
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
Definition: config.c:239
u64 uword
Definition: types.h:112
static uword ip4_source_check_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, ip4_source_check_type_t source_check_type)
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
Definition: trace.c:45
unsigned char u8
Definition: types.h:56
ip4_source_check_type_t
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:253
ip4_fib_mtrie_t mtrie
Definition: ip4.h:53
static uword ip4_source_check_reachable_via_any(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:166
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:169
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1060
u8 data[0]
Packet data.
Definition: buffer.h:154
vlib_node_registration_t ip4_check_source_reachable_via_any
(constructor) VLIB_REGISTER_NODE (ip4_check_source_reachable_via_any)
#define clib_error_return(e, args...)
Definition: error.h:111
struct _unformat_input_t unformat_input_t
static u8 * format_ip4_source_check_trace(u8 *s, va_list *va)
unformat_function_t unformat_line_input
Definition: format.h:281
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:69
Definition: defs.h:46