FD.io VPP  v21.01.1
Vector Packet Processing
ip6_ra.c File Reference

IPv6 Router Advertisements. More...

+ Include dependency graph for ip6_ra.c:

Go to the source code of this file.

Data Structures

struct  ip6_radv_prefix_t
 
struct  ip6_ra_t_
 

Macros

#define DEF_MAX_RADV_INTERVAL   200
 
#define DEF_MIN_RADV_INTERVAL   .75 * DEF_MAX_RADV_INTERVAL
 
#define DEF_CURR_HOP_LIMIT   64
 
#define DEF_DEF_RTR_LIFETIME   3 * DEF_MAX_RADV_INTERVAL
 
#define MAX_DEF_RTR_LIFETIME   9000
 
#define MAX_INITIAL_RTR_ADVERT_INTERVAL   16 /* seconds */
 
#define MAX_INITIAL_RTR_ADVERTISEMENTS   3 /*transmissions */
 
#define MIN_DELAY_BETWEEN_RAS   3 /* seconds */
 
#define MAX_DELAY_BETWEEN_RAS   1800 /* seconds */
 
#define MAX_RA_DELAY_TIME   .5 /* seconds */
 
#define MIN_ADV_VALID_LIFETIME   7203 /* seconds */
 
#define DEF_ADV_VALID_LIFETIME   2592000
 
#define DEF_ADV_PREF_LIFETIME   604800
 
#define foreach_log_level
 

Typedefs

typedef struct ip6_ra_t_ ip6_ra_t
 

Enumerations

enum  log_level_t { foreach_log_level }
 
enum  icmp6_router_solicitation_or_advertisement_next_t { ICMP6_ROUTER_SOLICITATION_NEXT_DROP, ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW, ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX, ICMP6_ROUTER_SOLICITATION_N_NEXT }
 

Functions

typedef CLIB_PACKED (struct { ip6_header_t ip;icmp6_neighbor_discovery_header_t neighbor;icmp6_neighbor_discovery_ethernet_link_layer_address_option_t link_layer_option;})
 
static int ip6_ra_publish (ip6_ra_report_t *r)
 
void ip6_ra_report_register (ip6_ra_report_notify_t fn)
 
void ip6_ra_report_unregister (ip6_ra_report_notify_t fn)
 
static ip6_ra_tip6_ra_get_itf (u32 sw_if_index)
 
static void ip6_neighbor_syslog (vlib_main_t *vm, int priority, char *fmt,...)
 
