FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
rd_cp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/ip6-nd/ip6_ra.h>
17 
18 #include <vnet/ip/ip6.h>
19 #include <vnet/ip/ip6_link.h>
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/fib/fib_table.h>
22 #include <signal.h>
23 #include <math.h>
24 
25 typedef struct
26 {
29  ip6_address_t address;
32 
33 typedef struct
34 {
36  ip6_address_t router_address;
39 
40 typedef struct
41 {
45 
46 typedef struct
47 {
50 
54 
55  /* binary API client */
58 
59  /* logging */
61 
62  /* convenience */
66 } rd_cp_main_t;
67 
69 
70 enum
71 {
73 };
74 
75 #define vl_api_ip6_nd_address_autoconfig_t_print vl_noop_handler
76 
77 static void
79 {
80  rd_cp_main_t *rm = &rd_cp_main;
82 
83  if (start)
84  {
85  params.irt = 1;
86  params.mrt = 120;
87  }
88 
90  &params);
91 }
92 
93 static void interrupt_process (void);
94 
95 static int
97  const ip6_address_t * address, f64 due_time)
98 {
99  rd_cp_main_t *rm = &rd_cp_main;
100  slaac_address_t *slaac_address;
101  clib_error_t *rv = 0;
102 
103  pool_get_zero (rm->slaac_address_pool, slaac_address);
104 
105  slaac_address->sw_if_index = sw_if_index;
106  slaac_address->address_length = address_length;
107  slaac_address->address = *address;
108  slaac_address->due_time = due_time;
109 
110  rv =
112  address_length, 0);
113 
114  return rv != 0;
115 }
116 
117 static void
119  const ip6_address_t * next_hop_address, f64 due_time)
120 {
121  rd_cp_main_t *rm = &rd_cp_main;
122  default_route_t *default_route;
123 
124  pool_get_zero (rm->default_route_pool, default_route);
125 
126  default_route->sw_if_index = sw_if_index;
127  default_route->router_address = *next_hop_address;
128  default_route->due_time = due_time;
129 
130  {
132  default_route->
133  sw_if_index);
134  fib_prefix_t pfx = {
136  };
137  ip46_address_t nh = {
138  .ip6 = default_route->router_address,
139  };
140  fib_table_entry_update_one_path (fib_index, &pfx,
144  &nh,
145  default_route->sw_if_index,
146  0, 1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
147  }
148 }
149 
150 static int
152 {
153  rd_cp_main_t *rm = &rd_cp_main;
154  clib_error_t *rv = 0;
155 
156  rv = ip6_add_del_interface_address (vm, slaac_address->sw_if_index,
157  &slaac_address->address,
158  slaac_address->address_length, 1);
159 
160  pool_put (rm->slaac_address_pool, slaac_address);
161 
162  return rv != 0;
163 }
164 
165 static void
167 {
168  rd_cp_main_t *rm = &rd_cp_main;
169 
170  {
172  default_route->
173  sw_if_index);
174  fib_prefix_t pfx = {
176  };
177  ip46_address_t nh = {
178  .ip6 = default_route->router_address,
179  };
180  fib_table_entry_path_remove (fib_index, &pfx,
183  &nh,
184  default_route->sw_if_index,
186  }
187 
188  pool_put (rm->default_route_pool, default_route);
189 }
190 
191 static u32
193 {
194  rd_cp_main_t *rm = &rd_cp_main;
196  ethernet_interface_t *eth_if = 0;
197 
199  {
200  vlib_log_warn (rm->log_class, "Invalid sw_if_index");
201  return 1;
202  }
203 
207 
208  if (!eth_if)
209  {
210  vlib_log_warn (rm->log_class, "Failed to get hardware interface");
211  return 1;
212  }
213 
214  clib_memcpy_fast (mac, &eth_if->address, 6);
215 
216  return 0;
217 }
218 
219 static u8
220 ip6_prefixes_equal (ip6_address_t * prefix1, ip6_address_t * prefix2, u8 len)
221 {
222  if (len >= 64)
223  {
224  if (prefix1->as_u64[0] != prefix2->as_u64[0])
225  return 0;
226  if (len == 64)
227  return 1;
228  return prefix1->as_u64[1] >> (128 - len) ==
229  prefix2->as_u64[1] >> (128 - len);
230  }
231  return prefix1->as_u64[0] >> (64 - len) == prefix2->as_u64[0] >> (64 - len);
232 }
233 
234 #define PREFIX_FLAG_A (1 << 6)
235 #define PREFIX_FLAG_L (1 << 7)
236 
237 static void
239 {
240  rd_cp_main_t *rm = &rd_cp_main;
241  vlib_main_t *vm = rm->vlib_main;
242  interface_config_t *if_config;
243  default_route_t *default_route;
244  slaac_address_t *slaac_address;
246  u16 router_lifetime_in_sec;
247  u32 n_prefixes;
249  u8 mac[6];
250  f64 current_time;
251  u32 i;
252 
253  current_time = vlib_time_now (vm);
254 
255  sw_if_index = r->sw_if_index;
256 
258  return;
259  if_config = &rm->config_by_sw_if_index[sw_if_index];
260 
261  if (if_config->install_default_routes)
262  {
263  router_lifetime_in_sec = r->router_lifetime_in_sec;
264  u8 route_already_present = 0;
265  /* *INDENT-OFF* */
266  pool_foreach (default_route, rm->default_route_pool)
267  {
268  if (default_route->sw_if_index != sw_if_index)
269  ;
270  else if (0 != memcmp (&default_route->router_address,
271  &r->router_address, 16))
272  ;
273  else
274  {
275  route_already_present = 1;
276  goto default_route_pool_foreach_out;
277  }
278  }
279  /* *INDENT-ON* */
280  default_route_pool_foreach_out:
281 
282  if (!route_already_present)
283  {
284  if (router_lifetime_in_sec != 0)
285  add_default_route (vm, sw_if_index, &r->router_address,
286  current_time + router_lifetime_in_sec);
287  }
288  else
289  {
290  if (router_lifetime_in_sec != 0)
291  default_route->due_time = current_time + router_lifetime_in_sec;
292  else
293  remove_default_route (vm, default_route);
294  }
295  }
296 
298  {
299  vlib_log_warn (rm->log_class, "Error getting MAC address");
300  return;
301  }
302 
303  if (!if_config->enabled)
304  return;
305 
306  n_prefixes = vec_len (r->prefixes);
307  for (i = 0; i < n_prefixes; i++)
308  {
309  ip6_address_t *dst_address;
310  u8 prefix_length;
311  u32 valid_time;
313  f64 due_time;
314 
315  prefix = &r->prefixes[i];
316 
317  if (!(prefix->flags & PREFIX_FLAG_A))
318  continue;
319 
320  dst_address = &prefix->prefix.fp_addr.ip6;
321  prefix_length = prefix->prefix.fp_len;
322 
323  if (ip6_address_is_link_local_unicast (dst_address))
324  continue;
325 
326  valid_time = prefix->valid_time;
327  preferred_time = prefix->preferred_time;
328 
330  continue;
331 
332  if (prefix_length != 64)
333  continue;
334 
335  u8 address_already_present = 0;
336  /* *INDENT-OFF* */
337  pool_foreach (slaac_address, rm->slaac_address_pool)
338  {
339  if (slaac_address->sw_if_index != sw_if_index)
340  ;
341  else if (slaac_address->address_length != prefix_length)
342  ;
343  else if (!ip6_prefixes_equal (&slaac_address->address, dst_address,
344  prefix_length))
345  ;
346  else
347  {
348  address_already_present = 1;
349  goto slaac_address_pool_foreach_out;
350  }
351  }
352  /* *INDENT-ON* */
353  slaac_address_pool_foreach_out:
354 
355  if (address_already_present)
356  {
357  f64 remaining_life_time = slaac_address->due_time - current_time;
358  if (valid_time > 2 * 60 * 60 || valid_time > remaining_life_time)
359  slaac_address->due_time = current_time + valid_time;
360  else if (remaining_life_time > 2 * 60 * 60)
361  slaac_address->due_time = current_time + 2 * 60 * 60;
362  continue;
363  }
364 
365  if (valid_time == 0)
366  continue;
367 
368  due_time = current_time + valid_time;
369 
370  ip6_address_t addr;
371  addr.as_u64[0] = dst_address->as_u64[0];
372  /* Invert the "u" bit */
373  addr.as_u8[8] = mac[0] ^ (1 << 1);
374  addr.as_u8[9] = mac[1];
375  addr.as_u8[10] = mac[2];
376  addr.as_u8[11] = 0xFF;
377  addr.as_u8[12] = 0xFE;
378  addr.as_u8[13] = mac[3];
379  addr.as_u8[14] = mac[4];
380  addr.as_u8[15] = mac[5];
381 
382  add_slaac_address (vm, sw_if_index, prefix_length, &addr, due_time);
383  }
384 
386 
387  return;
388 }
389 
390 static uword
392 {
393  uword *event_data = 0;
394  rd_cp_main_t *rm = &rd_cp_main;
395  slaac_address_t *slaac_address;
396  default_route_t *default_route;
397  f64 sleep_time = 1e9;
398  f64 current_time;
399  f64 due_time;
400 
401  while (1)
402  {
404  vlib_process_get_events (vm, &event_data);
405 
406  vec_reset_length (event_data);
407 
408  current_time = vlib_time_now (vm);
409  do
410  {
411  due_time = current_time + 1e9;
412  u32 index;
413  /*
414  * we do not use pool_foreach() to iterate over pool elements here
415  * as we are removing elements inside the loop body
416  */
417  /* *INDENT-OFF* */
419  {
420  slaac_address = pool_elt_at_index(rm->slaac_address_pool, index);
421  if (slaac_address->due_time > current_time)
422  {
423  if (slaac_address->due_time < due_time)
424  due_time = slaac_address->due_time;
425  }
426  else
427  {
428  u32 sw_if_index = slaac_address->sw_if_index;
429  remove_slaac_address (vm, slaac_address);
430  /* make sure ip6 stays enabled */
432  }
433  }
435  {
436  default_route = pool_elt_at_index(rm->default_route_pool, index);
437  if (default_route->due_time > current_time)
438  {
439  if (default_route->due_time < due_time)
440  due_time = default_route->due_time;
441  }
442  else
443  remove_default_route (vm, default_route);
444  }
445  /* *INDENT-ON* */
446  current_time = vlib_time_now (vm);
447  }
448  while (due_time < current_time);
449 
450  sleep_time = due_time - current_time;
451  }
452 
453  return 0;
454 }
455 
456 /* *INDENT-OFF* */
458  .function = rd_cp_process,
459  .type = VLIB_NODE_TYPE_PROCESS,
460  .name = "rd-cp-process",
461 };
462 /* *INDENT-ON* */
463 
464 static void
466 {
467  rd_cp_main_t *rm = &rd_cp_main;
468  vlib_main_t *vm = rm->vlib_main;
469 
472 }
473 
474 int
476  u8 enable, u8 install_default_routes)
477 {
478  rd_cp_main_t *rm = &rd_cp_main;
479  vlib_main_t *vm = rm->vlib_main;
480  vnet_main_t *vnm = rm->vnet_main;
481  interface_config_t *if_config;
482  interface_config_t empty_config = { 0, 0 };
483  slaac_address_t *slaac_address;
484  default_route_t *default_route;
485 
486  if (!enable)
487  install_default_routes = 0;
488 
490  {
491  vlib_log_warn (rm->log_class, "Invalid sw_if_index");
492  return 1;
493  }
494 
495  if (!rm->enabled)
496  {
497  /* process kickoff */
499  rm->enabled = 1;
500  }
501 
503  empty_config);
504  if_config = &rm->config_by_sw_if_index[sw_if_index];
505 
506  if (!if_config->enabled && enable)
508 
509  if ((!if_config->enabled && enable)
510  || (!if_config->install_default_routes && install_default_routes))
512  else if (if_config->enabled && !enable)
514 
515  if (if_config->enabled && !enable)
516  {
517  /* *INDENT-OFF* */
518  pool_foreach (slaac_address, rm->slaac_address_pool)
519  {
520  remove_slaac_address (vm, slaac_address);
521  }
522  /* *INDENT-ON* */
523  }
524  if (if_config->install_default_routes && !install_default_routes)
525  {
526  /* *INDENT-OFF* */
527  pool_foreach (default_route, rm->default_route_pool)
528  {
529  remove_default_route (vm, default_route);
530  }
531  /* *INDENT-ON* */
532  }
533 
534  if_config->enabled = enable;
535  if_config->install_default_routes = install_default_routes;
536 
537  return 0;
538 }
539 
540 static clib_error_t *
542  unformat_input_t * input, vlib_cli_command_t * cmd)
543 {
544  rd_cp_main_t *rm = &rd_cp_main;
545  vnet_main_t *vnm = rm->vnet_main;
546  clib_error_t *error = 0;
547  u32 sw_if_index = ~0;
548  u8 enable = 1;
549  u8 default_route = 0;
550 
552  {
553  if (unformat
554  (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
555  ;
556  if (unformat (input, "default-route"))
557  default_route = 1;
558  if (unformat (input, "disable"))
559  enable = 0;
560  else
561  break;
562  }
563 
564  if (sw_if_index != ~0)
565  {
566  if (rd_cp_set_address_autoconfig (sw_if_index, enable, default_route) !=
567  0)
568  error = clib_error_return (0, "Invalid sw_if_index");
569  }
570  else
571  error = clib_error_return (0, "Missing sw_if_index");
572 
573  return error;
574 }
575 
576 /*?
577  * This command is used to enable ND address autoconfiguration
578  * on particular interface including setting up default routes.
579  *
580  * @cliexpar
581  * @parblock
582  * Example of how to enable ND address autoconfiguration:
583  * @cliexcmd{ip6 nd address autoconfig GigabitEthernet2/0/0}
584  * Example of how to enable ND address autoconfiguration
585  * with setting up default routes:
586  * @cliexcmd{ip6 nd address autoconfig GigabitEthernet2/0/0 default-route}
587  * Example of how to disable ND address autoconfiguration:
588  * @cliexcmd{ip6 nd address autoconfig GigabitEthernet2/0/0 disable}
589  * @endparblock
590 ?*/
591 /* *INDENT-OFF* */
593  .path = "ip6 nd address autoconfig",
594  .short_help = "ip6 nd address autoconfig <interface> [default-route|disable]",
595  .function = ip6_nd_address_autoconfig,
596 };
597 /* *INDENT-ON* */
598 
599 static clib_error_t *
601 {
602  rd_cp_main_t *rm = &rd_cp_main;
603 
604  rm->vlib_main = vm;
605  rm->vnet_main = vnet_get_main ();
606  rm->node_index = rd_cp_process_node.index;
607 
608  rm->log_class = vlib_log_register_class ("rd_cp", 0);
609 
611 
612  return (NULL);
613 }
614 
616 
617 /*
618  * fd.io coding-style-patch-verification: ON
619  *
620  * Local Variables:
621  * eval: (c-set-style "gnu")
622  * End:
623  */
vec_reset_length
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Definition: vec_bootstrap.h:194
slaac_address_t::address
ip6_address_t address
Definition: rd_cp.c:29
ip6_address_is_link_local_unicast
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
Definition: ip6_packet.h:253
slaac_address_t
Definition: rd_cp.c:25
rd_cp_main
rd_cp_main_t rd_cp_main
Definition: rd_cp.c:68
default_route_t::sw_if_index
u32 sw_if_index
Definition: rd_cp.c:35
mac
vl_api_mac_address_t mac
Definition: l2.api:559
rd_cp_main_t::config_by_sw_if_index
interface_config_t * config_by_sw_if_index
Definition: rd_cp.c:51
interface_config_t::install_default_routes
u8 install_default_routes
Definition: rd_cp.c:43
vnet_sw_interface_t::type
vnet_sw_interface_type_t type
Definition: interface.h:871
rd_cp_main_t::log_class
vlib_log_class_t log_class
Definition: rd_cp.c:60
vnet_sw_interface_t
Definition: interface.h:869
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:819
f
vlib_frame_t * f
Definition: interface_output.c:1098
ip6_nd_address_autoconfig_command
static vlib_cli_command_t ip6_nd_address_autoconfig_command
(constructor) VLIB_CLI_COMMAND (ip6_nd_address_autoconfig_command)
Definition: rd_cp.c:592
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
vlib_log_class_t
u32 vlib_log_class_t
Definition: vlib.h:52
slaac_address_t::sw_if_index
u32 sw_if_index
Definition: rd_cp.c:27
preferred_time
u32 preferred_time
Definition: dhcp.api:313
PREFIX_FLAG_A
#define PREFIX_FLAG_A
Definition: rd_cp.c:234
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:339
interface_config_t::enabled
u8 enabled
Definition: rd_cp.c:42
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
rd_cp_init
static clib_error_t * rd_cp_init(vlib_main_t *vm)
Definition: rd_cp.c:600
default_route_t
Definition: rd_cp.c:33
vlib_cli_command_t::path
char * path
Definition: cli.h:96
vlib_log_warn
#define vlib_log_warn(...)
Definition: log.h:134
fib_table.h
u16
unsigned short u16
Definition: types.h:57
rd_cp_main_t::enabled
u8 enabled
Definition: rd_cp.c:48
ip6_nd_address_autoconfig
static clib_error_t * ip6_nd_address_autoconfig(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: rd_cp.c:541
valid_time
u32 valid_time
Definition: dhcp.api:312
ip6_prefixes_equal
static u8 ip6_prefixes_equal(ip6_address_t *prefix1, ip6_address_t *prefix2, u8 len)
Definition: rd_cp.c:220
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
default_route_t::due_time
f64 due_time
Definition: rd_cp.c:37
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
rd_cp_main_t::my_client_index
u32 my_client_index
Definition: rd_cp.c:57
icmp6_send_router_solicitation
void icmp6_send_router_solicitation(vlib_main_t *vm, u32 sw_if_index, u8 stop, const icmp6_send_router_solicitation_params_t *params)
Definition: ip6_ra.c:1312
unformat_input_t
struct _unformat_input_t unformat_input_t
rd_cp_main_t::node_index
u32 node_index
Definition: rd_cp.c:65
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
vlib_frame_t
Definition: node.h:372
rd_cp_main_t::default_route_pool
default_route_t * default_route_pool
Definition: rd_cp.c:53
vlib_process_signal_event
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
Definition: node_funcs.h:1019
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
rd_cp_process_node
vlib_node_registration_t rd_cp_process_node
(constructor) VLIB_REGISTER_NODE (rd_cp_process_node)
Definition: rd_cp.c:457
ethernet.h
error
Definition: cJSON.c:88
ra_report_prefix_info_t
Definition: ip6_ra.h:53
RD_CP_EVENT_INTERRUPT
@ RD_CP_EVENT_INTERRUPT
Definition: rd_cp.c:72
vnet_sw_interface_is_api_valid
static uword vnet_sw_interface_is_api_valid(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:285
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
vlib_process_get_events
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
Definition: node_funcs.h:583
rd_cp_main_t::api_connected
u8 api_connected
Definition: rd_cp.c:56
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
ip6_add_del_interface_address
clib_error_t * ip6_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 is_del)
Definition: ip6_forward.c:298
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
math.h
len
u8 len
Definition: ip_types.api:103
icmp6_send_router_solicitation_params_t::irt
u32 irt
Definition: ip6_ra.h:40
router_solicitation_start_stop
static void router_solicitation_start_stop(u32 sw_if_index, u8 start)
Definition: rd_cp.c:78
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:736
ip6_ra.h
slaac_address_t::due_time
f64 due_time
Definition: rd_cp.c:30
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
ip6_ra_report_handler
static void ip6_ra_report_handler(const ip6_ra_report_t *r)
Definition: rd_cp.c:238
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
icmp6_send_router_solicitation_params_t
Definition: ip6_ra.h:38
uword
u64 uword
Definition: types.h:112
ethernet_interface
Definition: ethernet.h:146
f64
double f64
Definition: types.h:142
rd_cp_main_t
Definition: rd_cp.c:46
address
manual_print typedef address
Definition: ip_types.api:96
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
rd_cp_main_t::slaac_address_pool
slaac_address_t * slaac_address_pool
Definition: rd_cp.c:52
add_slaac_address
static int add_slaac_address(vlib_main_t *vm, u32 sw_if_index, u8 address_length, const ip6_address_t *address, f64 due_time)
Definition: rd_cp.c:96
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
ethernet_get_interface
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
Definition: interface.c:982
rd_cp_set_address_autoconfig
int rd_cp_set_address_autoconfig(u32 sw_if_index, u8 enable, u8 install_default_routes)
Definition: rd_cp.c:475
interrupt_process
static void interrupt_process(void)
Definition: rd_cp.c:465
rd_cp_process
static uword rd_cp_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: rd_cp.c:391
vnet_main_t
Definition: vnet.h:76
index
u32 index
Definition: flow_types.api:221
pool_foreach_index
#define pool_foreach_index(i, v)
Definition: pool.h:572
ethernet_main
ethernet_main_t ethernet_main
Definition: init.c:45
ip6_ra_report_t
Definition: ip6_ra.h:61
remove_default_route
static void remove_default_route(vlib_main_t *vm, default_route_t *default_route)
Definition: rd_cp.c:166
unformat_vnet_sw_interface
unformat_function_t unformat_vnet_sw_interface
Definition: interface_funcs.h:462
vlib_process_wait_for_event_or_clock
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
Definition: node_funcs.h:755
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
fib_table_get_index_for_sw_if_index
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
Definition: fib_table.c:1003
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
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
interface_config_t
Definition: rd_cp.c:40
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
rd_cp_main_t::vlib_main
vlib_main_t * vlib_main
Definition: rd_cp.c:63
si
vnet_sw_interface_t * si
Definition: interface_output.c:418
slaac_address_t::address_length
u8 address_length
Definition: rd_cp.c:28
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
FIB_SOURCE_API
@ FIB_SOURCE_API
From the control plane API.
Definition: fib_source.h:75
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
rd_cp_main_t::vnet_main
vnet_main_t * vnet_main
Definition: rd_cp.c:64
add_default_route
static void add_default_route(vlib_main_t *vm, u32 sw_if_index, const ip6_address_t *next_hop_address, f64 due_time)
Definition: rd_cp.c:118
vlib_main_t
Definition: main.h:102
pool_get_zero
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
Definition: pool.h:258
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
rt
vnet_interface_output_runtime_t * rt
Definition: interface_output.c:419
icmp6_send_router_solicitation_params_t::mrt
u32 mrt
Definition: ip6_ra.h:41
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
get_interface_mac_address
static u32 get_interface_mac_address(u32 sw_if_index, u8 mac[])
Definition: rd_cp.c:192
i
int i
Definition: flowhash_template.h:376
vnet_sw_interface_t::hw_if_index
u32 hw_if_index
Definition: interface.h:887
ip6_ra_report_register
void ip6_ra_report_register(ip6_ra_report_notify_t fn)
Definition: ip6_ra.c:167
rv
int __clib_unused rv
Definition: application.c:491
remove_slaac_address
static int remove_slaac_address(vlib_main_t *vm, slaac_address_t *slaac_address)
Definition: rd_cp.c:151
default_route_t::router_address
ip6_address_t router_address
Definition: rd_cp.c:36
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:327
VNET_SW_INTERFACE_TYPE_HARDWARE
@ VNET_SW_INTERFACE_TYPE_HARDWARE
Definition: interface.h:764
vlib_node_runtime_t
Definition: node.h:454
vnet_get_sup_sw_interface
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:81
vlib_cli_command_t
Definition: cli.h:92
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
ip6.h
ethernet_interface::address
ethernet_interface_address_t address
Definition: ethernet.h:173
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
rd_cp_main_t::events_on
u8 events_on
Definition: rd_cp.c:49
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
prefix
vl_api_prefix_t prefix
Definition: ip.api:175
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169