existing_adj->arp.next_hop.ip6.as_u64[1] == a->as_u64[1])
{
u32 * ai;
- u32 * adjs = vec_dup(n->adjacencies);
+ u32 * adjs = 0;
+
+ if (n)
+ adjs = vec_dup(n->adjacencies);
+ else
+ clib_warning ("ip6 neighbor n not set");
+
/* Update all adj assigned to this arp entry */
vec_foreach(ai, adjs)
{
/* check for MTU or prefix options or .. */
u8 * opt_hdr = (u8 *)(h0 + 1);
- while( options_len0 > 0)
+ while( options_len0 > 0 &&
+ opt_hdr < p0->data + p0->current_data)
{
icmp6_neighbor_discovery_option_header_t *o0 = ( icmp6_neighbor_discovery_option_header_t *)opt_hdr;
int opt_len = o0->n_data_u64s << 3;
a->min_delay_between_radv = MIN_DELAY_BETWEEN_RAS;
a->max_delay_between_radv = MAX_DELAY_BETWEEN_RAS;
a->max_rtr_default_lifetime = MAX_DEF_RTR_LIFETIME;
- a->seed = random_default_seed();
+ a->seed = (u32) (clib_cpu_time_now() & 0xFFFFFFFF);
/* for generating random interface ids */
- a->randomizer = 0x1119194911191949;
- a->randomizer = random_u64 ((u32 *)&a->randomizer);
+ a->randomizer = random_u64 (&a->seed);
a->initial_adverts_count = MAX_INITIAL_RTR_ADVERTISEMENTS ;
a->initial_adverts_sent = a->initial_adverts_count-1;
/* API support functions */
int
ip6_neighbor_ra_config(vlib_main_t * vm, u32 sw_if_index,
- u8 surpress, u8 managed, u8 other,
+ 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,
if "flag" is set and is_no is true then restore default value else set value corresponding to "flag"
if "flag" is clear don't change corresponding value
*/
- radv_info->send_radv = (surpress != 0) ? ( (is_no != 0) ? 1 : 0 ) : radv_info->send_radv;
+ radv_info->send_radv = (suppress != 0) ? ( (is_no != 0) ? 1 : 0 ) : radv_info->send_radv;
radv_info->adv_managed_flag = ( managed != 0) ? ( (is_no) ? 0 : 1) : radv_info->adv_managed_flag;
radv_info->adv_other_flag = (other != 0) ? ( (is_no) ? 0: 1) : radv_info->adv_other_flag;
radv_info->adv_link_layer_address = ( ll_option != 0) ? ( (is_no) ? 1 : 0) : radv_info->adv_link_layer_address;
ip6_neighbor_main_t * nm = &ip6_neighbor_main;
clib_error_t * error = 0;
u8 is_no = 0;
- u8 surpress = 0, managed = 0, other = 0;
- u8 surpress_ll_option = 0, send_unicast = 0, cease= 0;
+ u8 suppress = 0, managed = 0, other = 0;
+ u8 suppress_ll_option = 0, send_unicast = 0, cease= 0;
u8 use_lifetime = 0;
u32 sw_if_index, ra_lifetime = 0, ra_initial_count = 0, ra_initial_interval = 0;
u32 ra_max_interval = 0 , ra_min_interval = 0;
other = 1;
break;
}
- else if (unformat (line_input, "ra-surpress"))
+ else if (unformat (line_input, "ra-suppress") ||
+ unformat (line_input, "ra-surpress"))
{
- surpress = 1;
+ suppress = 1;
break;
}
- else if (unformat (line_input, "ra-surpress-link-layer"))
+ else if (unformat (line_input, "ra-suppress-link-layer") ||
+ unformat (line_input, "ra-surpress-link-layer"))
{
- surpress_ll_option = 1;
+ suppress_ll_option = 1;
break;
}
else if (unformat (line_input, "ra-send-unicast"))
if(add_radv_info)
{
ip6_neighbor_ra_config(vm, sw_if_index,
- surpress, managed, other,
- surpress_ll_option, send_unicast, cease,
+ suppress, managed, other,
+ suppress_ll_option, send_unicast, cease,
use_lifetime, ra_lifetime,
ra_initial_count, ra_initial_interval,
ra_max_interval, ra_min_interval,
return error;
}
+static void
+ip6_print_addrs(vlib_main_t * vm,
+ u32 *addrs)
+{
+ ip_lookup_main_t * lm = &ip6_main.lookup_main;
+ u32 i;
+
+ for (i = 0; i < vec_len (addrs); i++)
+ {
+ ip_interface_address_t * a = pool_elt_at_index(lm->if_address_pool, addrs[i]);
+ ip6_address_t * address = ip_interface_address_get_address (lm, a);
+
+ vlib_cli_output (vm, "\t\t%U/%d",
+ format_ip6_address, address,
+ a->address_length);
+ }
+}
+
static clib_error_t *
show_ip6_interface_cmd (vlib_main_t * vm,
unformat_input_t * input,
vnet_get_sw_interface (vnm, sw_if_index),
(vnet_sw_interface_is_admin_up (vnm, sw_if_index) ? "up" : "down"));
- u32 ai;
- u32 *global_scope = 0,i;
+ u32 ai;
+ u32 *link_scope = 0, *global_scope = 0;
+ u32 *local_scope = 0, *unknown_scope = 0;
ip_interface_address_t * a;
vec_validate_init_empty (lm->if_address_pool_index_by_sw_if_index, sw_if_index, ~0);
a = pool_elt_at_index(lm->if_address_pool, ai);
ip6_address_t * address = ip_interface_address_get_address (lm, a);
- if( ip6_address_is_link_local_unicast (address))
- vlib_cli_output (vm, "\tIPv6 is enabled, link-local address is %U\n", format_ip6_address,
- address);
-
- if((address->as_u8[0] & 0xe0) == 0x20)
+ if (ip6_address_is_link_local_unicast (address))
+ vec_add1 (link_scope, ai);
+ else if(ip6_address_is_global_unicast (address))
vec_add1 (global_scope, ai);
+ else if(ip6_address_is_local_unicast (address))
+ vec_add1 (local_scope, ai);
+ else
+ vec_add1 (unknown_scope, ai);
ai = a->next_this_sw_interface;
}
- vlib_cli_output (vm, "\tGlobal unicast address(es):\n");
- for (i = 0; i < vec_len (global_scope); i++)
- {
- a = pool_elt_at_index(lm->if_address_pool, global_scope[i]);
- ip6_address_t * address = ip_interface_address_get_address (lm, a);
- ip6_address_t mask, subnet;
+ if (vec_len (link_scope))
+ {
+ vlib_cli_output (vm, "\tLink-local address(es):\n");
+ ip6_print_addrs (vm, link_scope);
+ vec_free (link_scope);
+ }
+
+ if (vec_len (local_scope))
+ {
+ vlib_cli_output (vm, "\tLocal unicast address(es):\n");
+ ip6_print_addrs (vm, local_scope);
+ vec_free (local_scope);
+ }
- subnet = *address;
- ip6_address_mask_from_width(&mask, a->address_length);
- ip6_address_mask(&subnet, &mask);
+ if (vec_len (global_scope))
+ {
+ vlib_cli_output (vm, "\tGlobal unicast address(es):\n");
+ ip6_print_addrs (vm, global_scope);
+ vec_free (global_scope);
+ }
+
+ if (vec_len (unknown_scope))
+ {
+ vlib_cli_output (vm, "\tOther-scope address(es):\n");
+ ip6_print_addrs (vm, unknown_scope);
+ vec_free (unknown_scope);
+ }
- vlib_cli_output (vm, "\t\t%U, subnet is %U/%d",
- format_ip6_address, address,
- format_ip6_address,&subnet,
- a->address_length);
- }
- vec_free (global_scope);
vlib_cli_output (vm, "\tJoined group address(es):\n");
ip6_mldp_group_t *m;
pool_foreach (m, radv_info->mldp_group_pool, ({
}
else
{
- error = clib_error_return (0, "Ipv6 not enabled on interface",
+ error = clib_error_return (0, "IPv6 not enabled on interface",
format_unformat_error, input);
}
VLIB_CLI_COMMAND (show_ip6_interface_command, static) = {
.path = "show ip6 interface",
.function = show_ip6_interface_cmd,
- .short_help = "Show ip6 interface <iface name>",
+ .short_help = "show ip6 interface <iface name>",
};
clib_error_t *