FD.io VPP  v19.04.1-1-ge4a0f9f
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 
30 
31 /* Packet trace structure */
32 typedef struct
33 {
36  ip46_address_t src;
37  ip46_address_t dst;
39 
40 u8 *
41 format_ipip_tx_trace (u8 * s, va_list * args)
42 {
43  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
44  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
45  ipip_tx_trace_t *t = va_arg (*args, ipip_tx_trace_t *);
46 
47  s =
48  format (s, "IPIP: tunnel %d len %d src %U dst %U", t->tunnel_id,
51  return s;
52 }
53 
54 static u8 *
56  vnet_link_t link_type, const void *dst_address)
57 {
58  ip4_header_t *ip4;
59  ip6_header_t *ip6;
60  u8 *rewrite = NULL;
62 
63  if (!t)
64  /* not one of ours */
65  return (0);
66 
67  switch (t->transport)
68  {
69  case IPIP_TRANSPORT_IP4:
70  vec_validate (rewrite, sizeof (*ip4) - 1);
71  ip4 = (ip4_header_t *) rewrite;
72  ip4->ip_version_and_header_length = 0x45;
73  ip4->ttl = 64;
74  /* fixup ip4 header length, protocol and checksum after-the-fact */
75  ip4->src_address.as_u32 = t->tunnel_src.ip4.as_u32;
76  ip4->dst_address.as_u32 = t->tunnel_dst.ip4.as_u32;
77  ip4->checksum = ip4_header_checksum (ip4);
78  if (t->tc_tos != 0xFF)
79  ip4->tos = t->tc_tos;
80  break;
81 
82  case IPIP_TRANSPORT_IP6:
83  vec_validate (rewrite, sizeof (*ip6) - 1);
84  ip6 = (ip6_header_t *) rewrite;
86  clib_host_to_net_u32 (6 << 28);
87  if (t->tc_tos != 0xFF)
89  ip6->hop_limit = 64;
90  /* fixup ip6 header length and protocol after-the-fact */
91  ip6->src_address.as_u64[0] = t->tunnel_src.ip6.as_u64[0];
92  ip6->src_address.as_u64[1] = t->tunnel_src.ip6.as_u64[1];
93  ip6->dst_address.as_u64[0] = t->tunnel_dst.ip6.as_u64[0];
94  ip6->dst_address.as_u64[1] = t->tunnel_dst.ip6.as_u64[1];
95  break;
96 
97  default:
98  /* pass through */
99  ;
100  }
101  return (rewrite);
102 }
103 
104 static void
106  const void *data)
107 {
108  ip4_header_t *ip4;
109  const ipip_tunnel_t *t = data;
110 
111  ip4 = vlib_buffer_get_current (b);
112  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b));
113  switch (adj->ia_link)
114  {
115  case VNET_LINK_IP6:
116  ip4->protocol = IP_PROTOCOL_IPV6;
117  if (t->tc_tos == 0xFF)
118  ip4->tos =
119  ip6_traffic_class_network_order ((const ip6_header_t *) (ip4 + 1));
120  break;
121 
122  case VNET_LINK_IP4:
123  ip4->protocol = IP_PROTOCOL_IP_IN_IP;
124  if (t->tc_tos == 0xFF)
125  ip4->tos = ((ip4_header_t *) (ip4 + 1))->tos;
126  break;
127 
128  default:
129  break;
130  }
131 
132  ip4->checksum = ip4_header_checksum (ip4);
133 }
134 
135 static void
137  const void *data)
138 {
139  ip6_header_t *ip6;
140  const ipip_tunnel_t *t = data;
141 
142  /* Must set locally originated otherwise we're not allowed to
143  fragment the packet later */
144  b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
145 
146  ip6 = vlib_buffer_get_current (b);
147  ip6->payload_length =
148  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b) -
149  sizeof (*ip6));
150  switch (adj->ia_link)
151  {
152  case VNET_LINK_IP6:
153  ip6->protocol = IP_PROTOCOL_IPV6;
154  if (t->tc_tos == 0xFF)
156  ip6_traffic_class_network_order ((const ip6_header_t *) (ip6 + 1)));
157  break;
158 
159  case VNET_LINK_IP4:
160  ip6->protocol = IP_PROTOCOL_IP_IN_IP;
161  if (t->tc_tos == 0xFF)
163  ((ip4_header_t *) (ip6 +
164  1))->tos);
165  break;
166 
167  default:
168  break;
169  }
170 }
171 
172 static void
174 {
175  ip_adjacency_t *adj;
176  ipip_tunnel_t *t;
178 
179  adj = adj_get (ai);
180  sw_if_index = adj->rewrite_header.sw_if_index;
181 
182  t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
183  if (!t)
184  return;
185 
188  {
190  }
191  else
192  {
193  /* *INDENT-OFF* */
194  fib_prefix_t dst = {
195  .fp_len = t->transport == IPIP_TRANSPORT_IP6 ? 128 : 32,
196  .fp_proto = (t->transport == IPIP_TRANSPORT_IP6 ?
199  .fp_addr = t->tunnel_dst
200  };
201  /* *INDENT-ON* */
202 
203  adj_midchain_delegate_stack (ai, t->fib_index, &dst);
204  }
205 }
206 
207 static adj_walk_rc_t
209 {
210  ipip_tunnel_stack (ai);
211 
212  return (ADJ_WALK_RC_CONTINUE);
213 }
214 
215 static void
217 {
218  fib_protocol_t proto;
219 
220  /*
221  * walk all the adjacencies on th IPIP interface and restack them
222  */
224  {
226  }
227 }
228 
229 void
231 {
233  ipip_tunnel_t *t;
234  adj_flags_t af;
235 
236  t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
237  if (!t)
238  return;
239 
244 
245  adj_nbr_midchain_update_rewrite (ai, f, t, af,
246  ipip_build_rewrite (vnm,
247  sw_if_index,
249  (ai), NULL));
250  ipip_tunnel_stack (ai);
251 }
252 
253 static u8 *
254 format_ipip_tunnel_name (u8 * s, va_list * args)
255 {
256  u32 dev_instance = va_arg (*args, u32);
258  ipip_tunnel_t *t;
259 
260  if (dev_instance >= vec_len (gm->tunnels))
261  return format (s, "<improperly-referenced>");
262 
263  t = pool_elt_at_index (gm->tunnels, dev_instance);
264  return format (s, "ipip%d", t->user_instance);
265 }
266 
267 static u8 *
268 format_ipip_device (u8 * s, va_list * args)
269 {
270  u32 dev_instance = va_arg (*args, u32);
271  CLIB_UNUSED (int verbose) = va_arg (*args, int);
272 
273  s = format (s, "IPIP tunnel: id %d\n", dev_instance);
274  return s;
275 }
276 
277 static clib_error_t *
279 {
281  ipip_tunnel_t *t;
282 
283  hi = vnet_get_hw_interface (vnm, hw_if_index);
284 
286  if (!t)
287  return 0;
288 
290  vnet_hw_interface_set_flags (vnm, hw_if_index,
292  else
293  vnet_hw_interface_set_flags (vnm, hw_if_index, 0 /* down */ );
294 
296 
297  return /* no error */ 0;
298 }
299 
300 /* *INDENT-OFF* */
301 VNET_DEVICE_CLASS(ipip_device_class) = {
302  .name = "IPIP tunnel device",
303  .format_device_name = format_ipip_tunnel_name,
304  .format_device = format_ipip_device,
305  .format_tx_trace = format_ipip_tx_trace,
306  .admin_up_down_function = ipip_interface_admin_up_down,
307 #ifdef SOON
308  .clear counter = 0;
309 #endif
310 };
311 
313  .name = "IPIP",
314  //.format_header = format_ipip_header_with_length,
315  //.unformat_header = unformat_ipip_header,
316  .build_rewrite = ipip_build_rewrite,
317  .update_adjacency = ipip_update_adj,
319 };
320 /* *INDENT-ON* */
321 
324 {
326  uword *p;
327 
328  p = hash_get_mem (gm->tunnel_by_key, key);
329  if (!p)
330  return (NULL);
331  return (pool_elt_at_index (gm->tunnels, p[0]));
332 }
333 
336 {
338  if (vec_len (gm->tunnel_index_by_sw_if_index) <= sw_if_index)
339  return NULL;
341  if (ti == ~0)
342  return NULL;
343  return pool_elt_at_index (gm->tunnels, ti);
344 }
345 
346 void
348 {
350 
351  t->key = clib_mem_alloc (sizeof (*t->key));
352  clib_memcpy (t->key, key, sizeof (*key));
354 }
355 
356 void
358 {
360 
361  hash_unset_mem (gm->tunnel_by_key, t->key);
362  clib_mem_free (t->key);
363  t->key = NULL;
364 }
365 
366 int
368  u32 instance, ip46_address_t * src, ip46_address_t * dst,
369  u32 fib_index, u8 tc_tos, u32 * sw_if_indexp)
370 {
372  vnet_main_t *vnm = gm->vnet_main;
373  ip4_main_t *im4 = &ip4_main;
374  ip6_main_t *im6 = &ip6_main;
375  ipip_tunnel_t *t;
377  u32 hw_if_index, sw_if_index;
378  ipip_tunnel_key_t key = {.transport = transport,
379  .fib_index = fib_index,
380  .src = *src,
381  .dst = *dst
382  };
383  t = ipip_tunnel_db_find (&key);
384  if (t)
385  return VNET_API_ERROR_IF_ALREADY_EXISTS;
386 
388  clib_memset (t, 0, sizeof (*t));
389 
390  /* Reconcile the real dev_instance and a possible requested instance */
391  u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
392  u32 u_idx = instance; /* user specified instance */
393  if (u_idx == ~0)
394  u_idx = t_idx;
395  if (hash_get (gm->instance_used, u_idx))
396  {
397  pool_put (gm->tunnels, t);
398  return VNET_API_ERROR_INSTANCE_IN_USE;
399  }
400  hash_set (gm->instance_used, u_idx, 1);
401 
402  t->dev_instance = t_idx; /* actual */
403  t->user_instance = u_idx; /* name */
404 
405  hw_if_index = vnet_register_interface (vnm, ipip_device_class.index, t_idx,
407  t_idx);
408 
409  hi = vnet_get_hw_interface (vnm, hw_if_index);
410  sw_if_index = hi->sw_if_index;
411 
412  t->hw_if_index = hw_if_index;
413  t->fib_index = fib_index;
415  t->tc_tos = tc_tos;
416 
417  t->transport = transport;
420 
421  if (t->transport == IPIP_TRANSPORT_IP4)
422  {
423  vec_validate (im4->fib_index_by_sw_if_index, sw_if_index);
424  hi->min_packet_bytes = 64 + sizeof (ip4_header_t);
425  }
426  else
427  {
428  vec_validate (im6->fib_index_by_sw_if_index, sw_if_index);
429  hi->min_packet_bytes = 64 + sizeof (ip6_header_t);
430  }
431 
432  /* Standard default ipip MTU. */
433  vnet_sw_interface_set_mtu (vnm, sw_if_index, 9000);
434 
435  t->tunnel_src = *src;
436  t->tunnel_dst = *dst;
437 
438  ipip_tunnel_db_add (t, &key);
439 
440  if (sw_if_indexp)
441  *sw_if_indexp = sw_if_index;
442 
444  {
445  ip6_register_protocol (IP_PROTOCOL_IP_IN_IP, ipip6_input_node.index);
446  ip6_register_protocol (IP_PROTOCOL_IPV6, ipip6_input_node.index);
447  gm->ip6_protocol_registered = true;
448  }
450  {
451  ip4_register_protocol (IP_PROTOCOL_IP_IN_IP, ipip4_input_node.index);
452  ip4_register_protocol (IP_PROTOCOL_IPV6, ipip4_input_node.index);
453  gm->ip4_protocol_registered = true;
454  }
455  return 0;
456 }
457 
458 int
460 {
462  vnet_main_t *vnm = gm->vnet_main;
463  ipip_tunnel_t *t;
464 
465 
466  t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
467  if (t == NULL)
468  return VNET_API_ERROR_NO_SUCH_ENTRY;
469 
470  vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */ );
475  pool_put (gm->tunnels, t);
476 
477  return 0;
478 }
479 
480 static clib_error_t *
482 {
484 
485  clib_memset (gm, 0, sizeof (gm[0]));
486  gm->vlib_main = vm;
487  gm->vnet_main = vnet_get_main ();
488  gm->tunnel_by_key =
489  hash_create_mem (0, sizeof (ipip_tunnel_key_t), sizeof (uword));
490 
491  return 0;
492 }
493 
495 
496 /*
497  * fd.io coding-style-patch-verification: ON
498  *
499  * Local Variables:
500  * eval: (c-set-style "gnu")
501  * End:
502  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:439
u32 sw_if_index
Definition: ipsec_gre.api:37
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:124
vmrglw vmrglh hi
void ipip_tunnel_db_remove(ipip_tunnel_t *t)
Definition: ipip.c:357
#define hash_set(h, key, value)
Definition: hash.h:255
u32 flags
Definition: vhost_user.h:115
#define CLIB_UNUSED(x)
Definition: clib.h:82
#define hash_unset(h, key)
Definition: hash.h:261
void ip6_register_protocol(u32 protocol, u32 node_index)
Definition: ip6_forward.c:1466
ip4_address_t src_address
Definition: ip4_packet.h:170
A representation of a IPIP tunnel.
Definition: ipip.h:70
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, u8 tc_tos, u32 *sw_if_indexp)
Definition: ipip.c:367
ip46_address_t tunnel_src
Definition: ipip.h:78
static clib_error_t * ipip_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: ipip.c:278
u64 as_u64[2]
Definition: ip6_packet.h:51
u32 length
Definition: ipip.c:35
vnet_hw_interface_class_t ipip_hw_interface_class
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
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
Definition: adj.c:468
#define NULL
Definition: clib.h:58
IP unicast adjacency.
Definition: adj.h:221
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u8 tc_tos
Definition: ipip.h:85
static u8 * format_ipip_device(u8 *s, va_list *args)
Definition: ipip.c:268
format_function_t format_ip46_address
Definition: format.h:61
#define hash_set_mem(h, key, value)
Definition: hash.h:275
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip4.h:112
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
u8 data[128]
Definition: ipsec.api:248
vl_api_ip4_address_t dst
Definition: ipsec_gre.api:39
void ip4_register_protocol(u32 protocol, u32 node_index)
Definition: ip4_forward.c:1699
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:366
u32 hw_if_index
Definition: ipip.h:81
ip6_address_t src_address
Definition: ip6_packet.h:385
bool ip4_protocol_registered
Definition: ipip.h:112
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vnet_link_t ia_link
link/ether-type 1 bytes
Definition: adj.h:242
#define clib_memcpy(d, s, n)
Definition: string.h:180
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:433
static void ipip4_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:105
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
u32 user_instance
Definition: ipip.h:84
ip4_address_t dst_address
Definition: ip4_packet.h:170
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
static_always_inline void ip6_set_traffic_class_network_order(ip6_header_t *ip6, u8 dscp)
Definition: ip6_packet.h:402
static_always_inline u8 ip6_traffic_class_network_order(const ip6_header_t *ip6)
Definition: ip6_packet.h:395
static void ipip_tunnel_restack(ipip_tunnel_t *gt)
Definition: ipip.c:216
Aggregrate type for a prefix.
Definition: fib_types.h:203
u32 tunnel_id
Definition: ipip.c:34
u32 * tunnel_index_by_sw_if_index
Definition: ipip.h:103
unsigned int u32
Definition: types.h:88
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:740
ip46_address_t dst
Definition: ipip.c:37
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:661
#define hash_get(h, key)
Definition: hash.h:249
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
#define hash_unset_mem(h, key)
Definition: hash.h:291
void ipip_tunnel_db_add(ipip_tunnel_t *t, ipip_tunnel_key_t *key)
Definition: ipip.c:347
static void ipip_tunnel_stack(adj_index_t ai)
Definition: ipip.c:173
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:55
static uword vnet_hw_interface_get_flags(vnet_main_t *vnm, u32 hw_if_index)
ipip_tunnel_t * ipip_tunnel_db_find(ipip_tunnel_key_t *key)
Definition: ipip.c:323
#define gm
Definition: dlmalloc.c:1217
long ctx[MAX_CONNS]
Definition: main.c:144
ipip_tunnel_t * ipip_tunnel_db_find_by_sw_if_index(u32 sw_if_index)
Definition: ipip.c:335
ipip_tunnel_t * tunnels
Definition: ipip.h:101
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:229
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:286
vl_api_ip4_address_t src
Definition: ipsec_gre.api:38
u8 * format_ipip_tx_trace(u8 *s, va_list *args)
Definition: ipip.c:41
ipip_tunnel_key_t * key
Definition: ipip.h:77
static void ipip6_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
Definition: ipip.c:136
static adj_walk_rc_t ipip_adj_walk_cb(adj_index_t ai, void *ctx)
Definition: ipip.c:208
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Definition: pool.h:230
VNET_HW_INTERFACE_CLASS(ipip_hw_interface_class)
ipip_transport_t
IPIP Tunnel key.
Definition: ipip.h:47
ipip_main_t ipip_main
Definition: ipip.c:29
vlib_main_t * vm
Definition: buffer.c:312
static u8 * format_ipip_tunnel_name(u8 *s, va_list *args)
Definition: ipip.c:254
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:500
vlib_node_registration_t ipip4_input_node
(constructor) VLIB_REGISTER_NODE (ipip4_input_node)
Definition: node.c:238
void(* adj_midchain_fixup_t)(vlib_main_t *vm, 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
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk the neighbour Adjacencies on a given interface.
Definition: adj_nbr.c:574
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
u32 fib_index
Definition: ipip.h:80
ip6_main_t ip6_main
Definition: ip6_forward.c:2680
ipip_transport_t transport
Definition: ipip.h:76
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
IPv4 main type.
Definition: ip4.h:96
static void clib_mem_free(void *p)
Definition: mem.h:205
uword * tunnel_by_key
Definition: ipip.h:102
ip46_address_t src
Definition: ipip.c:36
static void * clib_mem_alloc(uword size)
Definition: mem.h:132
void ipip_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: ipip.c:230
u32 sw_if_index
Definition: ipip.h:82
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:951
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
vlib_node_registration_t ipip6_input_node
(constructor) VLIB_REGISTER_NODE (ipip6_input_node)
Definition: node.c:254
u32 ip_version_traffic_class_and_flow_label
Definition: ip6_packet.h:372
u16 payload_length
Definition: ip6_packet.h:376
vnet_main_t * vnet_main
Definition: ipip.h:107
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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:504
VLIB buffer representation.
Definition: buffer.h:102
bool ip6_protocol_registered
Definition: ipip.h:113
u64 uword
Definition: types.h:112
typedef key
Definition: ipsec.api:244
static clib_error_t * ipip_init(vlib_main_t *vm)
Definition: ipip.c:481
a point 2 point interface
Definition: interface.h:357
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:642
int ipip_del_tunnel(u32 sw_if_index)
Definition: ipip.c:459
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
Definition: fib_types.h:70
#define hash_get_mem(h, key)
Definition: hash.h:269
u32 dev_instance
Definition: ipip.h:83
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:905
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:513
u8 ip_version_and_header_length
Definition: ip4_packet.h:138
ip46_address_t tunnel_dst
Definition: ipip.h:79
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
Definition: vec.h:486
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
vlib_main_t * vlib_main
Definition: ipip.h:106
u32 * fib_index_by_sw_if_index
Definition: ip6.h:194
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:247
uword * instance_used
Definition: ipip.h:110
VNET_DEVICE_CLASS(ipip_device_class)
ip6_address_t dst_address
Definition: ip6_packet.h:385