static_always_inline uword icmp6_router_solicitation (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static_always_inline uword icmp6_router_advertisement (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static f64 random_f64_from_to (f64 from, f64 to)
 
static u8 get_mac_address (u32 sw_if_index, u8 *address)
 
static vlib_buffer_tcreate_buffer_for_rs (vlib_main_t *vm, ip6_ra_t *radv_info)
 
static void stop_sending_rs (vlib_main_t *vm, ip6_ra_t *ra)
 
static bool check_send_rs (vlib_main_t *vm, ip6_ra_t *radv_info, f64 current_time, f64 *due_time)
 
static uword send_rs_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f0)
 
void icmp6_send_router_solicitation (vlib_main_t *vm, u32 sw_if_index, u8 stop, const icmp6_send_router_solicitation_params_t *params)
 
static const ethernet_interface_tip6_ra_get_eth_itf (u32 sw_if_index)
 
static void ip6_ra_link_enable (u32 sw_if_index)
 called when IP6 is enabled on an interface create and initialize router advertisement parameters with default values for this intfc More...
 
static void ip6_ra_delegate_disable (index_t rai)
 
void ip6_ra_update_secondary_radv_info (ip6_address_t *address, u8 prefix_len, u32 primary_sw_if_index, u32 valid_time, u32 preferred_time)
 
static uword ip6_ra_process_timer_event (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static void ip6_ra_handle_report (ip6_ra_report_t *rap)
 
static uword ip6_ra_event_process (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static void ip6_ra_signal_report (ip6_ra_report_t *r)
 
int ip6_ra_config (vlib_main_t *vm, u32 sw_if_index, u8 suppress, u8 managed, u8 other, u8 ll_option, u8 send_unicast, u8 cease, u8 use_lifetime, u32 lifetime, u32 initial_count, u32 initial_interval, u32 max_interval, u32 min_interval, u8 is_no)
 
int ip6_ra_prefix (vlib_main_t *vm, u32 sw_if_index, ip6_address_t *prefix_addr, u8 prefix_len, u8 use_default, u32 val_lifetime, u32 pref_lifetime, u8 no_advertise, u8 off_link, u8 no_autoconfig, u8 no_onlink, u8 is_no)
 
clib_error_tip6_ra_cmd (vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
 
static u8format_ip6_ra (u8 *s, va_list *args)
 
static clib_error_tip6_ra_init (vlib_main_t *vm)
 

Variables

 icmp6_router_advertisement_packet_t
 
static ip6_link_delegate_id_t ip6_ra_delegate_id
 
static ip6_ra_tip6_ra_pool
 
static ip6_ra_report_notify_tip6_ra_listeners
 
static char * log_level_strings []
 
static int logmask = 1 << LOG_DEBUG
 
static vlib_node_registration_t ip6_icmp_router_solicitation_node
 (constructor) VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node) More...
 
static vlib_node_registration_t ip6_icmp_router_advertisement_node
 (constructor) VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node) More...
 
vlib_node_registration_t ip6_rs_process_node
 (constructor) VLIB_REGISTER_NODE (ip6_rs_process_node) More...
 
vlib_node_registration_t ip6_ra_process_node
 (constructor) VLIB_REGISTER_NODE (ip6_ra_process_node) More...
 
static vlib_cli_command_t ip6_nd_command
 (constructor) VLIB_CLI_COMMAND (ip6_nd_command) More...
 
static const ip6_link_delegate_vft_t ip6_ra_delegate_vft
 VFT for registering as a delegate to an IP6 link. More...
 

Detailed Description

IPv6 Router Advertisements.

The files contains the API and CLI code for managing IPv6 RAs

Definition in file ip6_ra.c.

Macro Definition Documentation

◆ DEF_ADV_PREF_LIFETIME

#define DEF_ADV_PREF_LIFETIME   604800

Definition at line 90 of file ip6_ra.c.

◆ DEF_ADV_VALID_LIFETIME

#define DEF_ADV_VALID_LIFETIME   2592000

Definition at line 89 of file ip6_ra.c.

◆ DEF_CURR_HOP_LIMIT

#define DEF_CURR_HOP_LIMIT   64

Definition at line 58 of file ip6_ra.c.

◆ DEF_DEF_RTR_LIFETIME

#define DEF_DEF_RTR_LIFETIME   3 * DEF_MAX_RADV_INTERVAL

Definition at line 59 of file ip6_ra.c.

◆ DEF_MAX_RADV_INTERVAL

#define DEF_MAX_RADV_INTERVAL   200

Definition at line 56 of file ip6_ra.c.

◆ DEF_MIN_RADV_INTERVAL

#define DEF_MIN_RADV_INTERVAL   .75 * DEF_MAX_RADV_INTERVAL

Definition at line 57 of file ip6_ra.c.

◆ foreach_log_level

#define foreach_log_level
Value:
_ (DEBUG, "DEBUG") \
_ (INFO, "INFORMATION") \
_ (NOTICE, "NOTICE") \
_ (WARNING, "WARNING") \
_ (ERR, "ERROR") \
_ (CRIT, "CRITICAL") \
_ (ALERT, "ALERT") \
_ (EMERG, "EMERGENCY")
#define INFO(...)
Definition: main.c:64
#define DEBUG
Definition: dlmalloc.c:33

Definition at line 208 of file ip6_ra.c.

◆ MAX_DEF_RTR_LIFETIME

#define MAX_DEF_RTR_LIFETIME   9000

Definition at line 60 of file ip6_ra.c.

◆ MAX_DELAY_BETWEEN_RAS

#define MAX_DELAY_BETWEEN_RAS   1800 /* seconds */

Definition at line 65 of file ip6_ra.c.

◆ MAX_INITIAL_RTR_ADVERT_INTERVAL

#define MAX_INITIAL_RTR_ADVERT_INTERVAL   16 /* seconds */

Definition at line 62 of file ip6_ra.c.

◆ MAX_INITIAL_RTR_ADVERTISEMENTS

#define MAX_INITIAL_RTR_ADVERTISEMENTS   3 /*transmissions */

Definition at line 63 of file ip6_ra.c.

◆ MAX_RA_DELAY_TIME

#define MAX_RA_DELAY_TIME   .5 /* seconds */

Definition at line 66 of file ip6_ra.c.

◆ MIN_ADV_VALID_LIFETIME

#define MIN_ADV_VALID_LIFETIME   7203 /* seconds */

Definition at line 88 of file ip6_ra.c.

◆ MIN_DELAY_BETWEEN_RAS

#define MIN_DELAY_BETWEEN_RAS   3 /* seconds */

Definition at line 64 of file ip6_ra.c.

Typedef Documentation

◆ ip6_ra_t

typedef struct ip6_ra_t_ ip6_ra_t

Enumeration Type Documentation

◆ icmp6_router_solicitation_or_advertisement_next_t

Enumerator
ICMP6_ROUTER_SOLICITATION_NEXT_DROP 
ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW 
ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX 
ICMP6_ROUTER_SOLICITATION_N_NEXT 

Definition at line 264 of file ip6_ra.c.

◆ log_level_t

Enumerator
foreach_log_level 

Definition at line 218 of file ip6_ra.c.

Function Documentation

◆ check_send_rs()

static bool check_send_rs ( vlib_main_t vm,
ip6_ra_t radv_info,
f64  current_time,
f64 due_time 
)
inlinestatic

Definition at line 1198 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CLIB_PACKED()

typedef CLIB_PACKED ( struct { ip6_header_t ip;icmp6_neighbor_discovery_header_t neighbor;icmp6_neighbor_discovery_ethernet_link_layer_address_option_t link_layer_option;}  )

Definition at line 35 of file ip6_ra.c.

◆ create_buffer_for_rs()

static vlib_buffer_t* create_buffer_for_rs ( vlib_main_t vm,
ip6_ra_t radv_info 
)
inlinestatic

Definition at line 1116 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_ip6_ra()

static u8* format_ip6_ra ( u8 s,
va_list *  args 
)
static

Definition at line 2107 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ get_mac_address()

static u8 get_mac_address ( u32  sw_if_index,
u8 address 
)
inlinestatic

Definition at line 1105 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icmp6_router_advertisement()

static_always_inline uword icmp6_router_advertisement ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 720 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ icmp6_router_solicitation()

static_always_inline uword icmp6_router_solicitation ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 273 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ 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 at line 1307 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_neighbor_syslog()

static void ip6_neighbor_syslog ( vlib_main_t vm,
int  priority,
char *  fmt,
  ... 
)
static

Definition at line 234 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_cmd()

clib_error_t* ip6_ra_cmd ( vlib_main_t vm,
unformat_input_t main_input,
vlib_cli_command_t cmd 
)

Definition at line 1907 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ ip6_ra_config()

int ip6_ra_config ( vlib_main_t vm,
u32  sw_if_index,
u8  suppress,
u8  managed,
u8  other,
u8  ll_option,
u8  send_unicast,
u8  cease,
u8  use_lifetime,
u32  lifetime,
u32  initial_count,
u32  initial_interval,
u32  max_interval,
u32  min_interval,
u8  is_no 
)

Definition at line 1687 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_delegate_disable()

static void ip6_ra_delegate_disable ( index_t  rai)
static

Definition at line 1407 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ ip6_ra_event_process()

static uword ip6_ra_event_process ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1618 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ ip6_ra_get_eth_itf()

static const ethernet_interface_t* ip6_ra_get_eth_itf ( u32  sw_if_index)
static

Definition at line 1339 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_get_itf()

static ip6_ra_t* ip6_ra_get_itf ( u32  sw_if_index)
inlinestatic

Definition at line 195 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_handle_report()

static void ip6_ra_handle_report ( ip6_ra_report_t rap)
static

Definition at line 1608 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_init()

static clib_error_t* ip6_ra_init ( vlib_main_t vm)
static

Definition at line 2308 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ ip6_ra_link_enable()

static void ip6_ra_link_enable ( u32  sw_if_index)
static

called when IP6 is enabled on an interface create and initialize router advertisement parameters with default values for this intfc

Definition at line 1357 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ ip6_ra_prefix()

int ip6_ra_prefix ( vlib_main_t vm,
u32  sw_if_index,
ip6_address_t *  prefix_addr,
u8  prefix_len,
u8  use_default,
u32  val_lifetime,
u32  pref_lifetime,
u8  no_advertise,
u8  off_link,
u8  no_autoconfig,
u8  no_onlink,
u8  is_no 
)

Definition at line 1781 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_process_timer_event()

static uword ip6_ra_process_timer_event ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1491 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_publish()

static int ip6_ra_publish ( ip6_ra_report_t r)
static

Definition at line 1678 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_report_register()

void ip6_ra_report_register ( ip6_ra_report_notify_t  fn)

Definition at line 167 of file ip6_ra.c.

+ Here is the caller graph for this function:

◆ ip6_ra_report_unregister()

void ip6_ra_report_unregister ( ip6_ra_report_notify_t  fn)

Definition at line 180 of file ip6_ra.c.

+ Here is the caller graph for this function:

◆ ip6_ra_signal_report()

static void ip6_ra_signal_report ( ip6_ra_report_t r)
static

Definition at line 1663 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_ra_update_secondary_radv_info()

void ip6_ra_update_secondary_radv_info ( ip6_address_t *  address,
u8  prefix_len,
u32  primary_sw_if_index,
u32  valid_time,
u32  preferred_time 
)

Definition at line 1430 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ random_f64_from_to()

static f64 random_f64_from_to ( f64  from,
f64  to 
)
inlinestatic

Definition at line 1092 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_rs_process()

static uword send_rs_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f0 
)
static

Definition at line 1260 of file ip6_ra.c.

+ Here is the call graph for this function:

◆ stop_sending_rs()

static void stop_sending_rs ( vlib_main_t vm,
ip6_ra_t ra 
)
inlinestatic

Definition at line 1184 of file ip6_ra.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ icmp6_router_advertisement_packet_t

icmp6_router_advertisement_packet_t

Definition at line 53 of file ip6_ra.c.

◆ ip6_icmp_router_advertisement_node

vlib_node_registration_t ip6_icmp_router_advertisement_node
static
Initial value:
=
{
.name = "icmp6-router-advertisement",
.vector_size = sizeof (u32),
.format_trace = format_icmp6_input_trace,
.n_next_nodes = 1,
.next_nodes = {
[0] = "ip6-drop",
},
}
unsigned int u32
Definition: types.h:88
static_always_inline uword icmp6_router_advertisement(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip6_ra.c:720
format_function_t format_icmp6_input_trace
Definition: icmp6.h:67

(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node)

Definition at line 1075 of file ip6_ra.c.

◆ ip6_icmp_router_solicitation_node

vlib_node_registration_t ip6_icmp_router_solicitation_node
static
Initial value:
=
{
.name = "icmp6-router-solicitation",
.vector_size = sizeof (u32),
.format_trace = format_icmp6_input_trace,
.next_nodes = {
[ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW] = "ip6-rewrite-mcast",
},
}
unsigned int u32
Definition: types.h:88
static_always_inline uword icmp6_router_solicitation(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip6_ra.c:273
format_function_t format_icmp6_input_trace
Definition: icmp6.h:67

(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node)

Definition at line 700 of file ip6_ra.c.

◆ ip6_nd_command

vlib_cli_command_t ip6_nd_command
static
Initial value:
=
{
.path = "ip6 nd",
.short_help = "ip6 nd <interface> ...",
.function = ip6_ra_cmd,
}
clib_error_t * ip6_ra_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
Definition: ip6_ra.c:1907

(constructor) VLIB_CLI_COMMAND (ip6_nd_command)

Definition at line 2290 of file ip6_ra.c.

◆ ip6_ra_delegate_id

ip6_link_delegate_id_t ip6_ra_delegate_id
static

Definition at line 157 of file ip6_ra.c.

◆ ip6_ra_delegate_vft

const ip6_link_delegate_vft_t ip6_ra_delegate_vft
static
Initial value:
= {
.ildv_disable = ip6_ra_delegate_disable,
.ildv_enable = ip6_ra_link_enable,
.ildv_format = format_ip6_ra,
}
static u8 * format_ip6_ra(u8 *s, va_list *args)
Definition: ip6_ra.c:2107
static void ip6_ra_delegate_disable(index_t rai)
Definition: ip6_ra.c:1407
static void ip6_ra_link_enable(u32 sw_if_index)
called when IP6 is enabled on an interface create and initialize router advertisement parameters with...
Definition: ip6_ra.c:1357

VFT for registering as a delegate to an IP6 link.

Definition at line 2301 of file ip6_ra.c.

◆ ip6_ra_listeners

ip6_ra_report_notify_t* ip6_ra_listeners
static

Definition at line 162 of file ip6_ra.c.

◆ ip6_ra_pool

ip6_ra_t* ip6_ra_pool
static

Definition at line 158 of file ip6_ra.c.

◆ ip6_ra_process_node

vlib_node_registration_t ip6_ra_process_node
Initial value:
=
{
.function = ip6_ra_event_process,
.name = "ip6-ra-process",
}
static uword ip6_ra_event_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip6_ra.c:1618

(constructor) VLIB_REGISTER_NODE (ip6_ra_process_node)

Definition at line 1654 of file ip6_ra.c.

◆ ip6_rs_process_node

vlib_node_registration_t ip6_rs_process_node
Initial value:
= {
.function = send_rs_process,
.name = "ip6-rs-process",
}
static uword send_rs_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f0)
Definition: ip6_ra.c:1260

(constructor) VLIB_REGISTER_NODE (ip6_rs_process_node)

Definition at line 1299 of file ip6_ra.c.

◆ log_level_strings

char* log_level_strings[]
static
Initial value:
= {
#define _(f,s)
}
#define foreach_log_level
Definition: ip6_ra.c:208

Definition at line 225 of file ip6_ra.c.

◆ logmask

int logmask = 1 << LOG_DEBUG
static

Definition at line 231 of file ip6_ra.c.