FD.io VPP  v21.06-3-gbb25fbf28
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>
38 #include <vnet/fib/ip6_fib.h>
39 #include <vnet/plugin/plugin.h>
40 
42 
43 /**
44  * Adj delegate data
45  */
46 typedef struct sixrd_adj_delegate_t_
47 {
53 
54 /**
55  * Pool of delegate structs
56  */
58 
59 /**
60  * Adj delegate registered type
61  */
63 
64 /**
65  * FIB node registered type
66  */
68 
69 static inline sixrd_adj_delegate_t *
71 {
72  if (ad == NULL)
73  return (NULL);
75 }
76 
77 static inline const sixrd_adj_delegate_t *
79 {
80  if (ad == NULL)
81  {
82  return (NULL);
83  }
85 }
86 
87 static void
89  const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
90 {
93  const ipip_tunnel_t *t = data;
94 
95  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
96  ip4->dst_address.as_u32 =
97  sixrd_get_addr_net (t, ip6->dst_address.as_u64[0]);
98  ip4->checksum = ip4_header_checksum (ip4);
99 }
100 
101 static void
103  const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
104 {
105  const ipip_tunnel_t *t = data;
107  ip4->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
108  ip4->dst_address.as_u32 =
109  sixrd_get_addr_net (t, adj->sub_type.nbr.next_hop.as_u64[0]);
110  ip4->checksum = ip4_header_checksum (ip4);
111 }
112 
113 static u8 *
115  vnet_link_t link_type, const void *dst_address)
116 {
117  u8 *rewrite = NULL;
118  ipip_tunnel_t *t;
119 
121  if (!t)
122  return 0;
123 
124  vec_validate (rewrite, sizeof (ip4_header_t) - 1);
126  ip4->ip_version_and_header_length = 0x45;
127  ip4->ttl = 64;
128  ip4->protocol = IP_PROTOCOL_IPV6;
129  /* fixup ip4 header length and checksum after-the-fact */
130  ip4->src_address.as_u32 = t->tunnel_src.ip4.as_u32;
131  ip4->dst_address.as_u32 = 0;
132  ip4->checksum = ip4_header_checksum (ip4);
133 
134  return rewrite;
135 }
136 
137 static void
138 ip6ip_tunnel_stack (adj_index_t ai, u32 fib_entry_index)
139 {
140  ip_adjacency_t *adj = adj_get (ai);
141  ipip_tunnel_t *t;
142  u32 sw_if_index = adj->rewrite_header.sw_if_index;
143 
145  if (!t)
146  return;
147 
148  /*
149  * find the adjacency that is contributed by the FIB entry
150  * that this tunnel resolves via, and use it as the next adj
151  * in the midchain
152  */
155  {
157  fib_entry_index,
159  }
160  else
161  {
163  }
164 }
165 
166 static void
168 {
169  dpo_id_t dpo = DPO_INVALID;
170  ip_adjacency_t *adj = adj_get (ai);
171  u32 sw_if_index = adj->rewrite_header.sw_if_index;
172 
174  if (!t)
175  return;
176 
180  adj_nbr_midchain_stack (ai, &dpo);
181  dpo_reset (&dpo);
182 }
183 
184 static void
186 {
187  ip_adjacency_t *adj = adj_get (ai);
189 
190  /* Not our tunnel */
191  if (!t)
192  return;
194  {
198  (ai), NULL));
199  sixrd_tunnel_stack (ai, t->fib_index);
200  }
201  else
202  {
203  sixrd_adj_delegate_t *sixrd_ad;
204  ip4_address_t da4;
205 
206  da4.as_u32 =
207  sixrd_get_addr_net (t, adj->sub_type.nbr.next_hop.as_u64[0]);
208 
209  fib_prefix_t pfx = {
211  .fp_len = 32,
212  .fp_addr = {
213  .ip4 = da4,
214  }
215  ,
216  };
217 
221  (ai), NULL));
222 
223  sixrd_ad =
225  if (sixrd_ad == NULL)
226  {
227  pool_get (sixrd_adj_delegate_pool, sixrd_ad);
229  sixrd_ad->adj_index = ai;
230  sixrd_ad->sixrd_fib_entry_index =
231  fib_entry_track (t->fib_index, &pfx,
233  sixrd_ad - sixrd_adj_delegate_pool,
234  &sixrd_ad->sixrd_sibling);
235 
237  sixrd_ad - sixrd_adj_delegate_pool);
238 
240  }
241  }
242 }
243 
244 clib_error_t *
246 {
247  /* Always up */
248  vnet_hw_interface_set_flags (vnm, hw_if_index,
250  return /* no error */ 0;
251 }
252 
253 /* *INDENT-OFF* */
254 VNET_HW_INTERFACE_CLASS(sixrd_hw_interface_class) = {
255  .name = "ip6ip-6rd",
256  .build_rewrite = sixrd_build_rewrite,
257  .update_adjacency = sixrd_update_adj,
258 };
259 
260 VNET_DEVICE_CLASS(sixrd_device_class) = {
261  .name = "ip6ip-6rd",
262  .admin_up_down_function = sixrd_interface_admin_up_down,
263 #ifdef SOON
264  .clear counter = 0;
265 #endif
266 }
267 ;
268 /* *INDENT-ON* */
269 
270 int
271 sixrd_add_tunnel (ip6_address_t * ip6_prefix, u8 ip6_prefix_len,
272  ip4_address_t * ip4_prefix, u8 ip4_prefix_len,
273  ip4_address_t * ip4_src, bool security_check,
274  u32 ip4_fib_index, u32 ip6_fib_index, u32 * sw_if_index)
275 {
277  ipip_tunnel_t *t;
278 
279  if ((ip6_prefix_len + 32 - ip4_prefix_len) > 64)
280  return VNET_API_ERROR_INVALID_VALUE;
281 
282  /* Tunnel already configured */
283  ip46_address_t src = ip46_address_initializer, dst =
285  ip_set (&src, ip4_src, true);
286  ipip_tunnel_key_t key;
287 
289  &key);
290 
291  t = ipip_tunnel_db_find (&key);
292  if (t)
293  return VNET_API_ERROR_IF_ALREADY_EXISTS;
294 
295  /* Get tunnel index */
297  clib_memset (t, 0, sizeof (*t));
298  u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
299 
300  /* Init tunnel struct */
301  t->mode = IPIP_MODE_6RD;
302  t->sixrd.ip4_prefix.as_u32 = ip4_prefix->as_u32;
303  t->sixrd.ip4_prefix_len = ip4_prefix_len;
305  t->sixrd.ip6_prefix_len = ip6_prefix_len;
306  t->sixrd.ip6_fib_index = ip6_fib_index;
307  t->tunnel_src = src;
308  t->sixrd.security_check = security_check;
309  t->sixrd.shift =
310  (ip4_prefix_len < 32) ? 64 - ip6_prefix_len - (32 - ip4_prefix_len) : 0;
311 
312  /* Create interface */
313  u32 hw_if_index =
314  vnet_register_interface (vnet_get_main (), sixrd_device_class.index,
315  t_idx,
316  sixrd_hw_interface_class.index, t_idx);
317 
318  /* Default the interface to up and enable IPv6 (payload) */
320  vnet_get_hw_interface (vnet_get_main (), hw_if_index);
321  t->hw_if_index = hw_if_index;
322  t->fib_index = ip4_fib_index;
323  t->sw_if_index = hi->sw_if_index;
324  t->dev_instance = t_idx;
325  t->user_instance = t_idx;
326 
328 
329  ipip_tunnel_db_add (t, &key);
330 
331  vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, hi->sw_if_index,
332  ~0);
333  gm->tunnel_index_by_sw_if_index[hi->sw_if_index] = t_idx;
334 
337  vnet_sw_interface_set_flags (vnet_get_main (), hi->sw_if_index,
340 
341  /* Create IPv6 route/adjacency */
342  /* *INDENT-OFF* */
343  fib_prefix_t pfx6 = {
345  .fp_len = t->sixrd.ip6_prefix_len,
346  .fp_addr = {
347  .ip6 = t->sixrd.ip6_prefix,
348  },
349  };
350  /* *INDENT-ON* */
351 
353  fib_table_entry_update_one_path (ip6_fib_index, &pfx6, FIB_SOURCE_6RD,
355  &ADJ_BCAST_ADDR, t->sw_if_index, ~0, 1,
357 
358  *sw_if_index = t->sw_if_index;
359 
360  if (!gm->ip4_protocol_registered)
361  {
362  vlib_node_t *ipip4_input =
363  vlib_get_node_by_name (gm->vlib_main, (u8 *) "ipip4-input");
364  ASSERT (ipip4_input);
365  ip4_register_protocol (IP_PROTOCOL_IPV6, ipip4_input->index);
366  }
367  return 0;
368 }
369 
370 /*
371  * sixrd_del_tunnel
372  */
373 int
375 {
378  ipip_tunnel_key_t key;
379 
380  if (!t)
381  {
382  clib_warning ("SIXRD tunnel delete: tunnel does not exist: %d",
383  sw_if_index);
384  return -1;
385  }
386 
387  /* *INDENT-OFF* */
388  fib_prefix_t pfx6 = {
390  .fp_len = t->sixrd.ip6_prefix_len,
391  .fp_addr = {
392  .ip6 = t->sixrd.ip6_prefix,
393  },
394  };
395  /* *INDENT-ON* */
396 
400  &ADJ_BCAST_ADDR, t->sw_if_index, ~0, 1,
403 
405  0 /* down */ );
407  gm->tunnel_index_by_sw_if_index[t->sw_if_index] = ~0;
408 
410  ipip_mk_key (t, &key);
412  pool_put (gm->tunnels, t);
413 
414  return 0;
415 }
416 
417 static void
419 {
420  sixrd_adj_delegate_t *sixrd_ad;
421 
422  sixrd_ad = sixrd_adj_from_base (aed);
424  sixrd_ad->sixrd_sibling);
425  pool_put (sixrd_adj_delegate_pool, sixrd_ad);
426 }
427 
428 static u8 *
430 {
431  const sixrd_adj_delegate_t *sixrd_ad;
432 
433  sixrd_ad = sixrd_adj_from_const_base (aed);
434  s = format (s, "SIXRD:[fib-entry:%d]", sixrd_ad->sixrd_fib_entry_index);
435 
436  return (s);
437 }
438 
439 static void
441 {
442  /* top of the dependency tree, locks not managed here. */
443 }
444 
445 static sixrd_adj_delegate_t *
447 {
448  return ((sixrd_adj_delegate_t *) (((char *) node) -
450  sixrd_node)));
451 }
452 
456 {
457  sixrd_adj_delegate_t *sixrd_ad;
458 
460  ip6ip_tunnel_stack (sixrd_ad->adj_index, sixrd_ad->sixrd_fib_entry_index);
461 
463 }
464 
465 /**
466  * Function definition to get a FIB node from its index
467  */
468 static fib_node_t *
470 {
471  sixrd_adj_delegate_t *sixrd_ad;
472 
474 
475  return (&sixrd_ad->sixrd_node);
476 }
477 
478 /**
479  * VFT registered with the adjacency delegate
480  */
483  .adv_format = sixrd_adj_delegate_format,
484 };
485 
486 /**
487  * VFT registered with the FIB node for the adj delegate
488  */
491  .fnv_last_lock = sixrd_fib_node_last_lock_gone,
492  .fnv_back_walk = sixrd_fib_node_back_walk_notify,
493 };
494 
495 static clib_error_t *
497 {
498  clib_error_t *error = 0;
499 
500  /* Make sure the IPIP tunnel subsystem is initialised */
502 
506 
507  return error;
508 }
509 
511 
512 /*
513  * fd.io coding-style-patch-verification: ON
514  *
515  * Local Variables:
516  * eval: (c-set-style "gnu")
517  * End:
518  */
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
sixrd_adj_delegate_t_::sixrd_sibling
u32 sixrd_sibling
Definition: sixrd.c:51
sixrd_del_tunnel
int sixrd_del_tunnel(u32 sw_if_index)
Definition: sixrd.c:374
sixrd_fib_node_last_lock_gone
static void sixrd_fib_node_last_lock_gone(fib_node_t *node)
Definition: sixrd.c:440
adj_midchain.h
adj.h
sixrd_adj_delegate_t_
Adj delegate data.
Definition: sixrd.c:46
adj_delegate_t_::ad_index
index_t ad_index
The index passed by the provider to identify its delegate instance.
Definition: adj_delegate.h:66
ipip_tunnel_t::shift
u8 shift
Definition: ipip.h:98
api.h
ip4_sixrd_node
vlib_node_registration_t ip4_sixrd_node
This code supports the following sixrd modes:
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_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
ip_set
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
Definition: ip.c:95
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
adj_delegate_vft_t_
An ADJ delegate virtual function table.
Definition: adj_delegate.h:94
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.
ip4
vl_api_ip4_address_t ip4
Definition: one.api:376
adj_delegate_t_
Adj delegate.
Definition: adj_delegate.h:50
fib_table_entry_update_one_path
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:814
ipip_tunnel_t::fib_index
u32 fib_index
Definition: ipip.h:84
ip46_address_initializer
#define ip46_address_initializer
Definition: ip46_address.h:52
sixrd_fib_node_get
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:469
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
ipip_init
static clib_error_t * ipip_init(vlib_main_t *vm)
Definition: ipip.c:864
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
sixrd_adj_delegate_from_fib_node
static sixrd_adj_delegate_t * sixrd_adj_delegate_from_fib_node(fib_node_t *node)
Definition: sixrd.c:446
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
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
fib_node_vft_t_
A FIB graph nodes virtual function table.
Definition: fib_node.h:288
FIB_ENTRY_FLAG_ATTACHED
@ FIB_ENTRY_FLAG_ATTACHED
Definition: fib_entry.h:114
sixrd_adj_delegate_type
static adj_delegate_type_t sixrd_adj_delegate_type
Adj delegate registered type.
Definition: sixrd.c:62
ip6ip_tunnel_stack
static void ip6ip_tunnel_stack(adj_index_t ai, u32 fib_entry_index)
Definition: sixrd.c:138
ip4_address_t::as_u32
u32 as_u32
Definition: ip4_packet.h:57
fib_table.h
ADJ_BCAST_ADDR
const ip46_address_t ADJ_BCAST_ADDR
The special broadcast address (to construct a broadcast adjacency.
Definition: adj.c:42
ipip_tunnel_t::sw_if_index
u32 sw_if_index
Definition: ipip.h:86
vlib_call_init_function
#define vlib_call_init_function(vm, x)
Definition: init.h:259
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
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
api.h
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
ipip_tunnel_t::ip6_prefix_len
u8 ip6_prefix_len
Definition: ipip.h:96
ip4_register_protocol
void ip4_register_protocol(u32 protocol, u32 node_index)
Definition: ip4_forward.c:1895
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
ipip_tunnel_t::security_check
bool security_check
Definition: ipip.h:99
sixrd_fib_node_back_walk_notify
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:454
ipip_tunnel_t::ip4_prefix_len
u8 ip4_prefix_len
Definition: ipip.h:97
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
sixrd_adj_delegate_t
struct sixrd_adj_delegate_t_ sixrd_adj_delegate_t
Adj delegate data.
fib_node_type_t
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
adj_nbr_midchain_stack_on_fib_entry
void adj_nbr_midchain_stack_on_fib_entry(adj_index_t ai, fib_node_index_t fei, fib_forward_chain_type_t fct)
[re]stack a midchain.
Definition: adj_midchain.c:335
sixrd_update_adj
static void sixrd_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
Definition: sixrd.c:185
ip4_header_t
Definition: ip4_packet.h:87
ipip_tunnel_t
A representation of a IPIP tunnel.
Definition: ipip.h:75
error
Definition: cJSON.c:88
key
typedef key
Definition: ipsec_types.api:88
ip6_prefix
manual_print typedef ip6_prefix
Definition: ip_types.api:125
sixrd_adj_delegate_adj_deleted
static void sixrd_adj_delegate_adj_deleted(adj_delegate_t *aed)
Definition: sixrd.c:418
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
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
STRUCT_OFFSET_OF
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:73
sixrd_adj_delegate_vft
const static adj_delegate_vft_t sixrd_adj_delegate_vft
VFT registered with the adjacency delegate.
Definition: sixrd.c:481
IPIP_TRANSPORT_IP4
@ IPIP_TRANSPORT_IP4
Definition: ipip.h:49
adj_delegate_add
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
ipip_tunnel_t::mode
ipip_mode_t mode
Definition: ipip.h:80
vlib_node_t::index
u32 index
Definition: node.h:269
IPIP_MODE_6RD
@ IPIP_MODE_6RD
Definition: ipip.h:57
fib_table_entry_path_remove
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:731
ip_adjacency_t_::lookup_next_index
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:337
ipip_mk_key
void ipip_mk_key(const ipip_tunnel_t *t, ipip_tunnel_key_t *key)
Definition: ipip.c:606
sixrd_adj_from_const_base
static const sixrd_adj_delegate_t * sixrd_adj_from_const_base(const adj_delegate_t *ad)
Definition: sixrd.c:78
adj_delegate_type_t
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's functi...
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
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(sixrd_device_class)
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
LOOKUP_UNICAST
@ LOOKUP_UNICAST
Definition: lookup_dpo.h:53
LOOKUP_INPUT_DST_ADDR
@ LOOKUP_INPUT_DST_ADDR
Definition: lookup_dpo.h:28
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
vnet_delete_hw_interface
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:1052
adj_delegate.h
sixrd_tunnel_stack
static void sixrd_tunnel_stack(adj_index_t ai, u32 fib_index)
Definition: sixrd.c:167
sixrd_get_addr_net
static_always_inline u32 sixrd_get_addr_net(const ipip_tunnel_t *t, u64 dal)
Definition: ipip.h:131
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
sixrd_adj_delegate_t_::adj_index
u32 adj_index
Definition: sixrd.c:48
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
adj_delegate_register_new_type
adj_delegate_type_t adj_delegate_register_new_type(const adj_delegate_vft_t *vft)
adj_delegate_register_new_type
Definition: adj_delegate.c:218
sixrd_fixup
static void sixrd_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Definition: sixrd.c:88
src
vl_api_address_t src
Definition: gre.api:54
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(sixrd_hw_interface_class)
sixrd_interface_admin_up_down
clib_error_t * sixrd_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: sixrd.c:245
IP_LOOKUP_NEXT_BCAST
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
Definition: adj.h:85
ip4_address_t
Definition: ip4_packet.h:50
LOOKUP_TABLE_FROM_CONFIG
@ LOOKUP_TABLE_FROM_CONFIG
Definition: lookup_dpo.h:41
ip_adjacency_t_
IP unicast adjacency.
Definition: adj.h:235
sixrd_adj_delegate_pool
static sixrd_adj_delegate_t * sixrd_adj_delegate_pool
Pool of delegate structs.
Definition: sixrd.c:57
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
sixrd_add_tunnel
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:271
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
FIB_NODE_BACK_WALK_CONTINUE
@ FIB_NODE_BACK_WALK_CONTINUE
Definition: fib_node.h:259
ipip_tunnel_db_remove
void ipip_tunnel_db_remove(ipip_tunnel_t *t, const ipip_tunnel_key_t *key)
Definition: ipip.c:583
ADJ_FLAG_NONE
@ ADJ_FLAG_NONE
Definition: adj.h:215
fib_entry_track.h
gm
#define gm
Definition: dlmalloc.c:1219
ipip_tunnel_t::sixrd
struct ipip_tunnel_t::@420 sixrd
plugin.h
data
u8 data[128]
Definition: ipsec_types.api:92
ip6ip_fixup
static void ip6ip_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Definition: sixrd.c:102
adj_nbr_midchain_stack
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
Definition: adj_midchain.c:429
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
sixrd_adj_from_base
static sixrd_adj_delegate_t * sixrd_adj_from_base(adj_delegate_t *ad)
Definition: sixrd.c:70
adj_delegate_get
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
index
u32 index
Definition: flow_types.api:221
sixrd_build_rewrite
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:114
vlib_get_node_by_name
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
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
ipip_tunnel_t::ip4_prefix
ip4_address_t ip4_prefix
Definition: ipip.h:95
sixrd_fib_node_type
static fib_node_type_t sixrd_fib_node_type
FIB node registered type.
Definition: sixrd.c:67
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
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
FIB_ROUTE_PATH_FLAG_NONE
@ FIB_ROUTE_PATH_FLAG_NONE
Definition: fib_types.h:332
fib_table_lock
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:1355
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
adj_delegate_vft_t_::adv_adj_deleted
adj_delegate_adj_deleted_t adv_adj_deleted
Definition: adj_delegate.h:96
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
lookup_dpo.h
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
ip6_sw_interface_enable_disable
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip6_forward.c:239
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
ip6_header_t
Definition: ip6_packet.h:294
ip4_prefix
manual_print typedef ip4_prefix
Definition: ip_types.api:130
ip6_fib.h
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
ipip_tunnel_t::hw_if_index
u32 hw_if_index
Definition: ipip.h:85
adj_nbr_midchain_unstack
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
Definition: adj_midchain.c:303
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_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
fib_node_init
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
u8
unsigned char u8
Definition: types.h:56
sixrd_adj_delegate_t_::sixrd_node
fib_node_t sixrd_node
Definition: sixrd.c:49
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
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
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
sixrd_init
static clib_error_t * sixrd_init(vlib_main_t *vm)
Definition: sixrd.c:496
fib_table_unlock
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:1336
sixrd_adj_delegate_format
static u8 * sixrd_adj_delegate_format(const adj_delegate_t *aed, u8 *s)
Definition: sixrd.c:429
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
ip_adjacency_t_::nbr
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
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
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
ipip.h
ipip_tunnel_t::user_instance
u32 user_instance
Definition: ipip.h:88
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
sixrd_adj_delegate_t_::sixrd_fib_entry_index
fib_node_index_t sixrd_fib_entry_index
Definition: sixrd.c:50
FIB_SOURCE_6RD
@ FIB_SOURCE_6RD
From 6RD.
Definition: fib_source.h:71
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
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
rewrite
rewrite
Definition: pnat.api:158
lookup_dpo_add_or_lock_w_fib_index
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:137
ipip_tunnel_t::ip6_fib_index
u32 ip6_fib_index
Definition: ipip.h:100
sixrd_fib_node_vft
const static fib_node_vft_t sixrd_fib_node_vft
VFT registered with the FIB node for the adj delegate.
Definition: sixrd.c:489
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
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_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
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
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
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
ipip_tunnel_t::ip6_prefix
ip6_address_t ip6_prefix
Definition: ipip.h:94
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105