FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
gtpu.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Intel and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 #include <stdint.h>
18 #include <net/if.h>
19 #include <sys/ioctl.h>
20 #include <inttypes.h>
21 
22 #include <vlib/vlib.h>
23 #include <vlib/unix/unix.h>
24 #include <vnet/ethernet/ethernet.h>
25 #include <vnet/fib/fib_entry.h>
26 #include <vnet/fib/fib_table.h>
28 #include <vnet/mfib/mfib_table.h>
29 #include <vnet/adj/adj_mcast.h>
30 #include <vnet/dpo/dpo.h>
31 #include <vnet/plugin/plugin.h>
32 #include <vpp/app/version.h>
33 #include <gtpu/gtpu.h>
34 #include <vnet/flow/flow.h>
35 
37 
38 /* *INDENT-OFF* */
39 VNET_FEATURE_INIT (ip4_gtpu_bypass, static) = {
40  .arc_name = "ip4-unicast",
41  .node_name = "ip4-gtpu-bypass",
42  .runs_before = VNET_FEATURES ("ip4-lookup"),
43 };
44 
45 VNET_FEATURE_INIT (ip6_gtpu_bypass, static) = {
46  .arc_name = "ip6-unicast",
47  .node_name = "ip6-gtpu-bypass",
48  .runs_before = VNET_FEATURES ("ip6-lookup"),
49 };
50 /* *INDENT-on* */
51 
52 u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
53 {
54  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
55  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
57  = va_arg (*args, gtpu_encap_trace_t *);
58 
59  s = format (s, "GTPU encap to gtpu_tunnel%d tteid %d",
60  t->tunnel_index, t->tteid);
61  return s;
62 }
63 
64 static u8 *
65 format_decap_next (u8 * s, va_list * args)
66 {
67  u32 next_index = va_arg (*args, u32);
68 
69  switch (next_index)
70  {
71  case GTPU_INPUT_NEXT_DROP:
72  return format (s, "drop");
73  case GTPU_INPUT_NEXT_L2_INPUT:
74  return format (s, "l2");
75  case GTPU_INPUT_NEXT_IP4_INPUT:
76  return format (s, "ip4");
77  case GTPU_INPUT_NEXT_IP6_INPUT:
78  return format (s, "ip6");
79  default:
80  return format (s, "index %d", next_index);
81  }
82  return s;
83 }
84 
85 u8 *
86 format_gtpu_tunnel (u8 * s, va_list * args)
87 {
88  gtpu_tunnel_t *t = va_arg (*args, gtpu_tunnel_t *);
89  gtpu_main_t *ngm = &gtpu_main;
90  ip4_main_t *im4 = &ip4_main;
91  ip6_main_t *im6 = &ip6_main;
93 
94  u32 encap_vrf_id =
97 
98  s = format (s, "[%d] src %U dst %U teid %d tteid %d "
99  "encap-vrf-id %d sw-if-idx %d ",
100  t - ngm->tunnels,
103  t->teid, t->tteid, encap_vrf_id, t->sw_if_index);
104 
105  s = format (s, "encap-dpo-idx %d ", t->next_dpo.dpoi_index);
106  s = format (s, "decap-next-%U ", format_decap_next, t->decap_next_index);
107 
109  s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index);
110 
111  return s;
112 }
113 
114 static u8 *
115 format_gtpu_name (u8 * s, va_list * args)
116 {
117  u32 dev_instance = va_arg (*args, u32);
118  return format (s, "gtpu_tunnel%d", dev_instance);
119 }
120 
121 static clib_error_t *
123 {
124  u32 hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
126  vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
127 
128  return /* no error */ 0;
129 }
130 
131 /* *INDENT-OFF* */
132 VNET_DEVICE_CLASS (gtpu_device_class,static) = {
133  .name = "GTPU",
134  .format_device_name = format_gtpu_name,
135  .format_tx_trace = format_gtpu_encap_trace,
136  .admin_up_down_function = gtpu_interface_admin_up_down,
137 };
138 /* *INDENT-ON* */
139 
140 static u8 *
141 format_gtpu_header_with_length (u8 * s, va_list * args)
142 {
143  u32 dev_instance = va_arg (*args, u32);
144  s = format (s, "unimplemented dev %u", dev_instance);
145  return s;
146 }
147 
148 /* *INDENT-OFF* */
149 VNET_HW_INTERFACE_CLASS (gtpu_hw_class) =
150 {
151  .name = "GTPU",
152  .format_header = format_gtpu_header_with_length,
153  .build_rewrite = default_build_rewrite,
155 };
156 /* *INDENT-ON* */
157 
158 static void
160 {
161  dpo_id_t dpo = DPO_INVALID;
162  u32 encap_index = ip46_address_is_ip4 (&t->dst) ?
163  gtpu4_encap_node.index : gtpu6_encap_node.index;
166 
167  fib_entry_contribute_forwarding (t->fib_entry_index, forw_type, &dpo);
168  dpo_stack_from_node (encap_index, &t->next_dpo, &dpo);
169  dpo_reset (&dpo);
170 }
171 
172 static gtpu_tunnel_t *
174 {
175  return ((gtpu_tunnel_t *) (((char *) node) -
177 }
178 
179 /**
180  * Function definition to backwalk a FIB node -
181  * Here we will restack the new dpo of GTPU DIP to encap node.
182  */
185 {
188 }
189 
190 /**
191  * Function definition to get a FIB node from its index
192  */
193 static fib_node_t *
195 {
196  gtpu_tunnel_t *t;
197  gtpu_main_t *gtm = &gtpu_main;
198 
199  t = pool_elt_at_index (gtm->tunnels, index);
200 
201  return (&t->node);
202 }
203 
204 /**
205  * Function definition to inform the FIB node that its last lock has gone.
206  */
207 static void
209 {
210  /*
211  * The GTPU tunnel is a root of the graph. As such
212  * it never has children and thus is never locked.
213  */
214  ASSERT (0);
215 }
216 
217 /*
218  * Virtual function table registered by GTPU tunnels
219  * for participation in the FIB object graph.
220  */
221 const static fib_node_vft_t gtpu_vft = {
223  .fnv_last_lock = gtpu_tunnel_last_lock_gone,
224  .fnv_back_walk = gtpu_tunnel_back_walk,
225 };
226 
227 
228 #define foreach_copy_field \
229 _(teid) \
230 _(tteid) \
231 _(mcast_sw_if_index) \
232 _(encap_fib_index) \
233 _(decap_next_index) \
234 _(src) \
235 _(dst)
236 
237 static void
239 {
240  union
241  {
242  ip4_gtpu_header_t *h4;
243  ip6_gtpu_header_t *h6;
244  u8 *rw;
245  } r =
246  {
247  .rw = 0};
248  int len = is_ip6 ? sizeof *r.h6 : sizeof *r.h4;
249 
251 
252  udp_header_t *udp;
253  gtpu_header_t *gtpu;
254  /* Fixed portion of the (outer) ip header */
255  if (!is_ip6)
256  {
257  ip4_header_t *ip = &r.h4->ip4;
258  udp = &r.h4->udp;
259  gtpu = &r.h4->gtpu;
260  ip->ip_version_and_header_length = 0x45;
261  ip->ttl = 254;
262  ip->protocol = IP_PROTOCOL_UDP;
263 
264  ip->src_address = t->src.ip4;
265  ip->dst_address = t->dst.ip4;
266 
267  /* we fix up the ip4 header length and checksum after-the-fact */
268  ip->checksum = ip4_header_checksum (ip);
269  }
270  else
271  {
272  ip6_header_t *ip = &r.h6->ip6;
273  udp = &r.h6->udp;
274  gtpu = &r.h6->gtpu;
275  ip->ip_version_traffic_class_and_flow_label =
276  clib_host_to_net_u32 (6 << 28);
277  ip->hop_limit = 255;
278  ip->protocol = IP_PROTOCOL_UDP;
279 
280  ip->src_address = t->src.ip6;
281  ip->dst_address = t->dst.ip6;
282  }
283 
284  /* UDP header, randomize src port on something, maybe? */
285  udp->src_port = clib_host_to_net_u16 (2152);
286  udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_GTPU);
287 
288  /* GTPU header */
290  gtpu->type = GTPU_TYPE_GTPU;
291  gtpu->teid = clib_host_to_net_u32 (t->tteid);
292 
293  t->rewrite = r.rw;
294  /* Now only support 8-byte gtpu header. TBD */
295  _vec_len (t->rewrite) = sizeof (ip4_gtpu_header_t) - 4;
296 
297  return;
298 }
299 
300 static bool
302 {
303  vlib_main_t *vm = gtm->vlib_main;
304  u32 input_idx = (!is_ip6) ? gtpu4_input_node.index : gtpu6_input_node.index;
306 
307  return decap_next_index < r->n_next_nodes;
308 }
309 
310 typedef CLIB_PACKED (union
311  {
312  struct
313  {
314  fib_node_index_t mfib_entry_index;
315  adj_index_t mcast_adj_index;
316  }; u64 as_u64;
317  }) mcast_shared_t;
318 
319 static inline mcast_shared_t
320 mcast_shared_get (ip46_address_t * ip)
321 {
324  ALWAYS_ASSERT (p);
325  return (mcast_shared_t)
326  {
327  .as_u64 = *p};
328 }
329 
330 static inline void
331 mcast_shared_add (ip46_address_t * dst, fib_node_index_t mfei, adj_index_t ai)
332 {
333  mcast_shared_t new_ep = {
334  .mcast_adj_index = ai,
335  .mfib_entry_index = mfei,
336  };
337 
338  hash_set_mem_alloc (&gtpu_main.mcast_shared, dst, new_ep.as_u64);
339 }
340 
341 static inline void
342 mcast_shared_remove (ip46_address_t * dst)
343 {
344  mcast_shared_t ep = mcast_shared_get (dst);
345 
346  adj_unlock (ep.mcast_adj_index);
347  mfib_table_entry_delete_index (ep.mfib_entry_index, MFIB_SOURCE_GTPU);
348 
350 }
351 
354 {
355  gtpu_main_t *gtm = &gtpu_main;
356  gtpu_tunnel_t *t = 0;
357  vnet_main_t *vnm = gtm->vnet_main;
358  uword *p;
359  u32 hw_if_index = ~0;
360  u32 sw_if_index = ~0;
361  gtpu4_tunnel_key_t key4;
362  gtpu6_tunnel_key_t key6;
363  bool is_ip6 = !ip46_address_is_ip4 (&a->dst);
364 
365  if (!is_ip6)
366  {
367  key4.src = a->dst.ip4.as_u32; /* decap src in key is encap dst in config */
368  key4.teid = clib_host_to_net_u32 (a->teid);
369  p = hash_get (gtm->gtpu4_tunnel_by_key, key4.as_u64);
370  }
371  else
372  {
373  key6.src = a->dst.ip6;
374  key6.teid = clib_host_to_net_u32 (a->teid);
375  p = hash_get_mem (gtm->gtpu6_tunnel_by_key, &key6);
376  }
377 
378  if (a->opn == GTPU_ADD_TUNNEL)
379  {
380  l2input_main_t *l2im = &l2input_main;
381 
382  /* adding a tunnel: tunnel must not already exist */
383  if (p)
384  return VNET_API_ERROR_TUNNEL_EXIST;
385 
386  /*if not set explicitly, default to l2 */
387  if (a->decap_next_index == ~0)
388  a->decap_next_index = GTPU_INPUT_NEXT_L2_INPUT;
389  if (!gtpu_decap_next_is_valid (gtm, is_ip6, a->decap_next_index))
390  return VNET_API_ERROR_INVALID_DECAP_NEXT;
391 
393  clib_memset (t, 0, sizeof (*t));
394 
395  /* copy from arg structure */
396 #define _(x) t->x = a->x;
398 #undef _
399 
400  /* default to same as local rx teid */
401  if (t->tteid == 0)
402  t->tteid = t->teid;
403 
405 
406  /* clear the flow index */
407  t->flow_index = ~0;
408 
409  /* copy the key */
410  if (is_ip6)
412  t - gtm->tunnels);
413  else
414  hash_set (gtm->gtpu4_tunnel_by_key, key4.as_u64, t - gtm->tunnels);
415 
418  {
420  hw_if_index = gtm->free_gtpu_tunnel_hw_if_indices
422  _vec_len (gtm->free_gtpu_tunnel_hw_if_indices) -= 1;
423 
424  hi = vnet_get_hw_interface (vnm, hw_if_index);
425  hi->dev_instance = t - gtm->tunnels;
426  hi->hw_instance = hi->dev_instance;
427 
428  /* clear old stats of freed tunnel before reuse */
429  sw_if_index = hi->sw_if_index;
433  sw_if_index);
436  sw_if_index);
439  sw_if_index);
441  }
442  else
443  {
444  hw_if_index = vnet_register_interface
445  (vnm, gtpu_device_class.index, t - gtm->tunnels,
446  gtpu_hw_class.index, t - gtm->tunnels);
447  hi = vnet_get_hw_interface (vnm, hw_if_index);
448  }
449 
450  /* Set gtpu tunnel output node */
451  u32 encap_index = !is_ip6 ?
452  gtpu4_encap_node.index : gtpu6_encap_node.index;
453  vnet_set_interface_output_node (vnm, hw_if_index, encap_index);
454 
455  t->hw_if_index = hw_if_index;
456  t->sw_if_index = sw_if_index = hi->sw_if_index;
457 
459  ~0);
461 
462  /* setup l2 input config with l2 feature and bd 0 to drop packet */
464  l2im->configs[sw_if_index].feature_bitmap = L2INPUT_FEAT_DROP;
465  l2im->configs[sw_if_index].bd_index = 0;
466 
471 
472  fib_node_init (&t->node, gtm->fib_node_type);
473  fib_prefix_t tun_dst_pfx;
475 
476  fib_prefix_from_ip46_addr (&t->dst, &tun_dst_pfx);
477  if (!ip46_address_is_multicast (&t->dst))
478  {
479  /* Unicast tunnel -
480  * Track the FIB entry for the tunnel's destination.
481  * The tunnel will then get poked
482  * when the forwarding for the entry updates, and the tunnel can
483  * re-stack accordingly
484  */
485  vtep_addr_ref (&gtm->vtep_table, t->encap_fib_index, &t->src);
487  &tun_dst_pfx,
488  gtm->fib_node_type,
489  t - gtm->tunnels,
490  &t->sibling_index);
492  }
493  else
494  {
495  /* Multicast tunnel -
496  * as the same mcast group can be used for multiple mcast tunnels
497  * with different VNIs, create the output adjacency only if
498  * it does not already exist
499  */
501 
502  if (vtep_addr_ref (&gtm->vtep_table,
503  t->encap_fib_index, &t->dst) == 1)
504  {
505  fib_node_index_t mfei;
506  adj_index_t ai;
508  .frp_proto = fib_proto_to_dpo (fp),
509  .frp_addr = zero_addr,
510  .frp_sw_if_index = 0xffffffff,
511  .frp_fib_index = ~0,
512  .frp_weight = 1,
513  .frp_flags = FIB_ROUTE_PATH_LOCAL,
514  .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
515  };
516  const mfib_prefix_t mpfx = {
517  .fp_proto = fp,
518  .fp_len = (is_ip6 ? 128 : 32),
519  .fp_grp_addr = tun_dst_pfx.fp_addr,
520  };
521 
522  /*
523  * Setup the (*,G) to receive traffic on the mcast group
524  * - the forwarding interface is for-us
525  * - the accepting interface is that from the API
526  */
528  &mpfx, MFIB_SOURCE_GTPU, &path);
529 
530  path.frp_sw_if_index = a->mcast_sw_if_index;
531  path.frp_flags = FIB_ROUTE_PATH_FLAG_NONE;
532  path.frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT;
534  &mpfx,
536 
537  /*
538  * Create the mcast adjacency to send traffic to the group
539  */
540  ai = adj_mcast_add_or_lock (fp,
541  fib_proto_to_link (fp),
542  a->mcast_sw_if_index);
543 
544  /*
545  * create a new end-point
546  */
547  mcast_shared_add (&t->dst, mfei, ai);
548  }
549 
550  dpo_id_t dpo = DPO_INVALID;
551  mcast_shared_t ep = mcast_shared_get (&t->dst);
552 
553  /* Stack shared mcast dst mac addr rewrite on encap */
555  fib_proto_to_dpo (fp), ep.mcast_adj_index);
556 
557  dpo_stack_from_node (encap_index, &t->next_dpo, &dpo);
558 
559  dpo_reset (&dpo);
560  flood_class = VNET_FLOOD_CLASS_TUNNEL_MASTER;
561  }
562 
564  flood_class;
565  }
566  else
567  {
568  /* mod-tteid or deleting a tunnel: tunnel must exist */
569  if (!p)
570  return VNET_API_ERROR_NO_SUCH_ENTRY;
571 
572  t = pool_elt_at_index (gtm->tunnels, p[0]);
574 
575  if (a->opn == GTPU_UPD_TTEID)
576  {
577  if (a->tteid == 0)
578  return VNET_API_ERROR_INVALID_VALUE;
579  t->tteid = a->tteid;
581  return 0;
582  }
583 
584  /* delete tunnel */
585  vnet_sw_interface_set_flags (vnm, t->sw_if_index, 0 /* down */ );
588 
589  /* make sure tunnel is removed from l2 bd or xconnect */
590  set_int_l2_mode (gtm->vlib_main, vnm, MODE_L3, t->sw_if_index, 0,
591  L2_BD_PORT_TYPE_NORMAL, 0, 0);
593 
595 
596  if (!is_ip6)
597  hash_unset (gtm->gtpu4_tunnel_by_key, key4.as_u64);
598  else
600 
601  if (!ip46_address_is_multicast (&t->dst))
602  {
603  if (t->flow_index != ~0)
604  vnet_flow_del (vnm, t->flow_index);
605 
608  }
609  else if (vtep_addr_unref (&gtm->vtep_table,
610  t->encap_fib_index, &t->dst) == 0)
611  {
612  mcast_shared_remove (&t->dst);
613  }
614 
615  fib_node_deinit (&t->node);
616  vec_free (t->rewrite);
617  pool_put (gtm->tunnels, t);
618  }
619 
620  if (sw_if_indexp)
621  *sw_if_indexp = sw_if_index;
622 
623  if (a->opn == GTPU_ADD_TUNNEL)
624  {
625  /* register udp ports */
626  if (!is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_GTPU, 1))
627  udp_register_dst_port (gtm->vlib_main, UDP_DST_PORT_GTPU,
628  gtpu4_input_node.index, /* is_ip4 */ 1);
629  if (is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_GTPU6, 0))
630  udp_register_dst_port (gtm->vlib_main, UDP_DST_PORT_GTPU6,
631  gtpu6_input_node.index, /* is_ip4 */ 0);
632  }
633 
634  return 0;
635 }
636 
637 static uword
639 {
640  gtpu_main_t *gtm = &gtpu_main;
641  vlib_main_t *vm = gtm->vlib_main;
642  uword input_node = (ipv4_set) ? gtpu4_input_node.index :
643  gtpu6_input_node.index;
644 
645  return vlib_node_add_next (vm, input_node, node_index);
646 }
647 
648 static uword
649 unformat_decap_next (unformat_input_t * input, va_list * args)
650 {
651  u32 *result = va_arg (*args, u32 *);
652  u32 ipv4_set = va_arg (*args, int);
653  gtpu_main_t *gtm = &gtpu_main;
654  vlib_main_t *vm = gtm->vlib_main;
655  u32 node_index;
656  u32 tmp;
657 
658  if (unformat (input, "l2"))
659  *result = GTPU_INPUT_NEXT_L2_INPUT;
660  else if (unformat (input, "ip4"))
661  *result = GTPU_INPUT_NEXT_IP4_INPUT;
662  else if (unformat (input, "ip6"))
663  *result = GTPU_INPUT_NEXT_IP6_INPUT;
664  else if (unformat (input, "node %U", unformat_vlib_node, vm, &node_index))
665  *result = get_decap_next_for_node (node_index, ipv4_set);
666  else if (unformat (input, "%d", &tmp))
667  *result = tmp;
668  else
669  return 0;
670 
671  return 1;
672 }
673 
674 static clib_error_t *
676  unformat_input_t * input,
677  vlib_cli_command_t * cmd)
678 {
679  unformat_input_t _line_input, *line_input = &_line_input;
680  ip46_address_t src, dst;
681  u8 opn = GTPU_ADD_TUNNEL;
682  u8 src_set = 0;
683  u8 dst_set = 0;
684  u8 grp_set = 0;
685  u8 ipv4_set = 0;
686  u8 ipv6_set = 0;
687  u32 encap_fib_index = 0;
688  u32 mcast_sw_if_index = ~0;
689  u32 decap_next_index = GTPU_INPUT_NEXT_L2_INPUT;
690  u32 teid = 0, tteid = 0;
691  u32 tmp;
692  int rv;
694  u32 tunnel_sw_if_index;
695  clib_error_t *error = NULL;
696 
697  /* Cant "universally zero init" (={0}) due to GCC bug 53119 */
698  clib_memset (&src, 0, sizeof src);
699  clib_memset (&dst, 0, sizeof dst);
700 
701  /* Get a line of input. */
702  if (!unformat_user (input, unformat_line_input, line_input))
703  return 0;
704 
705  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
706  {
707  if (unformat (line_input, "del"))
708  {
709  opn = GTPU_DEL_TUNNEL;
710  }
711  else if (unformat (line_input, "src %U",
712  unformat_ip4_address, &src.ip4))
713  {
714  src_set = 1;
715  ipv4_set = 1;
716  }
717  else if (unformat (line_input, "dst %U",
718  unformat_ip4_address, &dst.ip4))
719  {
720  dst_set = 1;
721  ipv4_set = 1;
722  }
723  else if (unformat (line_input, "src %U",
724  unformat_ip6_address, &src.ip6))
725  {
726  src_set = 1;
727  ipv6_set = 1;
728  }
729  else if (unformat (line_input, "dst %U",
730  unformat_ip6_address, &dst.ip6))
731  {
732  dst_set = 1;
733  ipv6_set = 1;
734  }
735  else if (unformat (line_input, "group %U %U",
739  {
740  grp_set = dst_set = 1;
741  ipv4_set = 1;
742  }
743  else if (unformat (line_input, "group %U %U",
747  {
748  grp_set = dst_set = 1;
749  ipv6_set = 1;
750  }
751  else if (unformat (line_input, "encap-vrf-id %d", &tmp))
752  {
753  encap_fib_index = fib_table_find (fib_ip_proto (ipv6_set), tmp);
754  if (encap_fib_index == ~0)
755  {
756  error =
757  clib_error_return (0, "nonexistent encap-vrf-id %d", tmp);
758  goto done;
759  }
760  }
761  else if (unformat (line_input, "decap-next %U", unformat_decap_next,
762  &decap_next_index, ipv4_set))
763  ;
764  else if (unformat (line_input, "teid %d", &teid))
765  ;
766  else if (unformat (line_input, "tteid %d", &tteid))
767  ;
768  else if (unformat (line_input, "upd-tteid %d", &tteid))
769  opn = GTPU_UPD_TTEID;
770  else
771  {
772  error = clib_error_return (0, "parse error: '%U'",
773  format_unformat_error, line_input);
774  goto done;
775  }
776  }
777 
778  if (teid == 0)
779  {
780  error = clib_error_return (0, "tunnel teid specified");
781  goto done;
782  }
783 
784  if (src_set == 0 && opn == GTPU_ADD_TUNNEL)
785  {
786  error = clib_error_return (0, "tunnel src address not specified");
787  goto done;
788  }
789 
790  if (dst_set == 0)
791  {
792  error = clib_error_return (0, "tunnel dst address not specified");
793  goto done;
794  }
795 
796  if (grp_set && !ip46_address_is_multicast (&dst))
797  {
798  error = clib_error_return (0, "tunnel group address not multicast");
799  goto done;
800  }
801 
802  if (grp_set == 0 && ip46_address_is_multicast (&dst))
803  {
804  error = clib_error_return (0, "dst address must be unicast");
805  goto done;
806  }
807 
808  if (grp_set && mcast_sw_if_index == ~0)
809  {
810  error = clib_error_return (0, "tunnel nonexistent multicast device");
811  goto done;
812  }
813 
814  if (ipv4_set && ipv6_set)
815  {
816  error = clib_error_return (0, "both IPv4 and IPv6 addresses specified");
817  goto done;
818  }
819 
820  if (ip46_address_cmp (&src, &dst) == 0)
821  {
822  error = clib_error_return (0, "src and dst addresses are identical");
823  goto done;
824  }
825 
826  if (decap_next_index == ~0)
827  {
828  error = clib_error_return (0, "next node not found");
829  goto done;
830  }
831 
832  clib_memset (a, 0, sizeof (*a));
833 
834  a->opn = opn;
835 
836 #define _(x) a->x = x;
838 #undef _
839 
840  rv = vnet_gtpu_add_mod_del_tunnel (a, &tunnel_sw_if_index);
841 
842  switch (rv)
843  {
844  case 0:
845  if (opn == GTPU_ADD_TUNNEL)
847  vnet_get_main (), tunnel_sw_if_index);
848  break;
849 
850  case VNET_API_ERROR_TUNNEL_EXIST:
851  error = clib_error_return (0, "tunnel already exists...");
852  goto done;
853 
854  case VNET_API_ERROR_NO_SUCH_ENTRY:
855  error = clib_error_return (0, "tunnel does not exist...");
856  goto done;
857 
858  case VNET_API_ERROR_INVALID_VALUE:
859  error = clib_error_return (0, "tx teid not specified...");
860  goto done;
861 
862  default:
864  (0, "vnet_gtpu_add_del_tunnel returned %d", rv);
865  goto done;
866  }
867 
868 done:
869  unformat_free (line_input);
870 
871  return error;
872 }
873 
874 /*?
875  * Add or delete a GTPU Tunnel.
876  *
877  * GTPU can be used to transport Ethernet packets as its PDU type to
878  * provides allow L2 network or bridge domains (BDs)
879  * to span multiple servers. This is done by building an L2 overlay on
880  * top of an L3 network underlay using GTPU tunnels.
881  *
882  * GTPU can also be used to transport IP packetes as its PDU type to
883  * allow IP forwarding over underlay network, e.g. between RAN and UPF
884  * for mobility deplyments.
885  *
886  * @cliexpar
887  * Example of how to create a GTPU Tunnel:
888  * @cliexcmd{create gtpu tunnel src 10.0.3.1 dst 10.0.3.3 teid 13 tteid 55 encap-vrf-id 7}
889  * Example of how to delete a GTPU Tunnel:
890  * @cliexcmd{create gtpu tunnel src 10.0.3.1 dst 10.0.3.3 teid 13 encap-vrf-id 7 del}
891  * Example of how to update tx TEID of a GTPU Tunnel:
892  * @cliexcmd{create gtpu tunnel src 10.0.3.1 dst 10.0.3.3 encap-vrf-id 7 upd-tteid 55}
893  ?*/
894 /* *INDENT-OFF* */
896  .path = "create gtpu tunnel",
897  .short_help =
898  "create gtpu tunnel src <local-tep-addr>"
899  " {dst <remote-tep-addr>|group <mcast-addr> <intf-name>}"
900  " teid <nn> [tteid <nn>] [encap-vrf-id <nn>]"
901  " [decap-next [l2|ip4|ip6|node <name>]] [del | upd-tteid <nn>]",
902  .function = gtpu_add_del_tunnel_command_fn,
903 };
904 /* *INDENT-ON* */
905 
906 static clib_error_t *
908  unformat_input_t * input,
909  vlib_cli_command_t * cmd)
910 {
911  gtpu_main_t *gtm = &gtpu_main;
912  gtpu_tunnel_t *t;
913 
914  if (pool_elts (gtm->tunnels) == 0)
915  vlib_cli_output (vm, "No gtpu tunnels configured...");
916 
917  pool_foreach (t, gtm->tunnels)
918  {
920  }
921 
922  return 0;
923 }
924 
925 /*?
926  * Display all the GTPU Tunnel entries.
927  *
928  * @cliexpar
929  * Example of how to display the GTPU Tunnel entries:
930  * @cliexstart{show gtpu tunnel}
931  * [0] src 10.0.3.1 dst 10.0.3.3 teid 13 tx-teid 55 encap_fib_index 0 sw_if_index 5 decap_next l2
932  * @cliexend
933  ?*/
934 /* *INDENT-OFF* */
936  .path = "show gtpu tunnel",
937  .short_help = "show gtpu tunnel",
938  .function = show_gtpu_tunnel_command_fn,
939 };
940 /* *INDENT-ON* */
941 
942 void
944 {
945  if (is_ip6)
946  vnet_feature_enable_disable ("ip6-unicast", "ip6-gtpu-bypass",
947  sw_if_index, is_enable, 0, 0);
948  else
949  vnet_feature_enable_disable ("ip4-unicast", "ip4-gtpu-bypass",
950  sw_if_index, is_enable, 0, 0);
951 }
952 
953 static clib_error_t *
955  unformat_input_t * input, vlib_cli_command_t * cmd)
956 {
957  unformat_input_t _line_input, *line_input = &_line_input;
958  vnet_main_t *vnm = vnet_get_main ();
959  clib_error_t *error = 0;
960  u32 sw_if_index, is_enable;
961 
962  sw_if_index = ~0;
963  is_enable = 1;
964 
965  if (!unformat_user (input, unformat_line_input, line_input))
966  return 0;
967 
968  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
969  {
970  if (unformat_user
971  (line_input, unformat_vnet_sw_interface, vnm, &sw_if_index))
972  ;
973  else if (unformat (line_input, "del"))
974  is_enable = 0;
975  else
976  {
977  error = unformat_parse_error (line_input);
978  goto done;
979  }
980  }
981 
982  if (~0 == sw_if_index)
983  {
984  error = clib_error_return (0, "unknown interface `%U'",
985  format_unformat_error, line_input);
986  goto done;
987  }
988 
990 
991 done:
992  unformat_free (line_input);
993 
994  return error;
995 }
996 
997 static clib_error_t *
999  unformat_input_t * input, vlib_cli_command_t * cmd)
1000 {
1001  return set_ip_gtpu_bypass (0, input, cmd);
1002 }
1003 
1004 /*?
1005  * This command adds the 'ip4-gtpu-bypass' graph node for a given interface.
1006  * By adding the IPv4 gtpu-bypass graph node to an interface, the node checks
1007  * for and validate input gtpu packet and bypass ip4-lookup, ip4-local,
1008  * ip4-udp-lookup nodes to speedup gtpu packet forwarding. This node will
1009  * cause extra overhead to for non-gtpu packets which is kept at a minimum.
1010  *
1011  * @cliexpar
1012  * @parblock
1013  * Example of graph node before ip4-gtpu-bypass is enabled:
1014  * @cliexstart{show vlib graph ip4-gtpu-bypass}
1015  * Name Next Previous
1016  * ip4-gtpu-bypass error-drop [0]
1017  * gtpu4-input [1]
1018  * ip4-lookup [2]
1019  * @cliexend
1020  *
1021  * Example of how to enable ip4-gtpu-bypass on an interface:
1022  * @cliexcmd{set interface ip gtpu-bypass GigabitEthernet2/0/0}
1023  *
1024  * Example of graph node after ip4-gtpu-bypass is enabled:
1025  * @cliexstart{show vlib graph ip4-gtpu-bypass}
1026  * Name Next Previous
1027  * ip4-gtpu-bypass error-drop [0] ip4-input
1028  * gtpu4-input [1] ip4-input-no-checksum
1029  * ip4-lookup [2]
1030  * @cliexend
1031  *
1032  * Example of how to display the feature enabled on an interface:
1033  * @cliexstart{show ip interface features GigabitEthernet2/0/0}
1034  * IP feature paths configured on GigabitEthernet2/0/0...
1035  * ...
1036  * ipv4 unicast:
1037  * ip4-gtpu-bypass
1038  * ip4-lookup
1039  * ...
1040  * @cliexend
1041  *
1042  * Example of how to disable ip4-gtpu-bypass on an interface:
1043  * @cliexcmd{set interface ip gtpu-bypass GigabitEthernet2/0/0 del}
1044  * @endparblock
1045 ?*/
1046 /* *INDENT-OFF* */
1048  .path = "set interface ip gtpu-bypass",
1049  .function = set_ip4_gtpu_bypass,
1050  .short_help = "set interface ip gtpu-bypass <interface> [del]",
1051 };
1052 /* *INDENT-ON* */
1053 
1054 static clib_error_t *
1056  unformat_input_t * input, vlib_cli_command_t * cmd)
1057 {
1058  return set_ip_gtpu_bypass (1, input, cmd);
1059 }
1060 
1061 /*?
1062  * This command adds the 'ip6-gtpu-bypass' graph node for a given interface.
1063  * By adding the IPv6 gtpu-bypass graph node to an interface, the node checks
1064  * for and validate input gtpu packet and bypass ip6-lookup, ip6-local,
1065  * ip6-udp-lookup nodes to speedup gtpu packet forwarding. This node will
1066  * cause extra overhead to for non-gtpu packets which is kept at a minimum.
1067  *
1068  * @cliexpar
1069  * @parblock
1070  * Example of graph node before ip6-gtpu-bypass is enabled:
1071  * @cliexstart{show vlib graph ip6-gtpu-bypass}
1072  * Name Next Previous
1073  * ip6-gtpu-bypass error-drop [0]
1074  * gtpu6-input [1]
1075  * ip6-lookup [2]
1076  * @cliexend
1077  *
1078  * Example of how to enable ip6-gtpu-bypass on an interface:
1079  * @cliexcmd{set interface ip6 gtpu-bypass GigabitEthernet2/0/0}
1080  *
1081  * Example of graph node after ip6-gtpu-bypass is enabled:
1082  * @cliexstart{show vlib graph ip6-gtpu-bypass}
1083  * Name Next Previous
1084  * ip6-gtpu-bypass error-drop [0] ip6-input
1085  * gtpu6-input [1] ip4-input-no-checksum
1086  * ip6-lookup [2]
1087  * @cliexend
1088  *
1089  * Example of how to display the feature enabled on an interface:
1090  * @cliexstart{show ip interface features GigabitEthernet2/0/0}
1091  * IP feature paths configured on GigabitEthernet2/0/0...
1092  * ...
1093  * ipv6 unicast:
1094  * ip6-gtpu-bypass
1095  * ip6-lookup
1096  * ...
1097  * @cliexend
1098  *
1099  * Example of how to disable ip6-gtpu-bypass on an interface:
1100  * @cliexcmd{set interface ip6 gtpu-bypass GigabitEthernet2/0/0 del}
1101  * @endparblock
1102 ?*/
1103 /* *INDENT-OFF* */
1105  .path = "set interface ip6 gtpu-bypass",
1106  .function = set_ip6_gtpu_bypass,
1107  .short_help = "set interface ip6 gtpu-bypass <interface> [del]",
1108 };
1109 /* *INDENT-ON* */
1110 
1111 int
1112 vnet_gtpu_add_del_rx_flow (u32 hw_if_index, u32 t_index, int is_add)
1113 {
1114  gtpu_main_t *gtm = &gtpu_main;
1115  gtpu_tunnel_t *t = pool_elt_at_index (gtm->tunnels, t_index);
1116  vnet_main_t *vnm = vnet_get_main ();
1117  if (is_add)
1118  {
1119  if (t->flow_index == ~0)
1120  {
1121  vnet_flow_t flow = {
1122  .actions =
1123  VNET_FLOW_ACTION_REDIRECT_TO_NODE | VNET_FLOW_ACTION_MARK |
1124  VNET_FLOW_ACTION_BUFFER_ADVANCE,
1125  .mark_flow_id = t_index + gtm->flow_id_start,
1126  .redirect_node_index = gtpu4_flow_input_node.index,
1127  .buffer_advance = sizeof (ethernet_header_t)
1128  + sizeof (ip4_header_t) + sizeof (udp_header_t),
1129  .type = VNET_FLOW_TYPE_IP4_GTPU,
1130  .ip4_gtpu = {
1131  .protocol.prot = IP_PROTOCOL_UDP,
1132  .src_addr.addr = t->dst.ip4,
1133  .src_addr.mask.as_u32 = ~0,
1134  .dst_addr.addr = t->src.ip4,
1135  .dst_addr.mask.as_u32 = ~0,
1136  .teid = t->teid,
1137  }
1138  ,
1139  };
1140  vnet_flow_add (vnm, &flow, &t->flow_index);
1141  }
1142 
1143  return vnet_flow_enable (vnm, t->flow_index, hw_if_index);
1144  }
1145 
1146  /* flow index is removed when the tunnel is deleted */
1147  return vnet_flow_disable (vnm, t->flow_index, hw_if_index);
1148 }
1149 
1150 u32
1152 {
1153  gtpu_main_t *gtm = &gtpu_main;
1154 
1156  return ~0;
1158 }
1159 
1160 static clib_error_t *
1162  unformat_input_t * input, vlib_cli_command_t * cmd)
1163 {
1164  unformat_input_t _line_input, *line_input = &_line_input;
1165 
1166  /* Get a line of input. */
1167  if (!unformat_user (input, unformat_line_input, line_input))
1168  return 0;
1169 
1170  vnet_main_t *vnm = vnet_get_main ();
1171  u32 rx_sw_if_index = ~0;
1172  u32 hw_if_index = ~0;
1173  int is_add = 1;
1174 
1175  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1176  {
1177  if (unformat (line_input, "hw %U", unformat_vnet_hw_interface, vnm,
1178  &hw_if_index))
1179  continue;
1180  if (unformat (line_input, "rx %U", unformat_vnet_sw_interface, vnm,
1181  &rx_sw_if_index))
1182  continue;
1183  if (unformat (line_input, "del"))
1184  {
1185  is_add = 0;
1186  continue;
1187  }
1188  return clib_error_return (0, "unknown input `%U'",
1189  format_unformat_error, line_input);
1190  }
1191 
1192  if (rx_sw_if_index == ~0)
1193  return clib_error_return (0, "missing rx interface");
1194  if (hw_if_index == ~0)
1195  return clib_error_return (0, "missing hw interface");
1196 
1197  u32 t_index = vnet_gtpu_get_tunnel_index (rx_sw_if_index);;
1198  if (t_index == ~0)
1199  return clib_error_return (0, "%U is not a gtpu tunnel",
1201  rx_sw_if_index);
1202 
1203  gtpu_main_t *gtm = &gtpu_main;
1204  gtpu_tunnel_t *t = pool_elt_at_index (gtm->tunnels, t_index);
1205 
1206  /* first support ipv4 hw offload */
1207  if (!ip46_address_is_ip4 (&t->dst))
1208  return clib_error_return (0, "currently only IPV4 tunnels are supported");
1209 
1210  /* inner protocol should be IPv4/IPv6 */
1211  if ((t->decap_next_index != GTPU_INPUT_NEXT_IP4_INPUT) &&
1212  (t->decap_next_index != GTPU_INPUT_NEXT_IP6_INPUT))
1213  return clib_error_return (0,
1214  "currently only inner IPv4/IPv6 protocol is supported");
1215 
1216  vnet_hw_interface_t *hw_if = vnet_get_hw_interface (vnm, hw_if_index);
1217  ip4_main_t *im = &ip4_main;
1218  u32 rx_fib_index =
1219  vec_elt (im->fib_index_by_sw_if_index, hw_if->sw_if_index);
1220 
1221  if (t->encap_fib_index != rx_fib_index)
1222  return clib_error_return (0, "interface/tunnel fib mismatch");
1223 
1224  if (vnet_gtpu_add_del_rx_flow (hw_if_index, t_index, is_add))
1225  return clib_error_return (0, "error %s flow",
1226  is_add ? "enabling" : "disabling");
1227 
1228  return 0;
1229 }
1230 
1231 
1232 /* *INDENT-OFF* */
1234  .path = "set flow-offload gtpu",
1235  .short_help =
1236  "set flow-offload gtpu hw <inerface-name> rx <tunnel-name> [del]",
1237  .function = gtpu_offload_command_fn,
1238 };
1239 /* *INDENT-ON* */
1240 
1241 clib_error_t *
1243 {
1244  gtpu_main_t *gtm = &gtpu_main;
1245 
1246  gtm->vnet_main = vnet_get_main ();
1247  gtm->vlib_main = vm;
1248 
1249  vnet_flow_get_range (gtm->vnet_main, "gtpu", 1024 * 1024,
1250  &gtm->flow_id_start);
1251 
1252  /* initialize the ip6 hash */
1254  sizeof (gtpu6_tunnel_key_t),
1255  sizeof (uword));
1256  gtm->vtep_table = vtep_table_create ();
1257  gtm->mcast_shared = hash_create_mem (0,
1258  sizeof (ip46_address_t),
1259  sizeof (mcast_shared_t));
1260 
1262 
1263  return 0;
1264 }
1265 
1267 
1268 /* *INDENT-OFF* */
1269 VLIB_PLUGIN_REGISTER () = {
1270  .version = VPP_BUILD_VER,
1271  .description = "GPRS Tunnelling Protocol, User Data (GTPv1-U)",
1272 };
1273 /* *INDENT-ON* */
1274 
1275 /*
1276  * fd.io coding-style-patch-verification: ON
1277  *
1278  * Local Variables:
1279  * eval: (c-set-style "gnu")
1280  * End:
1281  */
vlib.h
vnet_flow_enable
int vnet_flow_enable(vnet_main_t *vnm, u32 flow_index, u32 hw_if_index)
Definition: flow.c:91
vnet_flow_del
int vnet_flow_del(vnet_main_t *vnm, u32 flow_index)
Definition: flow.c:67
tmp
u32 * tmp
Definition: interface_output.c:1078
set_ip_gtpu_bypass
static clib_error_t * set_ip_gtpu_bypass(u32 is_ip6, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:954
im
vnet_interface_main_t * im
Definition: interface_output.c:395
fib_entry.h
MFIB_SOURCE_GTPU
@ MFIB_SOURCE_GTPU
Definition: mfib_types.h:170
udp_header_t::src_port
u16 src_port
Definition: udp_packet.h:48
vnet_sw_interface_set_flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
Definition: interface.c:523
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
DPO_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
vtep_table_create
static vtep_table_t vtep_table_create()
Definition: vtep.h:69
ip_udp_gtpu_rewrite
static void ip_udp_gtpu_rewrite(gtpu_tunnel_t *t, bool is_ip6)
Definition: gtpu.c:238
gtpu_encap_trace_t::tteid
u32 tteid
Definition: gtpu.h:276
set_interface_ip6_gtpu_bypass_command
static vlib_cli_command_t set_interface_ip6_gtpu_bypass_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip6_gtpu_bypass_command)
Definition: gtpu.c:1104
GTPU_PT_GTP
#define GTPU_PT_GTP
Definition: mobile.h:164
gtpu_header_t::ver_flags
u8 ver_flags
Definition: mobile.h:92
vnet_sw_interface_t
Definition: interface.h:868
fib_ip_proto
static fib_protocol_t fib_ip_proto(bool is_ip6)
Convert from boolean is_ip6 to FIB protocol.
Definition: fib_types.h:79
vnet_flood_class_t
vnet_flood_class_t
Definition: interface.h:813
is_ipv6
bool is_ipv6
Definition: dhcp.api:202
vnet_gtpu_add_mod_del_tunnel
int vnet_gtpu_add_mod_del_tunnel(vnet_gtpu_add_mod_del_tunnel_args_t *a, u32 *sw_if_indexp)
Definition: gtpu.c:353
fib_node_back_walk_rc_t
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
vlib_node_add_next
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
gtpu_init
clib_error_t * gtpu_init(vlib_main_t *vm)
Definition: gtpu.c:1242
l2input_main
l2input_main_t l2input_main
Definition: l2_input_node.c:78
ip4_gtpu_header_t
Definition: mobile.h:145
zero_addr
const ip46_address_t zero_addr
#include <vnet/feature/feature.h>
Definition: lookup.c:182
gtpu.h
gtpu4_input_node
vlib_node_registration_t gtpu4_input_node
(constructor) VLIB_REGISTER_NODE (gtpu4_input_node)
Definition: gtpu_decap.c:747
VNET_INTERFACE_COUNTER_TX
@ VNET_INTERFACE_COUNTER_TX
Definition: interface.h:918
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
l2input_main_t
Definition: l2_input.h:83
l2_input_config_t::bd_index
u16 bd_index
Definition: l2_input.h:51
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
gtpu_main_t
Definition: gtpu.h:205
ip46_address_is_multicast
static uword ip46_address_is_multicast(const ip46_address_t *a)
Definition: ip46_address.h:154
gtpu_main_t::fib_node_type
fib_node_type_t fib_node_type
Node type for registering to fib changes.
Definition: gtpu.h:230
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
gtpu6_input_node
vlib_node_registration_t gtpu6_input_node
(constructor) VLIB_REGISTER_NODE (gtpu6_input_node)
Definition: gtpu_decap.c:767
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
MFIB_ITF_FLAG_ACCEPT
@ MFIB_ITF_FLAG_ACCEPT
Definition: mfib_types.h:152
fib_entry_untrack
void fib_entry_untrack(fib_node_index_t fei, u32 sibling)
Stop tracking a FIB entry.
Definition: fib_entry_track.c:79
vnet_hw_interface_t::sw_if_index
u32 sw_if_index
Definition: interface.h:670
pool_get_aligned
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Definition: pool.h:249
vnet_gtpu_get_tunnel_index
u32 vnet_gtpu_get_tunnel_index(u32 sw_if_index)
Definition: gtpu.c:1151
gtpu_main_t::vnet_main
vnet_main_t * vnet_main
Definition: gtpu.h:237
mfib_prefix_t_
Aggregate type for a prefix.
Definition: mfib_types.h:24
gtpu_offload_command
static vlib_cli_command_t gtpu_offload_command
(constructor) VLIB_CLI_COMMAND (gtpu_offload_command)
Definition: gtpu.c:1233
gtpu_tunnel_t::rewrite
u8 * rewrite
Definition: gtpu.h:134
adj_mcast_add_or_lock
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
Definition: adj_mcast.c:51
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
path
vl_api_fib_path_t path
Definition: mfib_types.api:44
ip46_address_cmp
static int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
Definition: ip46_address.h:80
fib_node_vft_t_
A FIB graph nodes virtual function table.
Definition: fib_node.h:288
mfib_table_entry_delete_index
void mfib_table_entry_delete_index(fib_node_index_t mfib_entry_index, mfib_source_t source)
Delete a FIB entry.
Definition: mfib_table.c:517
adj_mcast.h
ip46_address_is_ip4
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
Definition: ip46_address.h:55
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
gtpu_interface_admin_up_down
static clib_error_t * gtpu_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: gtpu.c:122
vlib_cli_command_t::path
char * path
Definition: cli.h:96
vnet_interface_main_t
Definition: interface.h:989
gtpu_main_t::vtep_table
vtep_table_t vtep_table
Definition: gtpu.h:216
adj_unlock
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:358
fib_table.h
format_decap_next
static u8 * format_decap_next(u8 *s, va_list *args)
Definition: gtpu.c:65
gtpu_tunnel_fib_node_get
static fib_node_t * gtpu_tunnel_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
Definition: gtpu.c:194
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:843
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
unformat_parse_error
#define unformat_parse_error(input)
Definition: format.h:261
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
node_index
node node_index
Definition: interface_output.c:420
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
flow
Definition: flow_types.api:196
fib_prefix_from_ip46_addr
void fib_prefix_from_ip46_addr(const ip46_address_t *addr, fib_prefix_t *pfx)
Host prefix from ip.
Definition: fib_types.c:81
GTPU_DEL_TUNNEL
#define GTPU_DEL_TUNNEL
Definition: gtpu.h:259
vnet_interface_main_t::sw_if_counters
vlib_simple_counter_main_t * sw_if_counters
Definition: interface.h:1022
gtpu_tunnel_back_walk
static fib_node_back_walk_rc_t gtpu_tunnel_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node - Here we will restack the new dpo of GTPU DIP to encap no...
Definition: gtpu.c:184
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
unformat_input_t
struct _unformat_input_t unformat_input_t
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1071
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
ethernet.h
error
Definition: cJSON.c:88
fib_entry_contribute_forwarding
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
Definition: fib_entry.c:437
vtep_addr_ref
uword vtep_addr_ref(vtep_table_t *t, u32 fib_index, ip46_address_t *ip)
Definition: vtep.c:19
gtpu_tunnel_t::fib_entry_index
fib_node_index_t fib_entry_index
Definition: gtpu.h:169
gtpu_encap_trace_t::tunnel_index
u32 tunnel_index
Definition: gtpu.h:275
vnet_sw_interface_t::flags
vnet_sw_interface_flags_t flags
Definition: interface.h:872
VNET_FLOOD_CLASS_TUNNEL_NORMAL
@ VNET_FLOOD_CLASS_TUNNEL_NORMAL
Definition: interface.h:821
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
vec_elt
#define vec_elt(v, i)
Get vector value at index i.
Definition: vec_bootstrap.h:210
gtpu_tunnel_t::src
ip46_address_t src
Definition: gtpu.h:144
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
format_gtpu_name
static u8 * format_gtpu_name(u8 *s, va_list *args)
Definition: gtpu.c:115
FIB_FORW_CHAIN_TYPE_UNICAST_IP4
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP4
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:108
vnet_set_interface_output_node
void vnet_set_interface_output_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Set interface output node - for interface registered without its output/tx nodes created because its ...
Definition: interface_output.c:1260
fib_entry_track
fib_node_index_t fib_entry_track(u32 fib_index, const fib_prefix_t *prefix, fib_node_type_t child_type, index_t child_index, u32 *sibling)
Trackers are used on FIB entries by objects that which to track the changing state of the entry.
Definition: fib_entry_track.c:49
gtpu_tunnel_restack_dpo
static void gtpu_tunnel_restack_dpo(gtpu_tunnel_t *t)
Definition: gtpu.c:159
STRUCT_OFFSET_OF
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:73
gtpu_header_t::teid
u32 teid
Definition: mobile.h:95
gtpu_main_t::flow_id_start
u32 flow_id_start
Definition: gtpu.h:238
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
gtpu_tunnel_t::sw_if_index
u32 sw_if_index
Definition: gtpu.h:157
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
gtpu_main_t::free_gtpu_tunnel_hw_if_indices
u32 * free_gtpu_tunnel_hw_if_indices
Definition: gtpu.h:222
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
mcast_shared_get
static mcast_shared_t mcast_shared_get(ip46_address_t *ip)
Definition: geneve.c:329
len
u8 len
Definition: ip_types.api:103
dpo.h
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
GTPU_V1_VER
#define GTPU_V1_VER
Definition: mobile.h:162
gtpu_encap_trace_t
Definition: gtpu.h:273
fib_forward_chain_type_t
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_get_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
gtpu_tunnel_last_lock_gone
static void gtpu_tunnel_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
Definition: gtpu.c:208
fib_table_t_::ft_table_id
u32 ft_table_id
Table ID (hash key) for this FIB.
Definition: fib_table.h:92
format_gtpu_encap_trace
u8 * format_gtpu_encap_trace(u8 *s, va_list *args)
Definition: gtpu.c:52
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
gtpu_offload_command_fn
static clib_error_t * gtpu_offload_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:1161
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
unformat_vlib_node
unformat_function_t unformat_vlib_node
Definition: node_funcs.h:1241
vec_validate_aligned
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition: vec.h:534
unformat_decap_next
static uword unformat_decap_next(unformat_input_t *input, va_list *args)
Definition: gtpu.c:649
gtpu_tunnel_t::decap_next_index
u32 decap_next_index
Definition: gtpu.h:151
format_gtpu_tunnel
u8 * format_gtpu_tunnel(u8 *s, va_list *args)
Definition: gtpu.c:86
gtpu_tunnel_t::flow_index
u32 flow_index
Definition: gtpu.h:180
vnet_sw_interface_t::flood_class
vnet_flood_class_t flood_class
Definition: interface.h:897
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
MODE_L3
#define MODE_L3
Definition: l2_input.h:282
gtpu_header_t
Definition: mobile.h:90
uword
u64 uword
Definition: types.h:112
vlib_zero_combined_counter
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
Definition: counter.h:298
hash_unset_mem_free
static void hash_unset_mem_free(uword **h, const void *key)
Definition: hash.h:295
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
hash_get
#define hash_get(h, key)
Definition: hash.h:249
ethernet_header_t
Definition: packet.h:52
set_ip6_gtpu_bypass
static clib_error_t * set_ip6_gtpu_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:1055
show_gtpu_tunnel_command
static vlib_cli_command_t show_gtpu_tunnel_command
(constructor) VLIB_CLI_COMMAND (show_gtpu_tunnel_command)
Definition: gtpu.c:935
VNET_FEATURE_INIT
VNET_FEATURE_INIT(ip4_gtpu_bypass, static)
udp_register_dst_port
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
Definition: udp_local.c:468
fib_proto_to_link
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
Definition: fib_types.c:377
hash_set_mem_alloc
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
Definition: hash.h:279
vnet_flow_disable
int vnet_flow_disable(vnet_main_t *vnm, u32 flow_index, u32 hw_if_index)
Definition: flow.c:135
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
ip6_main_t::fibs
struct fib_table_t_ * fibs
Definition: ip6.h:115
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
dpo_stack_from_node
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
Definition: dpo.c:550
src
vl_api_address_t src
Definition: gre.api:54
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
udp_is_valid_dst_port
u8 udp_is_valid_dst_port(udp_dst_port_t dst_port, u8 is_ip4)
Definition: udp_local.c:529
gtpu_tunnel_from_fib_node
static gtpu_tunnel_t * gtpu_tunnel_from_fib_node(fib_node_t *node)
Definition: gtpu.c:173
gtpu_tunnel_t::dst
ip46_address_t dst
Definition: gtpu.h:145
gtpu_tunnel_t::next_dpo
dpo_id_t next_dpo
Definition: gtpu.h:137
vnet_flow_t
Definition: flow.h:215
unformat_vnet_hw_interface
unformat_function_t unformat_vnet_hw_interface
Definition: interface_funcs.h:460
ALWAYS_ASSERT
#define ALWAYS_ASSERT(truth)
Definition: error_bootstrap.h:89
VNET_INTERFACE_COUNTER_RX
@ VNET_INTERFACE_COUNTER_RX
Definition: interface.h:914
mfib_table.h
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
mfib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
FIB_NODE_BACK_WALK_CONTINUE
@ FIB_NODE_BACK_WALK_CONTINUE
Definition: fib_node.h:259
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
vnet_interface_main_t::combined_sw_if_counters
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:1023
vnet_int_gtpu_bypass_mode
void vnet_int_gtpu_bypass_mode(u32 sw_if_index, u8 is_ip6, u8 is_enable)
Definition: gtpu.c:943
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
mcast_shared_add
static void mcast_shared_add(ip46_address_t *dst, fib_node_index_t mfei, adj_index_t ai)
Definition: gtpu.c:331
fib_prefix_t_::fp_addr
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:225
vtep_addr_unref
uword vtep_addr_unref(vtep_table_t *t, u32 fib_index, ip46_address_t *ip)
Definition: vtep.c:34
fib_entry_track.h
mcast_sw_if_index
vl_api_interface_index_t mcast_sw_if_index
Definition: vxlan_gbp.api:41
show_gtpu_tunnel_command_fn
static clib_error_t * show_gtpu_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:907
plugin.h
DPO_ADJACENCY_MCAST
@ DPO_ADJACENCY_MCAST
Definition: dpo.h:110
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2787
set_int_l2_mode
u32 set_int_l2_mode(vlib_main_t *vm, vnet_main_t *vnet_main, u32 mode, u32 sw_if_index, u32 bd_index, l2_bd_port_type_t port_type, u32 shg, u32 xc_sw_if_index)
Set the subinterface to run in l2 or l3 mode.
Definition: l2_input.c:256
gtpu_tunnel_t::sibling_index
u32 sibling_index
The tunnel is a child of the FIB entry for its destination.
Definition: gtpu.h:178
is_ip6
bool is_ip6
Definition: ip.api:43
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
index
u32 index
Definition: flow_types.api:221
vnet_interface_counter_unlock
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
Definition: interface.h:1057
L2_BD_PORT_TYPE_NORMAL
@ L2_BD_PORT_TYPE_NORMAL
Definition: l2_bd.h:28
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
u64
unsigned long u64
Definition: types.h:89
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:455
unformat_vnet_sw_interface
unformat_function_t unformat_vnet_sw_interface
Definition: interface_funcs.h:459
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vnet_flow_get_range
int vnet_flow_get_range(vnet_main_t *vnm, char *owner, u32 count, u32 *start)
Definition: flow.c:24
vlib_zero_simple_counter
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
Definition: counter.h:154
gtpu_main_t::gtpu4_tunnel_by_key
uword * gtpu4_tunnel_by_key
Definition: gtpu.h:211
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
FIB_ROUTE_PATH_FLAG_NONE
@ FIB_ROUTE_PATH_FLAG_NONE
Definition: fib_types.h:332
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
gtpu_decap_next_is_valid
static bool gtpu_decap_next_is_valid(gtpu_main_t *gtm, u32 is_ip6, u32 decap_next_index)
Definition: gtpu.c:301
udp_header_t::dst_port
u16 dst_port
Definition: udp_packet.h:48
gtpu_header_t::type
u8 type
Definition: mobile.h:93
gtpu_vft
const static fib_node_vft_t gtpu_vft
Definition: gtpu.c:221
l2_input_config_t::feature_bitmap
u32 feature_bitmap
Definition: l2_input.h:60
gtpu_tunnel_t::encap_fib_index
u32 encap_fib_index
Definition: gtpu.h:154
gtpu_main_t::mcast_shared
uword * mcast_shared
Definition: gtpu.h:219
ip4_main_t::fibs
struct fib_table_t_ * fibs
Vector of FIBs.
Definition: ip4.h:112
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
si
vnet_sw_interface_t * si
Definition: interface_output.c:398
get_decap_next_for_node
static uword get_decap_next_for_node(u32 node_index, u32 ipv4_set)
Definition: gtpu.c:638
gtpu_tunnel_t::tteid
u32 tteid
Definition: gtpu.h:141
as_u64
u64 as_u64
Definition: bihash_doc.h:63
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
gtpu_tunnel_t
Definition: gtpu.h:128
gtpu4_encap_node
vlib_node_registration_t gtpu4_encap_node
(constructor) VLIB_REGISTER_NODE (gtpu4_encap_node)
Definition: gtpu_encap.c:687
vlib_node_get_runtime
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:116
ip6_header_t
Definition: ip6_packet.h:294
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(gtpu_device_class, static)
ip6_main_t
Definition: ip6.h:110
GTPU_UPD_TTEID
#define GTPU_UPD_TTEID
Definition: gtpu.h:261
vnet_feature_enable_disable
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: pnat_test_stubs.h:50
gtpu_add_del_tunnel_command_fn
static clib_error_t * gtpu_add_del_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:675
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
vnet_gtpu_add_mod_del_tunnel_args_t
Definition: gtpu.h:256
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
VNET_SW_INTERFACE_FLAG_HIDDEN
@ VNET_SW_INTERFACE_FLAG_HIDDEN
Definition: interface.h:855
vlib_node_t
Definition: node.h:247
fib_node_init
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
ip6_gtpu_header_t
Definition: mobile.h:154
VNET_FEATURES
#define VNET_FEATURES(...)
Definition: feature.h:470
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vnet_hw_interface_set_flags
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
Definition: interface.c:513
a
a
Definition: bitmap.h:544
unix.h
ip
vl_api_address_t ip
Definition: l2.api:558
ip4_header_checksum
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:314
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
mfib_table_entry_path_update
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
Definition: mfib_table.c:325
gtpu_main_t::tunnel_index_by_sw_if_index
u32 * tunnel_index_by_sw_if_index
Definition: gtpu.h:225
default_build_rewrite
u8 * default_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Return a complete, zero-length (aka placeholder) rewrite.
Definition: interface.c:1705
CLIB_PACKED
typedef CLIB_PACKED(union { struct { fib_node_index_t mfib_entry_index;adj_index_t mcast_adj_index;};u64 as_u64;})
Definition: gtpu.c:310
fib_node_back_walk_ctx_t_
Context passed between object during a back walk.
Definition: fib_node.h:214
fib_node_vft_t_::fnv_get
fib_node_get_t fnv_get
Definition: fib_node.h:289
VNET_FLOOD_CLASS_TUNNEL_MASTER
@ VNET_FLOOD_CLASS_TUNNEL_MASTER
Definition: interface.h:819
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
gtpu_tunnel_t::teid
u32 teid
Definition: gtpu.h:140
vnet_gtpu_add_del_rx_flow
int vnet_gtpu_add_del_rx_flow(u32 hw_if_index, u32 t_index, int is_add)
Definition: gtpu.c:1112
MFIB_ITF_FLAG_FORWARD
@ MFIB_ITF_FLAG_FORWARD
Definition: mfib_types.h:153
gtpu_tunnel_t::mcast_sw_if_index
u32 mcast_sw_if_index
Definition: gtpu.h:148
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
unformat_ip6_address
unformat_function_t unformat_ip6_address
Definition: format.h:89
gtpu_main
gtpu_main_t gtpu_main
Definition: gtpu.c:36
set_ip4_gtpu_bypass
static clib_error_t * set_ip4_gtpu_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gtpu.c:998
create_gtpu_tunnel_command
static vlib_cli_command_t create_gtpu_tunnel_command
(constructor) VLIB_CLI_COMMAND (create_gtpu_tunnel_command)
Definition: gtpu.c:895
rv
int __clib_unused rv
Definition: application.c:491
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
unformat_ip4_address
unformat_function_t unformat_ip4_address
Definition: format.h:68
gtpu_main_t::tunnels
gtpu_tunnel_t * tunnels
Definition: gtpu.h:208
fib_node_deinit
void fib_node_deinit(fib_node_t *node)
Definition: fib_node.c:197
GTPU_ADD_TUNNEL
#define GTPU_ADD_TUNNEL
Definition: gtpu.h:260
FIB_FORW_CHAIN_TYPE_UNICAST_IP6
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP6
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:112
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
foreach_copy_field
#define foreach_copy_field
Definition: gtpu.c:228
gtpu6_encap_node
vlib_node_registration_t gtpu6_encap_node
(constructor) VLIB_REGISTER_NODE (gtpu6_encap_node)
Definition: gtpu_encap.c:702
vlib_node_runtime_t
Definition: node.h:454
l2input_main_t::configs
l2_input_config_t * configs
Definition: l2_input.h:90
vnet_flow_add
int vnet_flow_add(vnet_main_t *vnm, vnet_flow_t *flow, u32 *flow_index)
Definition: flow.c:43
vlib_cli_command_t
Definition: cli.h:92
mcast_shared_remove
static void mcast_shared_remove(ip46_address_t *dst)
Definition: gtpu.c:342
flow.h
ip4_main_t
IPv4 main type.
Definition: ip4.h:107
fib_table_find
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1106
teid
u32 teid
Definition: flow_types.api:182
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
gtpu4_flow_input_node
vlib_node_registration_t gtpu4_flow_input_node
(constructor) VLIB_REGISTER_NODE (gtpu4_flow_input_node)
Definition: gtpu_decap.c:1738
gtpu_tunnel_t::node
fib_node_t node
Linkage into the FIB object graph.
Definition: gtpu.h:163
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(gtpu_hw_class)
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
vnet_interface_counter_lock
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
Definition: interface.h:1050
fib_node_register_new_type
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
Definition: fib_node.c:80
GTPU_TYPE_GTPU
#define GTPU_TYPE_GTPU
Definition: mobile.h:104
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
FIB_ROUTE_PATH_LOCAL
@ FIB_ROUTE_PATH_LOCAL
A for-us/local path.
Definition: fib_types.h:344
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
VNET_INTERFACE_COUNTER_DROP
@ VNET_INTERFACE_COUNTER_DROP
Definition: interface.h:903
gtpu_main_t::vlib_main
vlib_main_t * vlib_main
Definition: gtpu.h:236
vnet_register_interface
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:812
gtpu_tunnel_t::hw_if_index
u32 hw_if_index
Definition: gtpu.h:158
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
set_interface_ip_gtpu_bypass_command
static vlib_cli_command_t set_interface_ip_gtpu_bypass_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip_gtpu_bypass_command)
Definition: gtpu.c:1047
format_gtpu_header_with_length
static u8 * format_gtpu_header_with_length(u8 *s, va_list *args)
Definition: gtpu.c:141
gtpu_main_t::gtpu6_tunnel_by_key
uword * gtpu6_tunnel_by_key
Definition: gtpu.h:212
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105