summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c5
-rw-r--r--src/vnet/interface_funcs.h8
-rw-r--r--src/vnet/ip/icmp6.h4
-rw-r--r--src/vnet/ip/ip.api2
-rw-r--r--src/vnet/ip/ip6.h3
-rw-r--r--src/vnet/ip/ip6_forward.c6
-rw-r--r--src/vnet/ip/ip6_neighbor.c42
-rw-r--r--src/vnet/ip/ip_api.c3
-rw-r--r--src/vnet/rewrite.c7
-rw-r--r--src/vpp/api/custom_dump.c3
-rw-r--r--src/vpp/api/test_client.c2
11 files changed, 31 insertions, 54 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index c00104defb5..7514820721e 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -7671,7 +7671,6 @@ api_sw_interface_ip6_set_link_local_address (vat_main_t * vam)
f64 timeout;
u32 sw_if_index;
u8 sw_if_index_set = 0;
- u32 address_length = 0;
u8 v6_address_set = 0;
ip6_address_t v6address;
@@ -7682,8 +7681,7 @@ api_sw_interface_ip6_set_link_local_address (vat_main_t * vam)
sw_if_index_set = 1;
else if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;
- else if (unformat (i, "%U/%d",
- unformat_ip6_address, &v6address, &address_length))
+ else if (unformat (i, "%U", unformat_ip6_address, &v6address))
v6_address_set = 1;
else
break;
@@ -7706,7 +7704,6 @@ api_sw_interface_ip6_set_link_local_address (vat_main_t * vam)
mp->sw_if_index = ntohl (sw_if_index);
clib_memcpy (mp->address, &v6address, sizeof (v6address));
- mp->address_length = address_length;
/* send it... */
S;
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index b84d151c86d..ab808dfa545 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -53,6 +53,14 @@ vnet_get_sw_interface (vnet_main_t * vnm, u32 sw_if_index)
}
always_inline vnet_sw_interface_t *
+vnet_get_sw_interface_safe (vnet_main_t * vnm, u32 sw_if_index)
+{
+ if (!pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
+ return pool_elt_at_index (vnm->interface_main.sw_interfaces, sw_if_index);
+ return (NULL);
+}
+
+always_inline vnet_sw_interface_t *
vnet_get_hw_sw_interface (vnet_main_t * vnm, u32 hw_if_index)
{
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
diff --git a/src/vnet/ip/icmp6.h b/src/vnet/ip/icmp6.h
index a426512ea2f..9a3487b1c5c 100644
--- a/src/vnet/ip/icmp6.h
+++ b/src/vnet/ip/icmp6.h
@@ -37,10 +37,6 @@
"neighbor discovery unsupported interface") \
_ (ROUTER_SOLICITATION_RADV_NOT_CONFIG, \
"neighbor discovery not configured") \
- _ (ROUTER_SOLICITATION_DEST_UNKNOWN, \
- "router solicitations for unknown destination") \
- _ (ROUTER_SOLICITATION_SOURCE_UNKNOWN, \
- "router solicitations for unknown source") \
_ (ROUTER_ADVERTISEMENT_SOURCE_NOT_LINK_LOCAL, \
"router advertisement source not link local") \
_ (ROUTER_ADVERTISEMENTS_TX, "router advertisements sent") \
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index c811e465ea9..f2444805e68 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -311,7 +311,6 @@ define sw_interface_ip6_enable_disable_reply
@param context - sender context, to match reply w/ request
@param sw_if_index - interface to set link local on
@param address[] - the new link local address
- @param address_length - link local address length
*/
define sw_interface_ip6_set_link_local_address
{
@@ -319,7 +318,6 @@ define sw_interface_ip6_set_link_local_address
u32 context;
u32 sw_if_index;
u8 address[16];
- u8 address_length;
};
/** \brief IPv6 set link local address on interface response
diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h
index 586b7c1b7f2..f493db017ec 100644
--- a/src/vnet/ip/ip6.h
+++ b/src/vnet/ip/ip6.h
@@ -376,8 +376,7 @@ int ip6_interface_enabled (vlib_main_t * vm, u32 sw_if_index);
clib_error_t *set_ip6_link_local_address (vlib_main_t * vm,
u32 sw_if_index,
- ip6_address_t * address,
- u8 address_length);
+ ip6_address_t * address);
void vnet_register_ip6_neighbor_resolution_event (vnet_main_t * vnm,
void *address_arg,
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index b5c795523ca..866a44e65b3 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -404,8 +404,10 @@ ip6_sw_interface_enable_disable (u32 sw_if_index, u32 is_enable)
}
else
{
- ASSERT (im->ip_enabled_by_sw_if_index[sw_if_index] > 0);
- if (0 != --im->ip_enabled_by_sw_if_index[sw_if_index])
+ /* The ref count is 0 when an address is removed from an interface that has
+ * no address - this is not a ciritical error */
+ if (0 == im->ip_enabled_by_sw_if_index[sw_if_index] ||
+ 0 != --im->ip_enabled_by_sw_if_index[sw_if_index])
return;
}
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 5a1c9e86b4f..46c0e3168c0 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -155,8 +155,6 @@ typedef struct
/* Link local address to use (defaults to underlying physical for logical interfaces */
ip6_address_t link_local_address;
- u8 link_local_prefix_len;
-
} ip6_radv_t;
typedef struct
@@ -1316,7 +1314,8 @@ icmp6_router_solicitation (vlib_main_t * vm,
/* for solicited adverts - need to rate limit */
if (is_solicitation)
{
- if ((now - radv_info->last_radv_time) <
+ if (0 != radv_info->last_radv_time &&
+ (now - radv_info->last_radv_time) <
MIN_DELAY_BETWEEN_RAS)
is_dropped = 1;
else
@@ -1523,16 +1522,6 @@ icmp6_router_solicitation (vlib_main_t * vm,
error0 = ICMP6_ERROR_DST_LOOKUP_MISS;
else
{
- ip_adjacency_t *adj0 =
- ip_get_adjacency (&im->lookup_main,
- adj_index0);
- error0 =
- ((adj0->rewrite_header.sw_if_index !=
- sw_if_index0
- || adj0->lookup_next_index !=
- IP_LOOKUP_NEXT_REWRITE) ?
- ICMP6_ERROR_ROUTER_SOLICITATION_DEST_UNKNOWN
- : error0);
next0 =
is_dropped ? next0 :
ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW;
@@ -2022,7 +2011,6 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
/* fill in default link-local address (this may be overridden) */
ip6_link_local_address_from_ethernet_address
(&a->link_local_address, eth_if0->address);
- a->link_local_prefix_len = 64;
mhash_init (&a->address_to_prefix_index, sizeof (uword),
sizeof (ip6_address_t));
@@ -3266,9 +3254,7 @@ disable_ip6_interface (vlib_main_t * vm, u32 sw_if_index)
/* essentially "disables" ipv6 on this interface */
error = ip6_add_del_interface_address (vm, sw_if_index,
&radv_info->
- link_local_address,
- radv_info->
- link_local_prefix_len,
+ link_local_address, 128,
1 /* is_del */ );
ip6_neighbor_sw_interface_add_del (vnm, sw_if_index,
@@ -3372,7 +3358,6 @@ enable_ip6_interface (vlib_main_t * vm, u32 sw_if_index)
else
{
radv_info->link_local_address = link_local_address;
- radv_info->link_local_prefix_len = 64;
}
}
}
@@ -3585,8 +3570,7 @@ VLIB_CLI_COMMAND (ip6_nd_command, static) =
clib_error_t *
set_ip6_link_local_address (vlib_main_t * vm,
- u32 sw_if_index,
- ip6_address_t * address, u8 address_length)
+ u32 sw_if_index, ip6_address_t * address)
{
clib_error_t *error = 0;
ip6_neighbor_main_t *nm = &ip6_neighbor_main;
@@ -3615,22 +3599,18 @@ set_ip6_link_local_address (vlib_main_t * vm,
/* delete the old one */
error = ip6_add_del_interface_address (vm, sw_if_index,
&radv_info->link_local_address,
- radv_info->link_local_prefix_len
- /* address width */ ,
- 1 /* is_del */ );
+ 128, 1 /* is_del */ );
if (!error)
{
/* add the new one */
error = ip6_add_del_interface_address (vm, sw_if_index,
- address, address_length
- /* address width */ ,
+ address, 128,
0 /* is_del */ );
if (!error)
{
radv_info->link_local_address = *address;
- radv_info->link_local_prefix_len = address_length;
}
}
}
@@ -3652,21 +3632,19 @@ set_ip6_link_local_address_cmd (vlib_main_t * vm,
clib_error_t *error = 0;
u32 sw_if_index;
ip6_address_t ip6_addr;
- u32 addr_len = 0;
if (unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
{
/* get the rest of the command */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (input, "%U/%d",
- unformat_ip6_address, &ip6_addr, &addr_len))
+ if (unformat (input, "%U", unformat_ip6_address, &ip6_addr))
break;
else
return (unformat_parse_error (input));
}
}
- error = set_ip6_link_local_address (vm, sw_if_index, &ip6_addr, addr_len);
+ error = set_ip6_link_local_address (vm, sw_if_index, &ip6_addr);
return error;
}
@@ -3678,13 +3656,13 @@ set_ip6_link_local_address_cmd (vlib_main_t * vm,
*
* @cliexpar
* Example of how to assign an IPv6 Link-local address to an interface:
- * @cliexcmd{set ip6 link-local address GigabitEthernet2/0/0 FE80::AB8/64}
+ * @cliexcmd{set ip6 link-local address GigabitEthernet2/0/0 FE80::AB8}
?*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (set_ip6_link_local_address_command, static) =
{
.path = "set ip6 link-local address",
- .short_help = "set ip6 link-local address <interface> <ip6-address>/<width>",
+ .short_help = "set ip6 link-local address <interface> <ip6-address>",
.function = set_ip6_link_local_address_cmd,
};
/* *INDENT-ON* */
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index cd9b7397d29..aafde464445 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -1132,8 +1132,7 @@ static void
error = set_ip6_link_local_address (vm,
ntohl (mp->sw_if_index),
- (ip6_address_t *) mp->address,
- mp->address_length);
+ (ip6_address_t *) mp->address);
if (error)
{
clib_error_report (error);
diff --git a/src/vnet/rewrite.c b/src/vnet/rewrite.c
index 53d548bc8ae..8925ad6174a 100644
--- a/src/vnet/rewrite.c
+++ b/src/vnet/rewrite.c
@@ -79,8 +79,11 @@ format_vnet_rewrite (u8 * s, va_list * args)
if (rw->sw_if_index != ~0)
{
vnet_sw_interface_t *si;
- si = vnet_get_sw_interface (vnm, rw->sw_if_index);
- s = format (s, "%U: ", format_vnet_sw_interface_name, vnm, si);
+ si = vnet_get_sw_interface_safe (vnm, rw->sw_if_index);
+ if (NULL != si)
+ s = format (s, "%U: ", format_vnet_sw_interface_name, vnm, si);
+ else
+ s = format (s, "DELETED");
}
else
s = format (s, "%v: ", next->name);
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index c2cd3d15a20..f14a031dae6 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -911,8 +911,7 @@ static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
- s = format (s, "%U/%d ", format_ip6_address, mp->address,
- mp->address_length);
+ s = format (s, "%U ", format_ip6_address, mp->address);
FINISH;
}
diff --git a/src/vpp/api/test_client.c b/src/vpp/api/test_client.c
index 5c568950499..ceafc35788d 100644
--- a/src/vpp/api/test_client.c
+++ b/src/vpp/api/test_client.c
@@ -1196,8 +1196,6 @@ ip6_set_link_local_address (test_main_t * tm)
clib_memcpy (mp->address, &tmp[0], 8);
clib_memcpy (&mp->address[8], &tmp[1], 8);
- mp->address_length = 64;
-
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS);
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);