FD.io VPP  v19.04.2-12-g66b1689
Vector Packet Processing
decap.c
Go to the documentation of this file.
1 /*
2  * decap.c: vxlan gbp tunnel decap packet processing
3  *
4  * Copyright (c) 2018 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 
21 
22 typedef struct
23 {
31 
32 static u8 *
33 format_vxlan_gbp_rx_trace (u8 * s, va_list * args)
34 {
35  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
36  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
37  vxlan_gbp_rx_trace_t *t = va_arg (*args, vxlan_gbp_rx_trace_t *);
38 
39  if (t->tunnel_index == ~0)
40  return format (s,
41  "VXLAN_GBP decap error - tunnel for vni %d does not exist",
42  t->vni);
43  return format (s,
44  "VXLAN_GBP decap from vxlan_gbp_tunnel%d vni %d sclass %d"
45  " flags %U next %d error %d",
46  t->tunnel_index, t->vni, t->sclass,
48  t->next_index, t->error);
49 }
50 
53 {
54  u32 sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_TX];
55  if (sw_if_index != (u32) ~ 0)
56  return sw_if_index;
57 
58  u32 *fib_index_by_sw_if_index = is_ip4 ?
60  sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
61 
62  return vec_elt (fib_index_by_sw_if_index, sw_if_index);
63 }
64 
66 
69  u32 fib_index, ip4_header_t * ip4_0,
70  vxlan_gbp_header_t * vxlan_gbp0)
71 {
72  /*
73  * Check unicast first since that's where most of the traffic comes from
74  * Make sure VXLAN_GBP tunnel exist according to packet SIP, DIP and VNI
75  */
77  int rv;
78 
79  key4.key[1] = ((u64) fib_index << 32) | vxlan_gbp0->vni_reserved;
80  key4.key[0] = (((u64) ip4_0->dst_address.as_u32 << 32) |
81  ip4_0->src_address.as_u32);
82 
83  if (PREDICT_FALSE (key4.key[0] != cache->key[0] ||
84  key4.key[1] != cache->key[1]))
85  {
86  rv = clib_bihash_search_inline_16_8 (&vxm->vxlan4_gbp_tunnel_by_key,
87  &key4);
88  if (PREDICT_FALSE (rv == 0))
89  {
90  *cache = key4;
91  return (pool_elt_at_index (vxm->tunnels, cache->value));
92  }
93  }
94  else
95  {
96  return (pool_elt_at_index (vxm->tunnels, cache->value));
97  }
98 
99  /* No unicast match - try multicast */
101  return (NULL);
102 
103  key4.key[0] = ip4_0->dst_address.as_u32;
104  /* Make sure mcast VXLAN_GBP tunnel exist by packet DIP and VNI */
105  rv = clib_bihash_search_inline_16_8 (&vxm->vxlan4_gbp_tunnel_by_key, &key4);
106 
107  if (PREDICT_FALSE (rv != 0))
108  return (NULL);
109 
110  return (pool_elt_at_index (vxm->tunnels, key4.value));
111 }
112 
114 
117  u32 fib_index, ip6_header_t * ip6_0,
118  vxlan_gbp_header_t * vxlan_gbp0)
119 {
120  /* Make sure VXLAN_GBP tunnel exist according to packet SIP and VNI */
121  vxlan6_gbp_tunnel_key_t key6 = {
122  .key = {
123  [0] = ip6_0->src_address.as_u64[0],
124  [1] = ip6_0->src_address.as_u64[1],
125  [2] = (((u64) fib_index) << 32) | vxlan_gbp0->vni_reserved,
126  }
127  };
128  int rv;
129 
130  if (PREDICT_FALSE
131  (clib_bihash_key_compare_24_8 (key6.key, cache->key) == 0))
132  {
133  rv = clib_bihash_search_inline_24_8 (&vxm->vxlan6_gbp_tunnel_by_key,
134  &key6);
135  if (PREDICT_FALSE (rv != 0))
136  return NULL;
137 
138  *cache = key6;
139  }
140  vxlan_gbp_tunnel_t *t0 = pool_elt_at_index (vxm->tunnels, cache->value);
141 
142  /* Validate VXLAN_GBP tunnel SIP against packet DIP */
143  if (PREDICT_FALSE
144  (!ip6_address_is_equal (&ip6_0->dst_address, &t0->src.ip6)))
145  {
146  /* try multicast */
148  return 0;
149 
150  /* Make sure mcast VXLAN_GBP tunnel exist by packet DIP and VNI */
151  key6.key[0] = ip6_0->dst_address.as_u64[0];
152  key6.key[1] = ip6_0->dst_address.as_u64[1];
153  rv = clib_bihash_search_inline_24_8 (&vxm->vxlan6_gbp_tunnel_by_key,
154  &key6);
155  if (PREDICT_FALSE (rv != 0))
156  return 0;
157 
158  }
159 
160  return t0;
161 }
162 
165 {
166  if (VXLAN_GBP_TUNNEL_MODE_L2 == t->mode)
167  return (VXLAN_GBP_INPUT_NEXT_L2_INPUT);
168  else
169  {
170  ethernet_header_t *e0;
171  u16 type0;
172 
173  e0 = vlib_buffer_get_current (b0);
174  vlib_buffer_advance (b0, sizeof (*e0));
175  type0 = clib_net_to_host_u16 (e0->type);
176  switch (type0)
177  {
178  case ETHERNET_TYPE_IP4:
179  return (VXLAN_GBP_INPUT_NEXT_IP4_INPUT);
180  case ETHERNET_TYPE_IP6:
181  return (VXLAN_GBP_INPUT_NEXT_IP6_INPUT);
182  }
183  }
184  return (VXLAN_GBP_INPUT_NEXT_DROP);
185 }
186 
189  vlib_node_runtime_t * node,
190  vlib_frame_t * from_frame, u8 is_ip4)
191 {
193  vnet_main_t *vnm = vxm->vnet_main;
195  vlib_combined_counter_main_t *rx_counter =
197  vlib_combined_counter_main_t *drop_counter =
199  last_tunnel_cache4 last4;
200  last_tunnel_cache6 last6;
201  u32 pkts_decapsulated = 0;
202  u32 thread_index = vlib_get_thread_index ();
203 
204  if (is_ip4)
205  clib_memset (&last4, 0xff, sizeof last4);
206  else
207  clib_memset (&last6, 0xff, sizeof last6);
208 
209  u32 next_index = node->cached_next_index;
210 
211  u32 *from = vlib_frame_vector_args (from_frame);
212  u32 n_left_from = from_frame->n_vectors;
213 
214  while (n_left_from > 0)
215  {
216  u32 *to_next, n_left_to_next;
217  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
218 
219  while (n_left_from >= 4 && n_left_to_next >= 2)
220  {
221  /* Prefetch next iteration. */
222  {
223  vlib_buffer_t *p2, *p3;
224 
225  p2 = vlib_get_buffer (vm, from[2]);
226  p3 = vlib_get_buffer (vm, from[3]);
227 
228  vlib_prefetch_buffer_header (p2, LOAD);
229  vlib_prefetch_buffer_header (p3, LOAD);
230 
231  CLIB_PREFETCH (p2->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
232  CLIB_PREFETCH (p3->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
233  }
234 
235  u32 bi0 = to_next[0] = from[0];
236  u32 bi1 = to_next[1] = from[1];
237  from += 2;
238  to_next += 2;
239  n_left_to_next -= 2;
240  n_left_from -= 2;
241 
242  vlib_buffer_t *b0, *b1;
243  b0 = vlib_get_buffer (vm, bi0);
244  b1 = vlib_get_buffer (vm, bi1);
245 
246  /* udp leaves current_data pointing at the vxlan_gbp header */
247  void *cur0 = vlib_buffer_get_current (b0);
248  void *cur1 = vlib_buffer_get_current (b1);
249  vxlan_gbp_header_t *vxlan_gbp0 = cur0;
250  vxlan_gbp_header_t *vxlan_gbp1 = cur1;
251 
252  ip4_header_t *ip4_0, *ip4_1;
253  ip6_header_t *ip6_0, *ip6_1;
254  if (is_ip4)
255  {
256  ip4_0 = cur0 - sizeof (udp_header_t) - sizeof (ip4_header_t);
257  ip4_1 = cur1 - sizeof (udp_header_t) - sizeof (ip4_header_t);
258  }
259  else
260  {
261  ip6_0 = cur0 - sizeof (udp_header_t) - sizeof (ip6_header_t);
262  ip6_1 = cur1 - sizeof (udp_header_t) - sizeof (ip6_header_t);
263  }
264 
265  u32 fi0 = buf_fib_index (b0, is_ip4);
266  u32 fi1 = buf_fib_index (b1, is_ip4);
267 
268  vxlan_gbp_tunnel_t *t0, *t1;
269  if (is_ip4)
270  {
271  t0 =
272  vxlan4_gbp_find_tunnel (vxm, &last4, fi0, ip4_0, vxlan_gbp0);
273  t1 =
274  vxlan4_gbp_find_tunnel (vxm, &last4, fi1, ip4_1, vxlan_gbp1);
275  }
276  else
277  {
278  t0 =
279  vxlan6_gbp_find_tunnel (vxm, &last6, fi0, ip6_0, vxlan_gbp0);
280  t1 =
281  vxlan6_gbp_find_tunnel (vxm, &last6, fi1, ip6_1, vxlan_gbp1);
282  }
283 
284  u32 len0 = vlib_buffer_length_in_chain (vm, b0);
285  u32 len1 = vlib_buffer_length_in_chain (vm, b1);
286 
287  vxlan_gbp_input_next_t next0, next1;
288  u8 error0 = 0, error1 = 0;
289  u8 flags0 = vxlan_gbp_get_flags (vxlan_gbp0);
290  u8 flags1 = vxlan_gbp_get_flags (vxlan_gbp1);
291  /* Required to make the l2 tag push / pop code work on l2 subifs */
292  /* pop vxlan_gbp */
293  vlib_buffer_advance (b0, sizeof *vxlan_gbp0);
294  vlib_buffer_advance (b1, sizeof *vxlan_gbp1);
295 
296  /* Validate VXLAN_GBP tunnel encap-fib index against packet */
297  if (PREDICT_FALSE
298  (t0 == NULL
299  || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
300  {
301  if (t0 != NULL
302  && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
303  {
304  error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
306  (drop_counter, thread_index, t0->sw_if_index, 1, len0);
307  next0 = VXLAN_GBP_INPUT_NEXT_DROP;
308  }
309  else
310  {
311  error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
312  next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
313  if (is_ip4)
314  b0->punt_reason =
316  else
317  b0->punt_reason =
319  }
320  b0->error = node->errors[error0];
321  }
322  else
323  {
324  next0 = vxlan_gbp_tunnel_get_next (t0, b0);
325 
326  /* Set packet input sw_if_index to unicast VXLAN tunnel for learning */
327  vnet_buffer (b0)->sw_if_index[VLIB_RX] = t0->sw_if_index;
329  (rx_counter, thread_index, t0->sw_if_index, 1, len0);
330  pkts_decapsulated++;
331  }
332 
333  vnet_buffer2 (b0)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp0) |
334  VXLAN_GBP_GPFLAGS_R);
335  vnet_buffer2 (b0)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
336 
337 
338  if (PREDICT_FALSE
339  (t1 == 0 || flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
340  {
341  if (t1 != 0
342  && flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
343  {
344  error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
346  (drop_counter, thread_index, t1->sw_if_index, 1, len1);
347  next1 = VXLAN_GBP_INPUT_NEXT_DROP;
348  }
349  else
350  {
351  error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
352  next1 = VXLAN_GBP_INPUT_NEXT_PUNT;
353  if (is_ip4)
354  b1->punt_reason =
356  else
357  b1->punt_reason =
359  }
360  b1->error = node->errors[error1];
361  }
362  else
363  {
364  next1 = vxlan_gbp_tunnel_get_next (t1, b1);
365 
366  /* Set packet input sw_if_index to unicast VXLAN_GBP tunnel for learning */
367  vnet_buffer (b1)->sw_if_index[VLIB_RX] = t1->sw_if_index;
368  pkts_decapsulated++;
369 
371  (rx_counter, thread_index, t1->sw_if_index, 1, len1);
372  }
373 
374  vnet_buffer2 (b1)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp1) |
375  VXLAN_GBP_GPFLAGS_R);
376 
377  vnet_buffer2 (b1)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp1);
378 
379  vnet_update_l2_len (b0);
380  vnet_update_l2_len (b1);
381 
382  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
383  {
385  vlib_add_trace (vm, node, b0, sizeof (*tr));
386  tr->next_index = next0;
387  tr->error = error0;
388  tr->tunnel_index = t0 == 0 ? ~0 : t0 - vxm->tunnels;
389  tr->vni = vxlan_gbp_get_vni (vxlan_gbp0);
390  tr->sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
391  tr->flags = vxlan_gbp_get_gpflags (vxlan_gbp0);
392  }
393  if (PREDICT_FALSE (b1->flags & VLIB_BUFFER_IS_TRACED))
394  {
396  vlib_add_trace (vm, node, b1, sizeof (*tr));
397  tr->next_index = next1;
398  tr->error = error1;
399  tr->tunnel_index = t1 == 0 ? ~0 : t1 - vxm->tunnels;
400  tr->vni = vxlan_gbp_get_vni (vxlan_gbp1);
401  tr->sclass = vxlan_gbp_get_sclass (vxlan_gbp1);
402  tr->flags = vxlan_gbp_get_gpflags (vxlan_gbp1);
403  }
404 
405  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
406  to_next, n_left_to_next,
407  bi0, bi1, next0, next1);
408  }
409 
410  while (n_left_from > 0 && n_left_to_next > 0)
411  {
412  u32 bi0 = to_next[0] = from[0];
413  from += 1;
414  to_next += 1;
415  n_left_from -= 1;
416  n_left_to_next -= 1;
417 
418  vlib_buffer_t *b0 = vlib_get_buffer (vm, bi0);
419 
420  /* udp leaves current_data pointing at the vxlan_gbp header */
421  void *cur0 = vlib_buffer_get_current (b0);
422  vxlan_gbp_header_t *vxlan_gbp0 = cur0;
423  ip4_header_t *ip4_0;
424  ip6_header_t *ip6_0;
425  if (is_ip4)
426  ip4_0 = cur0 - sizeof (udp_header_t) - sizeof (ip4_header_t);
427  else
428  ip6_0 = cur0 - sizeof (udp_header_t) - sizeof (ip6_header_t);
429 
430  u32 fi0 = buf_fib_index (b0, is_ip4);
431 
432  vxlan_gbp_tunnel_t *t0;
433  if (is_ip4)
434  t0 = vxlan4_gbp_find_tunnel (vxm, &last4, fi0, ip4_0, vxlan_gbp0);
435  else
436  t0 = vxlan6_gbp_find_tunnel (vxm, &last6, fi0, ip6_0, vxlan_gbp0);
437 
438  uword len0 = vlib_buffer_length_in_chain (vm, b0);
439 
441  u8 error0 = 0;
442  u8 flags0 = vxlan_gbp_get_flags (vxlan_gbp0);
443 
444  /* pop (ip, udp, vxlan_gbp) */
445  vlib_buffer_advance (b0, sizeof (*vxlan_gbp0));
446  /* Validate VXLAN_GBP tunnel encap-fib index against packet */
447  if (PREDICT_FALSE
448  (t0 == NULL
449  || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
450  {
451  if (t0 != NULL
452  && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
453  {
454  error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
456  (drop_counter, thread_index, t0->sw_if_index, 1, len0);
457  next0 = VXLAN_GBP_INPUT_NEXT_DROP;
458  }
459  else
460  {
461  error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
462  next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
463  if (is_ip4)
464  b0->punt_reason =
466  else
467  b0->punt_reason =
469  }
470  b0->error = node->errors[error0];
471  }
472  else
473  {
474  next0 = vxlan_gbp_tunnel_get_next (t0, b0);
475  /* Set packet input sw_if_index to unicast VXLAN_GBP tunnel for learning */
476  vnet_buffer (b0)->sw_if_index[VLIB_RX] = t0->sw_if_index;
477  pkts_decapsulated++;
478 
480  (rx_counter, thread_index, t0->sw_if_index, 1, len0);
481  }
482  vnet_buffer2 (b0)->gbp.flags = (vxlan_gbp_get_gpflags (vxlan_gbp0) |
483  VXLAN_GBP_GPFLAGS_R);
484 
485  vnet_buffer2 (b0)->gbp.sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
486 
487  /* Required to make the l2 tag push / pop code work on l2 subifs */
488  vnet_update_l2_len (b0);
489 
490  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
491  {
493  = vlib_add_trace (vm, node, b0, sizeof (*tr));
494  tr->next_index = next0;
495  tr->error = error0;
496  tr->tunnel_index = t0 == 0 ? ~0 : t0 - vxm->tunnels;
497  tr->vni = vxlan_gbp_get_vni (vxlan_gbp0);
498  tr->sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
499  tr->flags = vxlan_gbp_get_gpflags (vxlan_gbp0);
500  }
501  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
502  to_next, n_left_to_next,
503  bi0, next0);
504  }
505 
506  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
507  }
508  /* Do we still need this now that tunnel tx stats is kept? */
509  u32 node_idx =
510  is_ip4 ? vxlan4_gbp_input_node.index : vxlan6_gbp_input_node.index;
511  vlib_node_increment_counter (vm, node_idx, VXLAN_GBP_ERROR_DECAPSULATED,
512  pkts_decapsulated);
513 
514  return from_frame->n_vectors;
515 }
516 
518  vlib_node_runtime_t * node,
519  vlib_frame_t * from_frame)
520 {
521  return vxlan_gbp_input (vm, node, from_frame, /* is_ip4 */ 1);
522 }
523 
525  vlib_node_runtime_t * node,
526  vlib_frame_t * from_frame)
527 {
528  return vxlan_gbp_input (vm, node, from_frame, /* is_ip4 */ 0);
529 }
530 
531 static char *vxlan_gbp_error_strings[] = {
532 #define vxlan_gbp_error(n,s) s,
534 #undef vxlan_gbp_error
535 #undef _
536 };
537 
538 /* *INDENT-OFF* */
540 {
541  .name = "vxlan4-gbp-input",
542  .vector_size = sizeof (u32),
543  .n_errors = VXLAN_GBP_N_ERROR,
544  .error_strings = vxlan_gbp_error_strings,
545  .n_next_nodes = VXLAN_GBP_INPUT_N_NEXT,
546  .format_trace = format_vxlan_gbp_rx_trace,
547  .next_nodes = {
548 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n,
550 #undef _
551  },
552 };
553 
555 {
556  .name = "vxlan6-gbp-input",
557  .vector_size = sizeof (u32),
558  .n_errors = VXLAN_GBP_N_ERROR,
559  .error_strings = vxlan_gbp_error_strings,
560  .n_next_nodes = VXLAN_GBP_INPUT_N_NEXT,
561  .next_nodes = {
562 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n,
564 #undef _
565  },
566  .format_trace = format_vxlan_gbp_rx_trace,
567 };
568 /* *INDENT-ON* */
569 
570 typedef enum
571 {
576 
579  vlib_node_runtime_t * node,
580  vlib_frame_t * frame, u32 is_ip4)
581 {
583  u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
584  vlib_node_runtime_t *error_node =
586  ip4_address_t addr4; /* last IPv4 address matching a local VTEP address */
587  ip6_address_t addr6; /* last IPv6 address matching a local VTEP address */
588 
589  from = vlib_frame_vector_args (frame);
590  n_left_from = frame->n_vectors;
591  next_index = node->cached_next_index;
592 
593  if (node->flags & VLIB_NODE_FLAG_TRACE)
594  ip4_forward_next_trace (vm, node, frame, VLIB_TX);
595 
596  if (is_ip4)
597  addr4.data_u32 = ~0;
598  else
599  ip6_address_set_zero (&addr6);
600 
601  while (n_left_from > 0)
602  {
603  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
604 
605  while (n_left_from >= 4 && n_left_to_next >= 2)
606  {
607  vlib_buffer_t *b0, *b1;
608  ip4_header_t *ip40, *ip41;
609  ip6_header_t *ip60, *ip61;
610  udp_header_t *udp0, *udp1;
611  u32 bi0, ip_len0, udp_len0, flags0, next0;
612  u32 bi1, ip_len1, udp_len1, flags1, next1;
613  i32 len_diff0, len_diff1;
614  u8 error0, good_udp0, proto0;
615  u8 error1, good_udp1, proto1;
616 
617  /* Prefetch next iteration. */
618  {
619  vlib_buffer_t *p2, *p3;
620 
621  p2 = vlib_get_buffer (vm, from[2]);
622  p3 = vlib_get_buffer (vm, from[3]);
623 
624  vlib_prefetch_buffer_header (p2, LOAD);
625  vlib_prefetch_buffer_header (p3, LOAD);
626 
627  CLIB_PREFETCH (p2->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
628  CLIB_PREFETCH (p3->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
629  }
630 
631  bi0 = to_next[0] = from[0];
632  bi1 = to_next[1] = from[1];
633  from += 2;
634  n_left_from -= 2;
635  to_next += 2;
636  n_left_to_next -= 2;
637 
638  b0 = vlib_get_buffer (vm, bi0);
639  b1 = vlib_get_buffer (vm, bi1);
640  if (is_ip4)
641  {
642  ip40 = vlib_buffer_get_current (b0);
643  ip41 = vlib_buffer_get_current (b1);
644  }
645  else
646  {
647  ip60 = vlib_buffer_get_current (b0);
648  ip61 = vlib_buffer_get_current (b1);
649  }
650 
651  /* Setup packet for next IP feature */
652  vnet_feature_next (&next0, b0);
653  vnet_feature_next (&next1, b1);
654 
655  if (is_ip4)
656  {
657  /* Treat IP frag packets as "experimental" protocol for now
658  until support of IP frag reassembly is implemented */
659  proto0 = ip4_is_fragment (ip40) ? 0xfe : ip40->protocol;
660  proto1 = ip4_is_fragment (ip41) ? 0xfe : ip41->protocol;
661  }
662  else
663  {
664  proto0 = ip60->protocol;
665  proto1 = ip61->protocol;
666  }
667 
668  /* Process packet 0 */
669  if (proto0 != IP_PROTOCOL_UDP)
670  goto exit0; /* not UDP packet */
671 
672  if (is_ip4)
673  udp0 = ip4_next_header (ip40);
674  else
675  udp0 = ip6_next_header (ip60);
676 
677  if (udp0->dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
678  goto exit0; /* not VXLAN_GBP packet */
679 
680  /* Validate DIP against VTEPs */
681  if (is_ip4)
682  {
683  if (addr4.as_u32 != ip40->dst_address.as_u32)
684  {
685  if (!hash_get (vxm->vtep4, ip40->dst_address.as_u32))
686  goto exit0; /* no local VTEP for VXLAN_GBP packet */
687  addr4 = ip40->dst_address;
688  }
689  }
690  else
691  {
692  if (!ip6_address_is_equal (&addr6, &ip60->dst_address))
693  {
694  if (!hash_get_mem (vxm->vtep6, &ip60->dst_address))
695  goto exit0; /* no local VTEP for VXLAN_GBP packet */
696  addr6 = ip60->dst_address;
697  }
698  }
699 
700  flags0 = b0->flags;
701  good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
702 
703  /* Don't verify UDP checksum for packets with explicit zero checksum. */
704  good_udp0 |= udp0->checksum == 0;
705 
706  /* Verify UDP length */
707  if (is_ip4)
708  ip_len0 = clib_net_to_host_u16 (ip40->length);
709  else
710  ip_len0 = clib_net_to_host_u16 (ip60->payload_length);
711  udp_len0 = clib_net_to_host_u16 (udp0->length);
712  len_diff0 = ip_len0 - udp_len0;
713 
714  /* Verify UDP checksum */
715  if (PREDICT_FALSE (!good_udp0))
716  {
717  if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
718  {
719  if (is_ip4)
720  flags0 = ip4_tcp_udp_validate_checksum (vm, b0);
721  else
722  flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0);
723  good_udp0 =
724  (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
725  }
726  }
727 
728  if (is_ip4)
729  {
730  error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
731  error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
732  }
733  else
734  {
735  error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
736  error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
737  }
738 
739  next0 = error0 ?
742  b0->error = error0 ? error_node->errors[error0] : 0;
743 
744  /* vxlan-gbp-input node expect current at VXLAN_GBP header */
745  if (is_ip4)
747  sizeof (ip4_header_t) +
748  sizeof (udp_header_t));
749  else
751  sizeof (ip6_header_t) +
752  sizeof (udp_header_t));
753 
754  exit0:
755  /* Process packet 1 */
756  if (proto1 != IP_PROTOCOL_UDP)
757  goto exit1; /* not UDP packet */
758 
759  if (is_ip4)
760  udp1 = ip4_next_header (ip41);
761  else
762  udp1 = ip6_next_header (ip61);
763 
764  if (udp1->dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
765  goto exit1; /* not VXLAN_GBP packet */
766 
767  /* Validate DIP against VTEPs */
768  if (is_ip4)
769  {
770  if (addr4.as_u32 != ip41->dst_address.as_u32)
771  {
772  if (!hash_get (vxm->vtep4, ip41->dst_address.as_u32))
773  goto exit1; /* no local VTEP for VXLAN_GBP packet */
774  addr4 = ip41->dst_address;
775  }
776  }
777  else
778  {
779  if (!ip6_address_is_equal (&addr6, &ip61->dst_address))
780  {
781  if (!hash_get_mem (vxm->vtep6, &ip61->dst_address))
782  goto exit1; /* no local VTEP for VXLAN_GBP packet */
783  addr6 = ip61->dst_address;
784  }
785  }
786 
787  flags1 = b1->flags;
788  good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
789 
790  /* Don't verify UDP checksum for packets with explicit zero checksum. */
791  good_udp1 |= udp1->checksum == 0;
792 
793  /* Verify UDP length */
794  if (is_ip4)
795  ip_len1 = clib_net_to_host_u16 (ip41->length);
796  else
797  ip_len1 = clib_net_to_host_u16 (ip61->payload_length);
798  udp_len1 = clib_net_to_host_u16 (udp1->length);
799  len_diff1 = ip_len1 - udp_len1;
800 
801  /* Verify UDP checksum */
802  if (PREDICT_FALSE (!good_udp1))
803  {
804  if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
805  {
806  if (is_ip4)
807  flags1 = ip4_tcp_udp_validate_checksum (vm, b1);
808  else
809  flags1 = ip6_tcp_udp_icmp_validate_checksum (vm, b1);
810  good_udp1 =
811  (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
812  }
813  }
814 
815  if (is_ip4)
816  {
817  error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
818  error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
819  }
820  else
821  {
822  error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
823  error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
824  }
825 
826  next1 = error1 ?
829  b1->error = error1 ? error_node->errors[error1] : 0;
830 
831  /* vxlan_gbp-input node expect current at VXLAN_GBP header */
832  if (is_ip4)
834  sizeof (ip4_header_t) +
835  sizeof (udp_header_t));
836  else
838  sizeof (ip6_header_t) +
839  sizeof (udp_header_t));
840 
841  exit1:
842  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
843  to_next, n_left_to_next,
844  bi0, bi1, next0, next1);
845  }
846 
847  while (n_left_from > 0 && n_left_to_next > 0)
848  {
849  vlib_buffer_t *b0;
850  ip4_header_t *ip40;
851  ip6_header_t *ip60;
852  udp_header_t *udp0;
853  u32 bi0, ip_len0, udp_len0, flags0, next0;
854  i32 len_diff0;
855  u8 error0, good_udp0, proto0;
856 
857  bi0 = to_next[0] = from[0];
858  from += 1;
859  n_left_from -= 1;
860  to_next += 1;
861  n_left_to_next -= 1;
862 
863  b0 = vlib_get_buffer (vm, bi0);
864  if (is_ip4)
865  ip40 = vlib_buffer_get_current (b0);
866  else
867  ip60 = vlib_buffer_get_current (b0);
868 
869  /* Setup packet for next IP feature */
870  vnet_feature_next (&next0, b0);
871 
872  if (is_ip4)
873  /* Treat IP4 frag packets as "experimental" protocol for now
874  until support of IP frag reassembly is implemented */
875  proto0 = ip4_is_fragment (ip40) ? 0xfe : ip40->protocol;
876  else
877  proto0 = ip60->protocol;
878 
879  if (proto0 != IP_PROTOCOL_UDP)
880  goto exit; /* not UDP packet */
881 
882  if (is_ip4)
883  udp0 = ip4_next_header (ip40);
884  else
885  udp0 = ip6_next_header (ip60);
886 
887  if (udp0->dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
888  goto exit; /* not VXLAN_GBP packet */
889 
890  /* Validate DIP against VTEPs */
891  if (is_ip4)
892  {
893  if (addr4.as_u32 != ip40->dst_address.as_u32)
894  {
895  if (!hash_get (vxm->vtep4, ip40->dst_address.as_u32))
896  goto exit; /* no local VTEP for VXLAN_GBP packet */
897  addr4 = ip40->dst_address;
898  }
899  }
900  else
901  {
902  if (!ip6_address_is_equal (&addr6, &ip60->dst_address))
903  {
904  if (!hash_get_mem (vxm->vtep6, &ip60->dst_address))
905  goto exit; /* no local VTEP for VXLAN_GBP packet */
906  addr6 = ip60->dst_address;
907  }
908  }
909 
910  flags0 = b0->flags;
911  good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
912 
913  /* Don't verify UDP checksum for packets with explicit zero checksum. */
914  good_udp0 |= udp0->checksum == 0;
915 
916  /* Verify UDP length */
917  if (is_ip4)
918  ip_len0 = clib_net_to_host_u16 (ip40->length);
919  else
920  ip_len0 = clib_net_to_host_u16 (ip60->payload_length);
921  udp_len0 = clib_net_to_host_u16 (udp0->length);
922  len_diff0 = ip_len0 - udp_len0;
923 
924  /* Verify UDP checksum */
925  if (PREDICT_FALSE (!good_udp0))
926  {
927  if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
928  {
929  if (is_ip4)
930  flags0 = ip4_tcp_udp_validate_checksum (vm, b0);
931  else
932  flags0 = ip6_tcp_udp_icmp_validate_checksum (vm, b0);
933  good_udp0 =
934  (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
935  }
936  }
937 
938  if (is_ip4)
939  {
940  error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
941  error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
942  }
943  else
944  {
945  error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
946  error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
947  }
948 
949  next0 = error0 ?
952  b0->error = error0 ? error_node->errors[error0] : 0;
953 
954  /* vxlan_gbp-input node expect current at VXLAN_GBP header */
955  if (is_ip4)
957  sizeof (ip4_header_t) +
958  sizeof (udp_header_t));
959  else
961  sizeof (ip6_header_t) +
962  sizeof (udp_header_t));
963 
964  exit:
965  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
966  to_next, n_left_to_next,
967  bi0, next0);
968  }
969 
970  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
971  }
972 
973  return frame->n_vectors;
974 }
975 
977  vlib_node_runtime_t * node,
978  vlib_frame_t * frame)
979 {
980  return ip_vxlan_gbp_bypass_inline (vm, node, frame, /* is_ip4 */ 1);
981 }
982 
983 /* *INDENT-OFF* */
985 {
986  .name = "ip4-vxlan-gbp-bypass",
987  .vector_size = sizeof (u32),
988  .n_next_nodes = IP_VXLAN_GBP_BYPASS_N_NEXT,
989  .next_nodes = {
990  [IP_VXLAN_GBP_BYPASS_NEXT_DROP] = "error-drop",
991  [IP_VXLAN_GBP_BYPASS_NEXT_VXLAN_GBP] = "vxlan4-gbp-input",
992  },
993  .format_buffer = format_ip4_header,
994  .format_trace = format_ip4_forward_next_trace,
995 };
996 /* *INDENT-ON* */
997 
998 #ifndef CLIB_MARCH_VARIANT
999 /* Dummy init function to get us linked in. */
1000 clib_error_t *
1002 {
1003  return 0;
1004 }
1005 
1007 #endif /* CLIB_MARCH_VARIANT */
1008 
1010  vlib_node_runtime_t * node,
1011  vlib_frame_t * frame)
1012 {
1013  return ip_vxlan_gbp_bypass_inline (vm, node, frame, /* is_ip4 */ 0);
1014 }
1015 
1016 /* *INDENT-OFF* */
1018 {
1019  .name = "ip6-vxlan-gbp-bypass",
1020  .vector_size = sizeof (u32),
1021  .n_next_nodes = IP_VXLAN_GBP_BYPASS_N_NEXT,
1022  .next_nodes = {
1023  [IP_VXLAN_GBP_BYPASS_NEXT_DROP] = "error-drop",
1024  [IP_VXLAN_GBP_BYPASS_NEXT_VXLAN_GBP] = "vxlan6-gbp-input",
1025  },
1026  .format_buffer = format_ip6_header,
1027  .format_trace = format_ip6_forward_next_trace,
1028 };
1029 /* *INDENT-ON* */
1030 
1031 #ifndef CLIB_MARCH_VARIANT
1032 /* Dummy init function to get us linked in. */
1033 clib_error_t *
1035 {
1036  return 0;
1037 }
1038 
1040 #endif /* CLIB_MARCH_VARIANT */
1041 
1042 /*
1043  * fd.io coding-style-patch-verification: ON
1044  *
1045  * Local Variables:
1046  * eval: (c-set-style "gnu")
1047  * End:
1048  */
u32 sw_if_index
Definition: ipsec_gre.api:37
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:124
#define CLIB_UNUSED(x)
Definition: clib.h:82
clib_bihash_24_8_t vxlan6_gbp_tunnel_by_key
Definition: vxlan_gbp.h:170
static uword vxlan_gbp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
Definition: decap.c:188
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
Definition: counter.h:220
ip4_address_t src_address
Definition: ip4_packet.h:170
#define vnet_buffer2(b)
Definition: buffer.h:428
static vxlan_gbp_flags_t vxlan_gbp_get_flags(vxlan_gbp_header_t *h)
vnet_interface_main_t interface_main
Definition: vnet.h:56
format_function_t format_ip4_header
Definition: format.h:83
#define PREDICT_TRUE(x)
Definition: clib.h:112
u64 as_u64[2]
Definition: ip6_packet.h:51
unsigned long u64
Definition: types.h:89
vxlan_gbp_input_next_t
Definition: vxlan_gbp.h:140
#define NULL
Definition: clib.h:58
static u32 buf_fib_index(vlib_buffer_t *b, u32 is_ip4)
Definition: decap.c:52
vlib_node_registration_t ip4_vxlan_gbp_bypass_node
(constructor) VLIB_REGISTER_NODE (ip4_vxlan_gbp_bypass_node)
Definition: decap.c:984
u8 data[0]
Packet data.
Definition: buffer.h:181
#define foreach_vxlan_gbp_input_next
Definition: vxlan_gbp.h:133
vxlan_gbp_main_t vxlan_gbp_main
Definition: vxlan_gbp.c:33
static vxlan_gbp_tunnel_t * vxlan6_gbp_find_tunnel(vxlan_gbp_main_t *vxm, last_tunnel_cache6 *cache, u32 fib_index, ip6_header_t *ip6_0, vxlan_gbp_header_t *vxlan_gbp0)
Definition: decap.c:116
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip4.h:112
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
#define VLIB_NODE_FN(node)
Definition: node.h:201
static uword ip4_address_is_multicast(const ip4_address_t *a)
Definition: ip4_packet.h:318
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:469
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:366
ip6_address_t src_address
Definition: ip6_packet.h:385
unsigned char u8
Definition: types.h:56
static int ip4_is_fragment(const ip4_header_t *i)
Definition: ip4_packet.h:213
static int clib_bihash_key_compare_24_8(u64 *a, u64 *b)
Definition: bihash_24_8.h:67
static u8 * format_vxlan_gbp_rx_trace(u8 *s, va_list *args)
Definition: decap.c:33
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
#define always_inline
Definition: clib.h:98
ip4_address_t dst_address
Definition: ip4_packet.h:170
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:824
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:203
static void * ip4_next_header(ip4_header_t *i)
Definition: ip4_packet.h:241
unsigned int u32
Definition: types.h:88
static char * vxlan_gbp_error_strings[]
Definition: decap.c:531
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:136
static vxlan_gbp_gpflags_t vxlan_gbp_get_gpflags(vxlan_gbp_header_t *h)
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
vlib_punt_reason_t punt_no_such_tunnel[FIB_PROTOCOL_IP_MAX]
Punt reasons for no such tunnel.
Definition: vxlan_gbp.h:196
vlib_node_registration_t ip4_input_node
Global ip4 input node.
Definition: ip4_input.c:317
clib_bihash_16_8_t vxlan4_gbp_tunnel_by_key
Definition: vxlan_gbp.h:169
static uword ip_vxlan_gbp_bypass_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 is_ip4)
Definition: decap.c:578
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:229
static vxlan_gbp_input_next_t vxlan_gbp_tunnel_get_next(const vxlan_gbp_tunnel_t *t, vlib_buffer_t *b0)
Definition: decap.c:164
ip_vxlan_gbp_bypass_next_t
Definition: decap.c:570
#define PREDICT_FALSE(x)
Definition: clib.h:111
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
Definition: ip4_forward.c:1189
#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
vxlan4_tunnel_key_t last_tunnel_cache4
Definition: decap.c:63
clib_error_t * ip6_vxlan_gbp_bypass_init(vlib_main_t *vm)
Definition: decap.c:1034
#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
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1180
u32 punt_reason
Definition: buffer.h:149
vlib_node_registration_t vxlan4_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gbp_input_node)
Definition: decap.c:539
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
static u16 vxlan_gbp_get_sclass(vxlan_gbp_header_t *h)
u16 n_vectors
Definition: node.h:395
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:212
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:80
vlib_main_t * vm
Definition: buffer.c:312
static void ip6_address_set_zero(ip6_address_t *a)
Definition: ip6_packet.h:278
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:295
static u32 vxlan_gbp_get_vni(vxlan_gbp_header_t *h)
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:89
vlib_node_registration_t vxlan6_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gbp_input_node)
Definition: decap.c:554
vxlan6_tunnel_key_t last_tunnel_cache6
Definition: decap.c:134
clib_error_t * ip4_vxlan_gbp_bypass_init(vlib_main_t *vm)
Definition: decap.c:1001
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:465
static void * ip6_next_header(ip6_header_t *i)
Definition: ip6_packet.h:412
signed int i32
Definition: types.h:77
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:514
ip6_main_t ip6_main
Definition: ip6_forward.c:2688
static vxlan_gbp_tunnel_t * vxlan4_gbp_find_tunnel(vxlan_gbp_main_t *vxm, last_tunnel_cache4 *cache, u32 fib_index, ip4_header_t *ip4_0, vxlan_gbp_header_t *vxlan_gbp0)
Definition: decap.c:68
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:248
format_function_t format_ip6_header
Definition: format.h:97
static uword ip6_address_is_equal(const ip6_address_t *a, const ip6_address_t *b)
Definition: ip6_packet.h:242
static uword ip6_address_is_multicast(const ip6_address_t *a)
Definition: ip6_packet.h:172
ip46_address_t src
Definition: vxlan_gbp.h:85
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
#define vec_elt(v, i)
Get vector value at index i.
Definition: defs.h:47
vlib_node_registration_t ip6_vxlan_gbp_bypass_node
(constructor) VLIB_REGISTER_NODE (ip6_vxlan_gbp_bypass_node)
Definition: decap.c:1017
u16 payload_length
Definition: ip6_packet.h:376
u32 ip6_tcp_udp_icmp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
Definition: ip6_forward.c:1031
static void vnet_update_l2_len(vlib_buffer_t *b)
Definition: l2_input.h:226
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
VLIB buffer representation.
Definition: buffer.h:102
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
u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
Definition: ip4_forward.c:990
A collection of combined counters.
Definition: counter.h:188
vxlan_gbp_tunnel_t * tunnels
Definition: vxlan_gbp.h:166
#define hash_get_mem(h, key)
Definition: hash.h:269
#define vnet_buffer(b)
Definition: buffer.h:369
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:905
u16 flags
Copy of main node flags.
Definition: node.h:508
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:301
vxlan_gbp_tunnel_mode_t mode
Tunnel mode.
Definition: vxlan_gbp.h:105
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
u32 * fib_index_by_sw_if_index
Definition: ip6.h:194
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:85
Definition: defs.h:46
ip6_address_t dst_address
Definition: ip6_packet.h:385
vnet_main_t * vnet_main
Definition: vxlan_gbp.h:188
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)
Definition: ip6_forward.c:803