FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ipip.c
Go to the documentation of this file.
1 /*
2  * ipip.c: ipip
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 aipiped 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 <stddef.h>
19 #include <vnet/adj/adj_midchain.h>
20 #include <vnet/ipip/ipip.h>
21 #include <vnet/vnet.h>
22 #include <vnet/adj/adj_nbr.h>
23 #include <vnet/adj/adj_midchain.h>
24 #include <vnet/fib/ip4_fib.h>
25 #include <vnet/fib/ip6_fib.h>
26 #include <vnet/ip/format.h>
27 #include <vnet/ipip/ipip.h>
28 #include <vnet/teib/teib.h>
29 #include <vnet/tunnel/tunnel_dp.h>
30 
32 
33 /* Packet trace structure */
34 typedef struct
35 {
38  ip46_address_t src;
39  ip46_address_t dst;
41 
42 u8 *
43 format_ipip_tx_trace (u8 * s, va_list * args)
44 {
45  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
46  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
47  ipip_tx_trace_t *t = va_arg (*args, ipip_tx_trace_t *);
48 
49  s =
50  format (s, "IPIP: tunnel %d len %d src %U dst %U", t->tunnel_id,
53  return s;
54 }
55 
56 static u8 *
58  vnet_link_t link_type, const void *dst_address)
59 {
60  const ip46_address_t *dst;
63  u8 *rewrite = NULL;
64  ipip_tunnel_t *t;
65 
66  dst = dst_address;
68 
69  if (!t)
70  /* not one of ours */
71  return (0);
72 
73  switch (t->transport)
74  {
75  case IPIP_TRANSPORT_IP4:
76  vec_validate (rewrite, sizeof (*ip4) - 1);
77  ip4 = (ip4_header_t *) rewrite;
78  ip4->ip_version_and_header_length = 0x45;
79  ip4->ttl = 64;
80  /* fixup ip4 header length, protocol and checksum after-the-fact */
81  ip4->src_address.as_u32 = t->tunnel_src.ip4.as_u32;
82  ip4->dst_address.as_u32 = dst->ip4.as_u32;
83  if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
85  if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_SET_DF)
87 
88  switch (link_type)
89  {
90  case VNET_LINK_IP6:
91  ip4->protocol = IP_PROTOCOL_IPV6;
92  break;
93  case VNET_LINK_IP4:
94  ip4->protocol = IP_PROTOCOL_IP_IN_IP;
95  break;
96  case VNET_LINK_MPLS:
97  ip4->protocol = IP_PROTOCOL_MPLS_IN_IP;
98  break;
99  default:
100  break;
101  }
102  ip4->checksum = ip4_header_checksum (ip4);
103  break;
104 
105  case IPIP_TRANSPORT_IP6:
106  vec_validate (rewrite, sizeof (*ip6) - 1);
107  ip6 = (ip6_header_t *) rewrite;
108  ip6->ip_version_traffic_class_and_flow_label =
109  clib_host_to_net_u32 (6 << 28);
110  ip6->hop_limit = 64;
111  /* fixup ip6 header length and protocol after-the-fact */
112  ip6->src_address.as_u64[0] = t->tunnel_src.ip6.as_u64[0];
113  ip6->src_address.as_u64[1] = t->tunnel_src.ip6.as_u64[1];
114  ip6->dst_address.as_u64[0] = dst->ip6.as_u64[0];
115  ip6->dst_address.as_u64[1] = dst->ip6.as_u64[1];
116  if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
118 
119  switch (link_type)
120  {
121  case VNET_LINK_IP6:
122  ip6->protocol = IP_PROTOCOL_IPV6;
123  break;
124  case VNET_LINK_IP4:
125  ip6->protocol = IP_PROTOCOL_IP_IN_IP;
126  break;
127  case VNET_LINK_MPLS:
128  ip6->protocol = IP_PROTOCOL_MPLS_IN_IP;
129  break;
130  default:
131  break;
132  }
133  break;
134  }
135  return (rewrite);
136 }
137 
138 static void
140  const void *data)
141 {
143  ip4_header_t *ip4;
144 
146 
148  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b));
150 
151  ip4->checksum = ip4_header_checksum (ip4);
152 }
153 
154 static void
156  const void *data)
157 {
159  ip4_header_t *ip4;
160 
162 
164  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b));
166 
167  ip4->checksum = ip4_header_checksum (ip4);
168 }
169 
170 static void
172  const void *data)
173 {
175  ip6_header_t *ip6;
176 
178 
179  /* Must set locally originated otherwise we're not allowed to
180  fragment the packet later */
181  b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
182 
184  ip6->payload_length =
185  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b) -
186  sizeof (*ip6));
188 }
189 
190 static void
192  const ip_adjacency_t * adj, vlib_buffer_t * b, const void *data)
193 {
195  ip6_header_t *ip6;
196 
198 
199  /* Must set locally originated otherwise we're not allowed to
200  fragment the packet later */
201  b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
202 
204  ip6->payload_length =
205  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b) -
206  sizeof (*ip6));
208 }
209 
210 static void
212  const void *data)
213 {
215  ip6_header_t *ip6;
216 
218 
219  /* Must set locally originated otherwise we're not allowed to
220  fragment the packet later and we'll get an unwanted hop-limt
221  decrement */
222  b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
223 
225  ip6->payload_length =
226  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b) - sizeof (*ip6));
228  ip6);
229 }
230 
231 static void
233  const void *data)
234 {
236  ip4_header_t *ip4;
237 
239 
240  /* Must set locally originated otherwise we'll do a TTL decrement
241  * during ip4-rewrite */
242  b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
243 
245  ip4->length =
246  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b) - sizeof (*ip4));
248  ip4->checksum = ip4_header_checksum (ip4);
249 }
250 
251 static void
253 {
254  ip_adjacency_t *adj;
255  ipip_tunnel_t *t;
257 
258  adj = adj_get (ai);
259  sw_if_index = adj->rewrite_header.sw_if_index;
260 
262  if (!t)
263  return;
264 
267  {
269  }
270  else
271  {
272  /* *INDENT-OFF* */
273  fib_prefix_t dst = {
274  .fp_len = t->transport == IPIP_TRANSPORT_IP6 ? 128 : 32,
275  .fp_proto = (t->transport == IPIP_TRANSPORT_IP6 ?
278  .fp_addr = t->tunnel_dst
279  };
280  /* *INDENT-ON* */
281 
283  }
284 }
285 
286 static adj_walk_rc_t
288 {
289  ipip_tunnel_stack (ai);
290 
291  return (ADJ_WALK_RC_CONTINUE);
292 }
293 
294 static void
296 {
298 
299  /*
300  * walk all the adjacencies on th IPIP interface and restack them
301  */
303  {
305  }
306 }
307 
310 {
311  if (t->transport == IPIP_TRANSPORT_IP6 && lt == VNET_LINK_IP6)
312  return (ipip66_fixup);
313  if (t->transport == IPIP_TRANSPORT_IP6 && lt == VNET_LINK_IP4)
314  return (ipip46_fixup);
315  if (t->transport == IPIP_TRANSPORT_IP6 && lt == VNET_LINK_MPLS)
316  return (ipipm6_fixup);
317  if (t->transport == IPIP_TRANSPORT_IP4 && lt == VNET_LINK_IP6)
318  return (ipip64_fixup);
319  if (t->transport == IPIP_TRANSPORT_IP4 && lt == VNET_LINK_MPLS)
320  return (ipipm4_fixup);
321  if (t->transport == IPIP_TRANSPORT_IP4 && lt == VNET_LINK_IP4)
322  {
323  *aflags = *aflags | ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR;
324  return (ipip44_fixup);
325  }
326 
327  ASSERT (0);
328  return (ipip44_fixup);
329 }
330 
331 void
333 {
334  adj_midchain_fixup_t fixup;
335  ipip_tunnel_t *t;
336  adj_flags_t af;
337 
338  af = ADJ_FLAG_NONE;
340  if (!t)
341  return;
342 
343  /*
344  * the user has not requested that the load-balancing be based on
345  * a flow hash of the inner packet. so use the stacking to choose
346  * a path.
347  */
348  if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
350 
353 
354  fixup = ipip_get_fixup (t, adj_get_link_type (ai), &af);
356  (ai, fixup,
357  uword_to_pointer (t->flags, void *), af,
359  adj_get_link_type (ai), &t->tunnel_dst));
360  ipip_tunnel_stack (ai);
361 }
362 
363 typedef struct mipip_walk_ctx_t_
364 {
365  const ipip_tunnel_t *t;
366  const teib_entry_t *ne;
368 
369 static adj_walk_rc_t
371 {
372  adj_midchain_fixup_t fixup;
374  adj_flags_t af;
375 
376  af = ADJ_FLAG_NONE;
377  fixup = ipip_get_fixup (ctx->t, adj_get_link_type (ai), &af);
378 
379  /*
380  * the user has not requested that the load-balancing be based on
381  * a flow hash of the inner packet. so use the stacking to choose
382  * a path.
383  */
384  if (!(ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
386 
388  (ai, fixup,
389  uword_to_pointer (ctx->t->flags, void *),
391  ctx->t->sw_if_index,
392  adj_get_link_type (ai),
393  &teib_entry_get_nh (ctx->ne)->fp_addr));
394 
395  teib_entry_adj_stack (ctx->ne, ai);
396 
397  return (ADJ_WALK_RC_CONTINUE);
398 }
399 
400 static adj_walk_rc_t
402 {
403  adj_midchain_fixup_t fixup;
404  ipip_tunnel_t *t = data;
405  adj_flags_t af;
406 
407  af = ADJ_FLAG_NONE;
408  fixup = ipip_get_fixup (t, adj_get_link_type (ai), &af);
409 
410  adj_nbr_midchain_update_rewrite (ai, fixup, NULL, ADJ_FLAG_NONE, NULL);
411 
413 
414  return (ADJ_WALK_RC_CONTINUE);
415 }
416 
417 void
419 {
421  adj_midchain_fixup_t fixup;
422  ip_adjacency_t *adj;
423  teib_entry_t *ne;
424  ipip_tunnel_t *t;
425  adj_flags_t af;
426  u32 ti;
427 
428  af = ADJ_FLAG_NONE;
429  adj = adj_get (ai);
430  ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
431  t = pool_elt_at_index (gm->tunnels, ti);
432 
434  adj->ia_nh_proto, &adj->sub_type.nbr.next_hop);
435 
436  if (NULL == ne)
437  {
438  // no TEIB entry to provide the next-hop
439  fixup = ipip_get_fixup (t, adj_get_link_type (ai), &af);
441  (ai, fixup, uword_to_pointer (t->flags, void *), ADJ_FLAG_NONE, NULL);
442  return;
443  }
444 
446  .t = t,
447  .ne = ne
448  };
450  adj->ia_nh_proto,
451  &adj->sub_type.nbr.next_hop, mipip_mk_complete_walk, &ctx);
452 }
453 
454 static u8 *
455 format_ipip_tunnel_name (u8 * s, va_list * args)
456 {
457  u32 dev_instance = va_arg (*args, u32);
459  ipip_tunnel_t *t;
460 
461  if (dev_instance >= vec_len (gm->tunnels))
462  return format (s, "<improperly-referenced>");
463 
464  t = pool_elt_at_index (gm->tunnels, dev_instance);
465  return format (s, "ipip%d", t->user_instance);
466 }
467 
468 static u8 *
469 format_ipip_device (u8 * s, va_list * args)
470 {
471  u32 dev_instance = va_arg (*args, u32);
472  CLIB_UNUSED (int verbose) = va_arg (*args, int);
473 
474  s = format (s, "IPIP tunnel: id %d\n", dev_instance);
475  return s;
476 }
477 
478 static clib_error_t *
480 {
482  ipip_tunnel_t *t;
483 
484  hi = vnet_get_hw_interface (vnm, hw_if_index);
485 
486  t = ipip_tunnel_db_find_by_sw_if_index (hi->sw_if_index);
487  if (!t)
488  return 0;
489 
491  vnet_hw_interface_set_flags (vnm, hw_if_index,
493  else
494  vnet_hw_interface_set_flags (vnm, hw_if_index, 0 /* down */ );
495 
497 
498  return /* no error */ 0;
499 }
500 
501 static int
503  ip46_address_t * src, ip46_address_t * dst, u8 * is_l2)
504 {
505  ipip_tunnel_t *t;
506 
508  if (!t)
509  return -1;
510 
511  *src = t->tunnel_src;
512  *dst = t->tunnel_dst;
513  *is_l2 = 0;
514 
515  return (0);
516 }
517 
518 /* *INDENT-OFF* */
519 VNET_DEVICE_CLASS(ipip_device_class) = {
520  .name = "IPIP tunnel device",
521  .format_device_name = format_ipip_tunnel_name,
522  .format_device = format_ipip_device,
523  .format_tx_trace = format_ipip_tx_trace,
524  .admin_up_down_function = ipip_interface_admin_up_down,
525  .ip_tun_desc = ipip_tunnel_desc,
526 #ifdef SOON
527  .clear counter = 0;
528 #endif
529 };
530 
532  .name = "IPIP",
533  //.format_header = format_ipip_header_with_length,
534  //.unformat_header = unformat_ipip_header,
535  .build_rewrite = ipip_build_rewrite,
536  .update_adjacency = ipip_update_adj,
538 };
539 
540 VNET_HW_INTERFACE_CLASS(mipip_hw_interface_class) = {
541  .name = "mIPIP",
542  //.format_header = format_ipip_header_with_length,
543  //.unformat_header = unformat_ipip_header,
544  .build_rewrite = ipip_build_rewrite,
545  .update_adjacency = mipip_update_adj,
547 };
548 /* *INDENT-ON* */
549 
551 ipip_tunnel_db_find (const ipip_tunnel_key_t * key)
552 {
554  uword *p;
555 
556  p = hash_get_mem (gm->tunnel_by_key, key);
557  if (!p)
558  return (NULL);
559  return (pool_elt_at_index (gm->tunnels, p[0]));
560 }
561 
564 {
566  if (vec_len (gm->tunnel_index_by_sw_if_index) <= sw_if_index)
567  return NULL;
568  u32 ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
569  if (ti == ~0)
570  return NULL;
571  return pool_elt_at_index (gm->tunnels, ti);
572 }
573 
574 void
575 ipip_tunnel_db_add (ipip_tunnel_t * t, const ipip_tunnel_key_t * key)
576 {
578 
579  hash_set_mem_alloc (&gm->tunnel_by_key, key, t->dev_instance);
580 }
581 
582 void
583 ipip_tunnel_db_remove (ipip_tunnel_t * t, const ipip_tunnel_key_t * key)
584 {
586 
587  hash_unset_mem_free (&gm->tunnel_by_key, key);
588 }
589 
590 void
591 ipip_mk_key_i (ipip_transport_t transport,
592  ipip_mode_t mode,
593  const ip46_address_t * src,
594  const ip46_address_t * dst,
595  u32 fib_index, ipip_tunnel_key_t * key)
596 {
597  key->transport = transport;
598  key->mode = mode;
599  key->src = *src;
600  key->dst = *dst;
601  key->fib_index = fib_index;
602  key->__pad = 0;;
603 }
604 
605 void
606 ipip_mk_key (const ipip_tunnel_t * t, ipip_tunnel_key_t * key)
607 {
608  ipip_mk_key_i (t->transport, t->mode,
609  &t->tunnel_src, &t->tunnel_dst, t->fib_index, key);
610 }
611 
612 static void
614  const teib_entry_t * ne, ipip_tunnel_key_t * key)
615 {
616  const fib_prefix_t *nh;
617 
618  nh = teib_entry_get_nh (ne);
619 
620  /* construct the key using mode P2P so it can be found in the DP */
622  &t->tunnel_src, &nh->fp_addr,
624 }
625 
626 static void
628 {
630  const ip_address_t *nh;
631  ipip_tunnel_key_t key;
632  ipip_tunnel_t *t;
634  u32 t_idx;
635 
637  if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
638  return;
639 
640  t_idx = gm->tunnel_index_by_sw_if_index[sw_if_index];
641 
642  if (INDEX_INVALID == t_idx)
643  return;
644 
645  t = pool_elt_at_index (gm->tunnels, t_idx);
646 
647  ipip_teib_mk_key (t, ne, &key);
648  ipip_tunnel_db_add (t, &key);
649 
650  // update the rewrites for each of the adjacencies for this next-hop
652  .t = t,
653  .ne = ne
654  };
655  nh = teib_entry_get_peer (ne);
657  (AF_IP4 == ip_addr_version (nh) ?
661 }
662 
663 static void
665 {
667  const ip_address_t *nh;
668  ipip_tunnel_key_t key;
669  ipip_tunnel_t *t;
671  u32 t_idx;
672 
674  if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
675  return;
676 
677  t_idx = gm->tunnel_index_by_sw_if_index[sw_if_index];
678 
679  if (INDEX_INVALID == t_idx)
680  return;
681 
682  t = pool_elt_at_index (gm->tunnels, t_idx);
683 
684  ipip_teib_mk_key (t, ne, &key);
686 
687  nh = teib_entry_get_peer (ne);
688 
689  /* make all the adjacencies incomplete */
691  (AF_IP4 == ip_addr_version (nh) ?
695 }
696 
697 static walk_rc_t
699 {
700  ipip_tunnel_t *t = ctx;
701  ipip_tunnel_key_t key;
702 
703  ipip_teib_mk_key (t, teib_entry_get (nei), &key);
705 
706  return (WALK_CONTINUE);
707 }
708 
709 static walk_rc_t
711 {
712  ipip_tunnel_t *t = ctx;
713  ipip_tunnel_key_t key;
714 
715  ipip_teib_mk_key (t, teib_entry_get (nei), &key);
716  ipip_tunnel_db_add (t, &key);
717 
718  return (WALK_CONTINUE);
719 }
720 
721 int
722 ipip_add_tunnel (ipip_transport_t transport,
723  u32 instance, ip46_address_t * src, ip46_address_t * dst,
725  ip_dscp_t dscp, tunnel_mode_t tmode, u32 * sw_if_indexp)
726 {
728  vnet_main_t *vnm = gm->vnet_main;
729  ipip_tunnel_t *t;
731  u32 hw_if_index, sw_if_index;
732  ipip_tunnel_key_t key;
733  ipip_mode_t mode;
734 
735  if (tmode == TUNNEL_MODE_MP && !ip46_address_is_zero (dst))
736  return (VNET_API_ERROR_INVALID_DST_ADDRESS);
737 
738  mode = (tmode == TUNNEL_MODE_P2P ? IPIP_MODE_P2P : IPIP_MODE_P2MP);
739  ipip_mk_key_i (transport, mode, src, dst, fib_index, &key);
740 
741  t = ipip_tunnel_db_find (&key);
742  if (t)
743  {
744  if (sw_if_indexp)
745  sw_if_indexp[0] = t->sw_if_index;
746  return VNET_API_ERROR_IF_ALREADY_EXISTS;
747  }
748 
750  clib_memset (t, 0, sizeof (*t));
751 
752  /* Reconcile the real dev_instance and a possible requested instance */
753  u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
754  u32 u_idx = instance; /* user specified instance */
755  if (u_idx == ~0)
756  u_idx = t_idx;
757  if (hash_get (gm->instance_used, u_idx))
758  {
759  pool_put (gm->tunnels, t);
760  return VNET_API_ERROR_INSTANCE_IN_USE;
761  }
762  hash_set (gm->instance_used, u_idx, 1);
763 
764  t->dev_instance = t_idx; /* actual */
765  t->user_instance = u_idx; /* name */
766 
767  hw_if_index = vnet_register_interface (vnm, ipip_device_class.index, t_idx,
768  (mode == IPIP_MODE_P2P ?
770  mipip_hw_interface_class.index),
771  t_idx);
772 
773  hi = vnet_get_hw_interface (vnm, hw_if_index);
774  sw_if_index = hi->sw_if_index;
775 
776  t->mode = mode;
777  t->hw_if_index = hw_if_index;
778  t->fib_index = fib_index;
780  t->dscp = dscp;
781  t->flags = flags;
782  t->transport = transport;
783 
784  vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
785  gm->tunnel_index_by_sw_if_index[sw_if_index] = t_idx;
786 
787  if (t->transport == IPIP_TRANSPORT_IP4)
788  {
789  hi->min_packet_bytes = 64 + sizeof (ip4_header_t);
790  }
791  else
792  {
793  hi->min_packet_bytes = 64 + sizeof (ip6_header_t);
794  }
795 
796  /* Standard default ipip MTU. */
798 
799  t->tunnel_src = *src;
800  t->tunnel_dst = *dst;
801 
802  ipip_tunnel_db_add (t, &key);
803 
804  if (t->mode == IPIP_MODE_P2MP)
806 
807  if (sw_if_indexp)
808  *sw_if_indexp = sw_if_index;
809 
810  if (t->transport == IPIP_TRANSPORT_IP6 && !gm->ip6_protocol_registered)
811  {
812  ip6_register_protocol (IP_PROTOCOL_IP_IN_IP, ipip6_input_node.index);
813  ip6_register_protocol (IP_PROTOCOL_MPLS_IN_IP, ipip6_input_node.index);
814  ip6_register_protocol (IP_PROTOCOL_IPV6, ipip6_input_node.index);
815  gm->ip6_protocol_registered = true;
816  }
817  else if (t->transport == IPIP_TRANSPORT_IP4 && !gm->ip4_protocol_registered)
818  {
819  ip4_register_protocol (IP_PROTOCOL_IP_IN_IP, ipip4_input_node.index);
820  ip4_register_protocol (IP_PROTOCOL_MPLS_IN_IP, ipip4_input_node.index);
821  ip4_register_protocol (IP_PROTOCOL_IPV6, ipip4_input_node.index);
822  gm->ip4_protocol_registered = true;
823  }
824  return 0;
825 }
826 
827 int
829 {
831  vnet_main_t *vnm = gm->vnet_main;
832  ipip_tunnel_t *t;
833  ipip_tunnel_key_t key;
834 
836  if (t == NULL)
837  return VNET_API_ERROR_NO_SUCH_ENTRY;
838 
839  if (t->mode == IPIP_MODE_P2MP)
841 
842  vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */ );
843  gm->tunnel_index_by_sw_if_index[sw_if_index] = ~0;
845  hash_unset (gm->instance_used, t->user_instance);
846 
847  ipip_mk_key (t, &key);
849  pool_put (gm->tunnels, t);
850 
851  return 0;
852 }
853 
854 const static teib_vft_t ipip_teib_vft = {
856  .nv_deleted = ipip_teib_entry_deleted,
857 };
858 
859 static clib_error_t *
861 {
863 
864  clib_memset (gm, 0, sizeof (gm[0]));
865  gm->vlib_main = vm;
866  gm->vnet_main = vnet_get_main ();
867  gm->tunnel_by_key =
868  hash_create_mem (0, sizeof (ipip_tunnel_key_t), sizeof (uword));
869 
871 
872  return 0;
873 }
874 
876 
877 /*
878  * fd.io coding-style-patch-verification: ON
879  *
880  * Local Variables:
881  * eval: (c-set-style "gnu")
882  * End:
883  */
ADJ_FLAG_MIDCHAIN_NO_COUNT
@ ADJ_FLAG_MIDCHAIN_NO_COUNT
Definition: adj.h:217
ipip_mk_key_i
void ipip_mk_key_i(ipip_transport_t transport, ipip_mode_t mode, const ip46_address_t *src, const ip46_address_t *dst, u32 fib_index, ipip_tunnel_key_t *key)
Definition: ipip.c:591
ip_address
Definition: ip_types.h:79
ipip_tx_trace_t
Definition: ipip.c:34
format_ipip_device
static u8 * format_ipip_device(u8 *s, va_list *args)
Definition: ipip.c:469
ip_addr_46
#define ip_addr_46(_a)
Definition: ip_types.h:90
adj_midchain.h
ip_adjacency_t_::ia_nh_proto
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
Definition: adj.h:350
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
ipip_build_rewrite
static u8 * ipip_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Definition: ipip.c:57
ipip_tunnel_restack
static void ipip_tunnel_restack(ipip_tunnel_t *gt)
Definition: ipip.c:295
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
teib_entry_find_46
teib_entry_t * teib_entry_find_46(u32 sw_if_index, fib_protocol_t fproto, const ip46_address_t *peer)
Definition: teib.c:131
ipip_teib_mk_key
static void ipip_teib_mk_key(const ipip_tunnel_t *t, const teib_entry_t *ne, ipip_tunnel_key_t *key)
Definition: ipip.c:613
mipip_walk_ctx_t_
Definition: ipip.c:363
tunnel_encap_decap_flags_t
enum tunnel_encap_decap_flags_t_ tunnel_encap_decap_flags_t
tunnel_encap_fixup_mplso4
static_always_inline void tunnel_encap_fixup_mplso4(tunnel_encap_decap_flags_t flags, const mpls_unicast_header_t *inner, ip4_header_t *outer)
Definition: tunnel_dp.h:179
vnet_sw_interface_set_mtu
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:706
ip_dscp_t
enum ip_dscp_t_ ip_dscp_t
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
ipip_get_fixup
static adj_midchain_fixup_t ipip_get_fixup(const ipip_tunnel_t *t, vnet_link_t lt, adj_flags_t *aflags)
Definition: ipip.c:309
ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR
@ ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR
Definition: adj.h:220
mipip_walk_ctx_t_::t
const ipip_tunnel_t * t
Definition: ipip.c:365
ip4
vl_api_ip4_address_t ip4
Definition: one.api:376
FOR_EACH_FIB_IP_PROTOCOL
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
Definition: fib_types.h:69
ipip64_fixup
static void ipip64_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:139
ipip_tunnel_t::fib_index
u32 fib_index
Definition: ipip.h:84
VNET_LINK_ETHERNET
@ VNET_LINK_ETHERNET
Definition: interface.h:350
pointer_to_uword
static uword pointer_to_uword(const void *p)
Definition: types.h:131
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
ipip_init
static clib_error_t * ipip_init(vlib_main_t *vm)
Definition: ipip.c:860
adj_midchain_fixup_t
void(* adj_midchain_fixup_t)(vlib_main_t *vm, const struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
Definition: adj.h:152
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
ipip_tunnel_db_find_by_sw_if_index
ipip_tunnel_t * ipip_tunnel_db_find_by_sw_if_index(u32 sw_if_index)
Definition: ipip.c:563
ipip_tx_trace_t::src
ip46_address_t src
Definition: ipip.c:38
ipip_teib_entry_deleted
static void ipip_teib_entry_deleted(const teib_entry_t *ne)
Definition: ipip.c:664
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
adj_walk_rc_t
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
ipip6_input_node
vlib_node_registration_t ipip6_input_node
(constructor) VLIB_REGISTER_NODE (ipip6_input_node)
Definition: node.c:280
mipip_mk_incomplete_walk
static adj_walk_rc_t mipip_mk_incomplete_walk(adj_index_t ai, void *data)
Definition: ipip.c:401
adj_midchain_delegate_stack
void adj_midchain_delegate_stack(adj_index_t ai, u32 fib_index, const fib_prefix_t *pfx)
create/attach a midchain delegate and stack it on the prefix passed
Definition: adj_midchain_delegate.c:101
ipipm4_fixup
static void ipipm4_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:232
tunnel_encap_fixup_mplso6
static_always_inline void tunnel_encap_fixup_mplso6(tunnel_encap_decap_flags_t flags, const vlib_buffer_t *b, const mpls_unicast_header_t *inner, ip6_header_t *outer)
Definition: tunnel_dp.h:163
ipip_tunnel_t::sw_if_index
u32 sw_if_index
Definition: ipip.h:86
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:844
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
mpls_unicast_header_t
Definition: packet.h:28
tunnel_encap_fixup_6o4
static_always_inline void tunnel_encap_fixup_6o4(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip4_header_t *outer)
Definition: tunnel_dp.h:95
ip6_set_dscp_network_order
static_always_inline void ip6_set_dscp_network_order(ip6_header_t *ip6, ip_dscp_t dscp)
Definition: ip6_packet.h:357
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
ipip_tunnel_t::transport
ipip_transport_t transport
Definition: ipip.h:81
ip4_register_protocol
void ip4_register_protocol(u32 protocol, u32 node_index)
Definition: ip4_forward.c:1872
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
ipipm6_fixup
static void ipipm6_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:211
vlib_buffer_length_in_chain
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:433
teib_entry_get_nh
const fib_prefix_t * teib_entry_get_nh(const teib_entry_t *te)
Definition: teib.c:96
ip4_header_t
Definition: ip4_packet.h:87
ipip_tunnel_t
A representation of a IPIP tunnel.
Definition: ipip.h:75
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
ip4_header_set_df
static void ip4_header_set_df(ip4_header_t *ip4)
Definition: ip4_packet.h:375
key
typedef key
Definition: ipsec_types.api:91
ipip44_fixup
static void ipip44_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:155
teib_entry_get
teib_entry_t * teib_entry_get(index_t tei)
Definition: teib.c:108
adj_flags_t
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
teib.h
hash_set_mem_alloc
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
Definition: hash.h:279
ti
u32 ti
Definition: interface_output.c:425
ip_addr_version
#define ip_addr_version(_a)
Definition: ip_types.h:93
format_ipip_tx_trace
u8 * format_ipip_tx_trace(u8 *s, va_list *args)
Definition: ipip.c:43
tunnel_encap_fixup_6o6
static_always_inline void tunnel_encap_fixup_6o6(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip6_header_t *outer)
Definition: tunnel_dp.h:129
ipip66_fixup
static void ipip66_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:191
teib_entry_t_
Definition: teib.c:33
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(ipip_device_class)
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
IPIP_TRANSPORT_IP4
@ IPIP_TRANSPORT_IP4
Definition: ipip.h:49
ipip_interface_admin_up_down
static clib_error_t * ipip_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: ipip.c:479
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
ipip_hw_interface_class
vnet_hw_interface_class_t ipip_hw_interface_class
ipip_tunnel_t::mode
ipip_mode_t mode
Definition: ipip.h:80
VNET_LINK_IP4
@ VNET_LINK_IP4
Definition: interface.h:344
ipip_mk_key
void ipip_mk_key(const ipip_tunnel_t *t, ipip_tunnel_key_t *key)
Definition: ipip.c:606
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
ipip_tunnel_t::dev_instance
u32 dev_instance
Definition: ipip.h:87
format.h
ipip_main_t
Definition: ipip.h:104
ipip_tunnel_db_add
void ipip_tunnel_db_add(ipip_tunnel_t *t, const ipip_tunnel_key_t *key)
Definition: ipip.c:575
hash_get
#define hash_get(h, key)
Definition: hash.h:249
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
ipip_update_adj
void ipip_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: ipip.c:332
uword
u64 uword
Definition: types.h:112
vnet_delete_hw_interface
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:1051
ipip_tunnel_t::tunnel_dst
ip46_address_t tunnel_dst
Definition: ipip.h:83
ipip_tunnel_delete_teib_walk
static walk_rc_t ipip_tunnel_delete_teib_walk(index_t nei, void *ctx)
Definition: ipip.c:698
VNET_LINK_MPLS
@ VNET_LINK_MPLS
Definition: interface.h:349
ipip_tx_trace_t::tunnel_id
u32 tunnel_id
Definition: ipip.c:36
ip4_header_set_dscp
static void ip4_header_set_dscp(ip4_header_t *ip4, ip_dscp_t dscp)
Definition: ip4_packet.h:320
tunnel_encap_fixup_4o4
static_always_inline void tunnel_encap_fixup_4o4(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip4_header_t *outer)
Definition: tunnel_dp.h:25
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
teib_vft_t_
Definition: teib.h:72
mipip_walk_ctx_t
struct mipip_walk_ctx_t_ mipip_walk_ctx_t
src
vl_api_address_t src
Definition: gre.api:54
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
ip_adjacency_t_
IP unicast adjacency.
Definition: adj.h:235
ipip_del_tunnel
int ipip_del_tunnel(u32 sw_if_index)
Definition: ipip.c:828
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
teib_entry_get_fib_index
u32 teib_entry_get_fib_index(const teib_entry_t *te)
Definition: teib.c:84
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
ipip_tunnel_db_remove
void ipip_tunnel_db_remove(ipip_tunnel_t *t, const ipip_tunnel_key_t *key)
Definition: ipip.c:583
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
ipip_teib_entry_added
static void ipip_teib_entry_added(const teib_entry_t *ne)
Definition: ipip.c:627
ADJ_FLAG_NONE
@ ADJ_FLAG_NONE
Definition: adj.h:215
adj_midchain_delegate_unstack
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
Definition: adj_midchain_delegate.c:135
gm
#define gm
Definition: dlmalloc.c:1219
ip46_address_is_zero
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
Definition: ip46_address.h:87
data
u8 data[128]
Definition: ipsec_types.api:95
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
ip_adjacency_t_::sub_type
union ip_adjacency_t_::@144 sub_type
adj_nbr_midchain_update_rewrite
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
Definition: adj_midchain.c:213
teib_walk_itf
void teib_walk_itf(u32 sw_if_index, teib_walk_cb_t fn, void *ctx)
Definition: teib.c:328
teib_register
void teib_register(const teib_vft_t *vft)
Definition: teib.c:408
ipip_tunnel_t::tunnel_src
ip46_address_t tunnel_src
Definition: ipip.h:82
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
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
teib_entry_get_sw_if_index
u32 teib_entry_get_sw_if_index(const teib_entry_t *te)
accessors for the opaque struct
Definition: teib.c:72
adj_get_link_type
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
Definition: adj.c:530
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
af
vl_api_address_family_t af
Definition: ip.api:619
ipip_tunnel_add_teib_walk
static walk_rc_t ipip_tunnel_add_teib_walk(index_t nei, void *ctx)
Definition: ipip.c:710
ipip_tunnel_db_find
ipip_tunnel_t * ipip_tunnel_db_find(const ipip_tunnel_key_t *key)
Definition: ipip.c:551
ip6
vl_api_ip6_address_t ip6
Definition: one.api:424
teib_vft_t_::nv_added
teib_entry_added_t nv_added
Definition: teib.h:74
ipip_tx_trace_t::length
u32 length
Definition: ipip.c:37
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
IPIP_MODE_P2P
@ IPIP_MODE_P2P
Definition: ipip.h:55
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
teib_entry_get_peer
const ip_address_t * teib_entry_get_peer(const teib_entry_t *te)
Definition: teib.c:90
instance
u32 instance
Definition: gre.api:51
ip6_header_t
Definition: ip6_packet.h:294
ip4_fib.h
ip6_fib.h
ipip_tunnel_t::hw_if_index
u32 hw_if_index
Definition: ipip.h:85
IPIP_TRANSPORT_IP6
@ IPIP_TRANSPORT_IP6
Definition: ipip.h:50
mipip_walk_ctx_t_::ne
const teib_entry_t * ne
Definition: ipip.c:366
hash_unset_mem_free
static void hash_unset_mem_free(uword **h, const void *key)
Definition: hash.h:295
adj_nbr.h
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
tunnel_mode_t
enum tunnel_mode_t_ tunnel_mode_t
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
ipip_tunnel_desc
static int ipip_tunnel_desc(u32 sw_if_index, ip46_address_t *src, ip46_address_t *dst, u8 *is_l2)
Definition: ipip.c:502
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
vlib_node_t
Definition: node.h:247
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
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
ipip_tx_trace_t::dst
ip46_address_t dst
Definition: ipip.c:39
ipip_teib_vft
const static teib_vft_t ipip_teib_vft
Definition: ipip.c:854
IPIP_MODE_P2MP
@ IPIP_MODE_P2MP
Definition: ipip.h:56
VNET_LINK_IP6
@ VNET_LINK_IP6
Definition: interface.h:348
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
ipip_main
ipip_main_t ipip_main
Definition: ipip.c:31
ip4_header_checksum
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:314
adj_nbr_walk_nh
void adj_nbr_walk_nh(u32 sw_if_index, fib_protocol_t adj_nh_proto, const ip46_address_t *nh, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given next-hop.
Definition: adj_nbr.c:684
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
ipip_tunnel_stack
static void ipip_tunnel_stack(adj_index_t ai)
Definition: ipip.c:252
uword_to_pointer
#define uword_to_pointer(u, type)
Definition: types.h:136
teib_entry_adj_stack
void teib_entry_adj_stack(const teib_entry_t *te, adj_index_t ai)
Definition: teib.c:102
ADJ_WALK_RC_CONTINUE
@ ADJ_WALK_RC_CONTINUE
Definition: adj_types.h:44
ip_adjacency_t_::nbr
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
ipip.h
adj_nbr_walk
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
Definition: adj_nbr.c:592
ip6_register_protocol
void ip6_register_protocol(u32 protocol, u32 node_index)
Definition: ip6_forward.c:1677
ipip46_fixup
static void ipip46_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:171
ipip_tunnel_t::user_instance
u32 user_instance
Definition: ipip.h:88
mipip_mk_complete_walk
static adj_walk_rc_t mipip_mk_complete_walk(adj_index_t ai, void *data)
Definition: ipip.c:370
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
vnet_hw_interface_get_flags
static uword vnet_hw_interface_get_flags(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:299
ipip_tunnel_t::flags
tunnel_encap_decap_flags_t flags
Definition: ipip.h:89
VNET_HW_INTERFACE_CLASS_FLAG_NBMA
@ VNET_HW_INTERFACE_CLASS_FLAG_NBMA
a non-broadcast multiple access interface
Definition: interface.h:398
vnet.h
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
tunnel_encap_fixup_4o6
static_always_inline void tunnel_encap_fixup_4o6(tunnel_encap_decap_flags_t flags, const vlib_buffer_t *b, const ip4_header_t *inner, ip6_header_t *outer)
Definition: tunnel_dp.h:145
ipip4_input_node
vlib_node_registration_t ipip4_input_node
(constructor) VLIB_REGISTER_NODE (ipip4_input_node)
Definition: node.c:264
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
rewrite
rewrite
Definition: pnat.api:158
ipip_adj_walk_cb
static adj_walk_rc_t ipip_adj_walk_cb(adj_index_t ai, void *ctx)
Definition: ipip.c:287
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(ipip_hw_interface_class)
mipip_update_adj
void mipip_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: ipip.c:418
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
ADJ_FLAG_MIDCHAIN_IP_STACK
@ ADJ_FLAG_MIDCHAIN_IP_STACK
Definition: adj.h:218
adj_get
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:470
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
dscp
vl_api_ip_dscp_t dscp
Definition: dhcp.api:163
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
ipip_add_tunnel
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, tunnel_encap_decap_flags_t flags, ip_dscp_t dscp, tunnel_mode_t tmode, u32 *sw_if_indexp)
Definition: ipip.c:722
tunnel_dp.h
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
format_ipip_tunnel_name
static u8 * format_ipip_tunnel_name(u8 *s, va_list *args)
Definition: ipip.c:455
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
ipip_tunnel_t::dscp
ip_dscp_t dscp
Definition: ipip.h:90
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105