FD.io VPP  v18.07-34-g55fbdb9
Vector Packet Processing
sixrd.c
Go to the documentation of this file.
1 /*
2  * sixrd.c - 6RD specific functions (RFC5969)
3  *
4  * Copyright (c) 2018 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /**
19  * This code supports the following sixrd modes:
20  *
21  * 32 EA bits (Complete IPv4 address is embedded):
22  * ea_bits_len = 32
23  * IPv4 suffix is embedded:
24  * ea_bits_len = < 32
25  * No embedded address bits (1:1 mode):
26  * ea_bits_len = 0
27  */
28 
29 #include "ipip.h"
30 #include <vlibapi/api.h>
31 #include <vlibmemory/api.h>
32 #include <vnet/adj/adj.h>
33 #include <vnet/adj/adj_delegate.h>
34 #include <vnet/adj/adj_midchain.h>
35 #include <vnet/dpo/lookup_dpo.h>
36 #include <vnet/fib/fib_table.h>
37 #include <vnet/fib/ip6_fib.h>
38 #include <vnet/plugin/plugin.h>
39 
41 
42 /**
43  * Adj delegate data
44  */
45 typedef struct sixrd_adj_delegate_t_
46 {
52 
53 /**
54  * Pool of delegate structs
55  */
57 
58 /**
59  * Adj delegate registered type
60  */
62 
63 /**
64  * FIB node registered type
65  */
67 
68 static inline sixrd_adj_delegate_t *
70 {
71  if (ad == NULL)
72  return (NULL);
73  return (pool_elt_at_index (sixrd_adj_delegate_pool, ad->ad_index));
74 }
75 
76 static inline const sixrd_adj_delegate_t *
78 {
79  if (ad == NULL)
80  {
81  return (NULL);
82  }
83  return (pool_elt_at_index (sixrd_adj_delegate_pool, ad->ad_index));
84 }
85 
86 static void
88  const void *data)
89 {
91  ip6_header_t *ip6 = vlib_buffer_get_current (b0) + sizeof (ip4_header_t);
92  const ipip_tunnel_t *t = data;
93 
94  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
95  ip4->dst_address.as_u32 =
97  ip4->checksum = ip4_header_checksum (ip4);
98 }
99 
100 static void
102  const void *data)
103 {
104  const ipip_tunnel_t *t = data;
106  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
107  ip4->dst_address.as_u32 =
108  sixrd_get_addr_net (t, adj->sub_type.nbr.next_hop.as_u64[0]);
109  ip4->checksum = ip4_header_checksum (ip4);
110 }
111 
112 static u8 *
113 sixrd_build_rewrite (vnet_main_t * vnm, u32 sw_if_index,
114  vnet_link_t link_type, const void *dst_address)
115 {
116  u8 *rewrite = NULL;
117  ipip_tunnel_t *t;
118 
119  t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
120  if (!t)
121  return 0;
122 
123  vec_validate (rewrite, sizeof (ip4_header_t) - 1);
124  ip4_header_t *ip4 = (ip4_header_t *) rewrite;
125  ip4->ip_version_and_header_length = 0x45;
126  ip4->ttl = 64;
127  ip4->protocol = IP_PROTOCOL_IPV6;
128  /* fixup ip4 header length and checksum after-the-fact */
129  ip4->src_address.as_u32 = t->tunnel_src.ip4.as_u32;
130  ip4->dst_address.as_u32 = 0;
131  ip4->checksum = ip4_header_checksum (ip4);
132 
133  return rewrite;
134 }
135 
136 static void
137 ip6ip_tunnel_stack (adj_index_t ai, u32 fib_entry_index)
138 {
139  ip_adjacency_t *adj = adj_get (ai);
140  ipip_tunnel_t *t;
141  u32 sw_if_index = adj->rewrite_header.sw_if_index;
142 
143  t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
144  if (!t)
145  return;
146 
147  /*
148  * find the adjacency that is contributed by the FIB entry
149  * that this tunnel resolves via, and use it as the next adj
150  * in the midchain
151  */
154  {
157  (fib_entry_index));
158  }
159  else
160  {
162  }
163 }
164 
165 static void
167 {
168  dpo_id_t dpo = DPO_INVALID;
169  ip_adjacency_t *adj = adj_get (ai);
170  u32 sw_if_index = adj->rewrite_header.sw_if_index;
171 
173  if (!t)
174  return;
175 
179  adj_nbr_midchain_stack (ai, &dpo);
180  dpo_reset (&dpo);
181 }
182 
183 const static ip46_address_t sixrd_special_nh = {
184  .ip6 = {
185  .as_u64 = {
186  [0] = 0xffffffffffffffff,
187  [1] = 0xffffffffffffffff,
188  },
189  },
190 };
191 
192 static void
193 sixrd_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
194 {
195  ip_adjacency_t *adj = adj_get (ai);
197 
198  /* Not our tunnel */
199  if (!t)
200  return;
201  if (!memcmp (&sixrd_special_nh, &adj->sub_type.nbr.next_hop,
202  sizeof (sixrd_special_nh)))
203  {
205  sixrd_build_rewrite (vnm, sw_if_index,
207  (ai), NULL));
208  sixrd_tunnel_stack (ai, t->fib_index);
209  }
210  else
211  {
212  sixrd_adj_delegate_t *sixrd_ad;
213  ip4_address_t da4;
214 
215  da4.as_u32 =
216  sixrd_get_addr_net (t, adj->sub_type.nbr.next_hop.as_u64[0]);
217 
218  fib_prefix_t pfx = {
220  .fp_len = 32,
221  .fp_addr = {
222  .ip4 = da4,
223  }
224  ,
225  };
226 
228  sixrd_build_rewrite (vnm, sw_if_index,
230  (ai), NULL));
231 
232  sixrd_ad =
234  if (sixrd_ad == NULL)
235  {
236  pool_get (sixrd_adj_delegate_pool, sixrd_ad);
238  sixrd_ad->adj_index = ai;
239  sixrd_ad->sixrd_fib_entry_index =
242  sixrd_ad->sixrd_sibling =
245  sixrd_ad - sixrd_adj_delegate_pool);
246 
248  sixrd_ad - sixrd_adj_delegate_pool);
249 
251  }
252  }
253 }
254 
255 clib_error_t *
257 {
258  /* Always up */
259  vnet_hw_interface_set_flags (vnm, hw_if_index,
261  return /* no error */ 0;
262 }
263 
264 /* *INDENT-OFF* */
265 VNET_HW_INTERFACE_CLASS(sixrd_hw_interface_class) = {
266  .name = "ip6ip-6rd",
267  .build_rewrite = sixrd_build_rewrite,
268  .update_adjacency = sixrd_update_adj,
269 };
270 
271 VNET_DEVICE_CLASS(sixrd_device_class) = {
272  .name = "ip6ip-6rd",
273  .admin_up_down_function = sixrd_interface_admin_up_down,
274 #ifdef SOON
275  .clear counter = 0;
276 #endif
277 }
278 ;
279 /* *INDENT-ON* */
280 
281 int
282 sixrd_add_tunnel (ip6_address_t * ip6_prefix, u8 ip6_prefix_len,
283  ip4_address_t * ip4_prefix, u8 ip4_prefix_len,
284  ip4_address_t * ip4_src, bool security_check,
285  u32 ip4_fib_index, u32 ip6_fib_index, u32 * sw_if_index)
286 {
287  ipip_main_t *gm = &ipip_main;
288  ipip_tunnel_t *t;
289 
290  if ((ip6_prefix_len + 32 - ip4_prefix_len) > 64)
291  return VNET_API_ERROR_INVALID_VALUE;
292 
293  /* Tunnel already configured */
294  ip46_address_t src = ip46_address_initializer, dst =
296  ip_set (&src, ip4_src, true);
297  ipip_tunnel_key_t key = {
299  .fib_index = ip4_fib_index,
300  .src = src,
301  .dst = dst
302  };
303 
304  t = ipip_tunnel_db_find (&key);
305  if (t)
306  return VNET_API_ERROR_IF_ALREADY_EXISTS;
307 
308  /* Get tunnel index */
310  memset (t, 0, sizeof (*t));
311  u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
312 
313  /* Init tunnel struct */
314  t->mode = IPIP_MODE_6RD;
315  t->sixrd.ip4_prefix.as_u32 = ip4_prefix->as_u32;
316  t->sixrd.ip4_prefix_len = ip4_prefix_len;
317  t->sixrd.ip6_prefix = *ip6_prefix;
318  t->sixrd.ip6_prefix_len = ip6_prefix_len;
319  t->sixrd.ip6_fib_index = ip6_fib_index;
320  t->tunnel_src = src;
321  t->sixrd.security_check = security_check;
322  t->sixrd.shift =
323  (ip4_prefix_len < 32) ? 64 - ip6_prefix_len - (32 - ip4_prefix_len) : 0;
324 
325  /* Create interface */
326  u32 hw_if_index =
327  vnet_register_interface (vnet_get_main (), sixrd_device_class.index,
328  t_idx,
329  sixrd_hw_interface_class.index, t_idx);
330 
331  /* Default the interface to up and enable IPv6 (payload) */
333  vnet_get_hw_interface (vnet_get_main (), hw_if_index);
334  t->hw_if_index = hw_if_index;
335  t->fib_index = ip4_fib_index;
336  t->sw_if_index = hi->sw_if_index;
337  t->dev_instance = t_idx;
338  t->user_instance = t_idx;
339 
341 
342  ipip_tunnel_db_add (t, &key);
343 
345  ~0);
346  gm->tunnel_index_by_sw_if_index[hi->sw_if_index] = t_idx;
347 
353 
354  /* Create IPv6 route/adjacency */
355  /* *INDENT-OFF* */
356  fib_prefix_t pfx6 = {
358  .fp_len = t->sixrd.ip6_prefix_len,
359  .fp_addr = {
360  .ip6 = t->sixrd.ip6_prefix,
361  },
362  };
363  /* *INDENT-ON* */
364 
366  fib_table_entry_update_one_path (ip6_fib_index, &pfx6, FIB_SOURCE_6RD,
368  &sixrd_special_nh, t->sw_if_index, ~0, 1,
370 
371  *sw_if_index = t->sw_if_index;
372 
373  if (!gm->ip4_protocol_registered)
374  {
376  vlib_get_node_by_name (gm->vlib_main, (u8 *) "ipip4-input");
377  ASSERT (ipip4_input);
378  ip4_register_protocol (IP_PROTOCOL_IPV6, ipip4_input->index);
379  }
380  return 0;
381 }
382 
383 /*
384  * sixrd_del_tunnel
385  */
386 int
387 sixrd_del_tunnel (u32 sw_if_index)
388 {
389  ipip_main_t *gm = &ipip_main;
391 
392  if (!t)
393  {
394  clib_warning ("SIXRD tunnel delete: tunnel does not exist: %d",
395  sw_if_index);
396  return -1;
397  }
398 
399  /* *INDENT-OFF* */
400  fib_prefix_t pfx6 = {
402  .fp_len = t->sixrd.ip6_prefix_len,
403  .fp_addr = {
404  .ip6 = t->sixrd.ip6_prefix,
405  },
406  };
407  /* *INDENT-ON* */
408 
409  fib_table_entry_path_remove (t->sixrd.ip6_fib_index, &pfx6,
412  &sixrd_special_nh, t->sw_if_index, ~0, 1,
415 
417  0 /* down */ );
420 
423  pool_put (gm->tunnels, t);
424 
425  return 0;
426 }
427 
428 static void
430 {
431  sixrd_adj_delegate_t *sixrd_ad;
432 
433  sixrd_ad = sixrd_adj_from_base (aed);
435  sixrd_ad->sixrd_sibling);
437  FIB_SOURCE_RR);
438  pool_put (sixrd_adj_delegate_pool, sixrd_ad);
439 }
440 
441 static u8 *
443 {
444  const sixrd_adj_delegate_t *sixrd_ad;
445 
446  sixrd_ad = sixrd_adj_from_const_base (aed);
447  s = format (s, "SIXRD:[fib-entry:%d]", sixrd_ad->sixrd_fib_entry_index);
448 
449  return (s);
450 }
451 
452 static void
454 {
455  /* top of the dependency tree, locks not managed here. */
456 }
457 
458 static sixrd_adj_delegate_t *
460 {
461  return ((sixrd_adj_delegate_t *) (((char *) node) -
463  sixrd_node)));
464 }
465 
469 {
470  sixrd_adj_delegate_t *sixrd_ad;
471 
472  sixrd_ad = sixrd_adj_delegate_from_fib_node (node);
473  ip6ip_tunnel_stack (sixrd_ad->adj_index, sixrd_ad->sixrd_fib_entry_index);
474 
476 }
477 
478 /**
479  * Function definition to get a FIB node from its index
480  */
481 static fib_node_t *
483 {
484  sixrd_adj_delegate_t *sixrd_ad;
485 
486  sixrd_ad = pool_elt_at_index (sixrd_adj_delegate_pool, index);
487 
488  return (&sixrd_ad->sixrd_node);
489 }
490 
491 /**
492  * VFT registered with the adjacency delegate
493  */
494 const static adj_delegate_vft_t sixrd_adj_delegate_vft = {
496  .adv_format = sixrd_adj_delegate_format,
497 };
498 
499 /**
500  * VFT registered with the FIB node for the adj delegate
501  */
502 const static fib_node_vft_t sixrd_fib_node_vft = {
504  .fnv_last_lock = sixrd_fib_node_last_lock_gone,
505  .fnv_back_walk = sixrd_fib_node_back_walk_notify,
506 };
507 
508 static clib_error_t *
510 {
511  clib_error_t *error = 0;
512 
513  /* Make sure the IPIP tunnel subsystem is initialised */
514  error = vlib_call_init_function (vm, ipip_init);
515 
517  adj_delegate_register_new_type (&sixrd_adj_delegate_vft);
518  sixrd_fib_node_type = fib_node_register_new_type (&sixrd_fib_node_vft);
519 
520  return error;
521 }
522 
524 
525 /*
526  * fd.io coding-style-patch-verification: ON
527  *
528  * Local Variables:
529  * eval: (c-set-style "gnu")
530  * End:
531  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:437
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:197
vmrglw vmrglh hi
void ipip_tunnel_db_remove(ipip_tunnel_t *t)
Definition: ipip.c:377
Recursive resolution source.
Definition: fib_entry.h:125
static sixrd_adj_delegate_t * sixrd_adj_delegate_from_fib_node(fib_node_t *node)
Definition: sixrd.c:459
clib_error_t * sixrd_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: sixrd.c:256
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:541
adj_delegate_adj_deleted_t adv_adj_deleted
Definition: adj_delegate.h:79
ip4_address_t src_address
Definition: ip4_packet.h:169
A representation of a IPIP tunnel.
Definition: ipip.h:69
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
struct ip_adjacency_t_::@45::@46 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
ip46_address_t tunnel_src
Definition: ipip.h:77
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: fib_entry.c:527
u64 as_u64[2]
Definition: ip6_packet.h:51
static void sixrd_fib_node_last_lock_gone(fib_node_t *node)
Definition: sixrd.c:453
static u8 * sixrd_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Definition: sixrd.c:113
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
Definition: ip.c:90
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
Definition: adj.c:388
#define NULL
Definition: clib.h:55
u32 index
Definition: node.h:273
IP unicast adjacency.
Definition: adj.h:175
union ip_adjacency_t_::@45 sub_type
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:478
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
fib_node_t sixrd_node
Definition: sixrd.c:48
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
Definition: fib_entry.c:538
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:62
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
static fib_node_t * sixrd_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
Definition: sixrd.c:482
VNET_HW_INTERFACE_CLASS(sixrd_hw_interface_class)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:458
void ip4_register_protocol(u32 protocol, u32 node_index)
Definition: ip4_forward.c:1584
Definition: fib_entry.h:277
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:250
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:228
u32 hw_if_index
Definition: ipip.h:80
bool ip4_protocol_registered
Definition: ipip.h:121
unsigned char u8
Definition: types.h:56
static void ip6ip_tunnel_stack(adj_index_t ai, u32 fib_entry_index)
Definition: sixrd.c:137
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
VNET_DEVICE_CLASS(sixrd_device_class)
static const ip46_address_t sixrd_special_nh
Definition: sixrd.c:183
static_always_inline u32 sixrd_get_addr_net(const ipip_tunnel_t *t, u64 dal)
Definition: ipip.h:133
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
Definition: fib_table.c:772
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:370
static void sixrd_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Definition: sixrd.c:87
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:156
static uword ipip4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: node.c:204
u32 user_instance
Definition: ipip.h:83
static const sixrd_adj_delegate_t * sixrd_adj_from_const_base(const adj_delegate_t *ad)
Definition: sixrd.c:77
ip4_address_t dst_address
Definition: ip4_packet.h:169
Aggregrate type for a prefix.
Definition: fib_types.h:188
u32 * tunnel_index_by_sw_if_index
Definition: ipip.h:111
fib_node_index_t sixrd_fib_entry_index
Definition: sixrd.c:49
Adj delegate.
Definition: adj_delegate.h:44
unsigned int u32
Definition: types.h:88
ipip_transport_t transport
Definition: ipip.h:56
#define vlib_call_init_function(vm, x)
Definition: init.h:227
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:758
static sixrd_adj_delegate_t * sixrd_adj_delegate_pool
Pool of delegate structs.
Definition: sixrd.c:56
static u8 * sixrd_adj_delegate_format(const adj_delegate_t *aed, u8 *s)
Definition: sixrd.c:442
Definition: fib_entry.h:275
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
static fib_node_back_walk_rc_t sixrd_fib_node_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: sixrd.c:467
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464
int adj_delegate_add(ip_adjacency_t *adj, adj_delegate_type_t adt, index_t adi)
Add a delegate to an adjacency.
Definition: adj_delegate.c:107
void ipip_tunnel_db_add(ipip_tunnel_t *t, ipip_tunnel_key_t *key)
Definition: ipip.c:367
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:343
ipip_tunnel_t * ipip_tunnel_db_find_by_sw_if_index(u32 sw_if_index)
Definition: ipip.c:355
enum adj_delegate_type_t_ adj_delegate_type_t
A Delagate is a means to implement the Delagation design pattern; the extension of an object&#39;s functi...
ipip_tunnel_t * tunnels
Definition: ipip.h:109
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:202
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:274
Adj delegate data.
Definition: sixrd.c:45
static adj_delegate_type_t sixrd_adj_delegate_type
Adj delegate registered type.
Definition: sixrd.c:61
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
Definition: lookup_dpo.c:133
An node in the FIB graph.
Definition: fib_node.h:287
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
Definition: fib_table.c:1228
#define ip46_address_initializer
Definition: ip6_packet.h:89
u32 flags
Definition: vhost_user.h:110
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
Definition: pool.h:188
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a &#39;special&#39; entry to the FIB.
Definition: fib_table.c:388
ipip_main_t ipip_main
Definition: ipip.c:28
vlib_main_t * vm
Definition: buffer.c:294
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:877
index_t ad_index
The index passed by the provider to identify its delegate instance.
Definition: adj_delegate.h:60
From 6RD.
Definition: fib_entry.h:70
#define clib_warning(format, args...)
Definition: error.h:59
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:506
fib_node_get_t fnv_get
Definition: fib_node.h:275
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
static void ip6ip_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Definition: sixrd.c:101
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
Definition: fib_table.c:1257
Context passed between object during a back walk.
Definition: fib_node.h:200
u32 fib_index
Definition: ipip.h:79
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:661
#define ASSERT(truth)
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
Definition: adj_midchain.c:570
adj_delegate_type_t adj_delegate_register_new_type(const adj_delegate_vft_t *vft)
adj_delegate_register_new_type
Definition: adj_delegate.c:190
struct ipip_tunnel_t::@229::@232 sixrd
adj_delegate_t * adj_delegate_get(const ip_adjacency_t *adj, adj_delegate_type_t type)
Get a delegate from an adjacency.
Definition: adj_delegate.c:58
long ctx[MAX_CONNS]
Definition: main.c:126
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
struct sixrd_adj_delegate_t_ sixrd_adj_delegate_t
Adj delegate data.
int sixrd_add_tunnel(ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip4_address_t *ip4_src, bool security_check, u32 ip4_fib_index, u32 ip6_fib_index, u32 *sw_if_index)
Definition: sixrd.c:282
vlib_node_registration_t ip4_sixrd_node
This code supports the following sixrd modes:
static void sixrd_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: sixrd.c:193
static clib_error_t * sixrd_init(vlib_main_t *vm)
Definition: sixrd.c:509
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
Definition: adj_midchain.c:548
static fib_node_type_t sixrd_fib_node_type
FIB node registered type.
Definition: sixrd.c:66
static sixrd_adj_delegate_t * sixrd_adj_from_base(adj_delegate_t *ad)
Definition: sixrd.c:69
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
Definition: fib_table.c:682
u32 sw_if_index
Definition: ipip.h:81
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:968
struct _vlib_node_registration vlib_node_registration_t
ipip_mode_t mode
Definition: ipip.h:74
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:195
static clib_error_t * ipip_init(vlib_main_t *vm)
Definition: ipip.c:585
An ADJ delegate virtual function table.
Definition: adj_delegate.h:77
static void sixrd_tunnel_stack(adj_index_t ai, u32 fib_index)
Definition: sixrd.c:166
static void sixrd_adj_delegate_adj_deleted(adj_delegate_t *aed)
Definition: sixrd.c:429
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:676
A FIB graph nodes virtual function table.
Definition: fib_node.h:274
u32 dev_instance
Definition: ipip.h:82
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
int sixrd_del_tunnel(u32 sw_if_index)
Definition: sixrd.c:387
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:231
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
Definition: interface.c:549
u8 ip_version_and_header_length
Definition: ip4_packet.h:137
#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:62
vlib_main_t * vlib_main
Definition: ipip.h:115
static u16 ip4_header_checksum(ip4_header_t *i)
Definition: ip4_packet.h:246
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip6_forward.c:142
ip6_address_t dst_address
Definition: ip6_packet.h:347