summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-01-09 01:00:45 -0800
committerOle Trøan <otroan@employees.org>2017-01-10 14:09:55 +0000
commit75152289284aaf1116d62c6cdef5a3b0c793fa15 (patch)
tree7ced5e87b0db3eabdc5062d1b589d21962116521 /src/vnet
parent553a41190963099631a73fb0a77b07b871d65e70 (diff)
IPv6 NS RS tests and fixes
includes Fix for VPP-584 with API change to remove prefix length from LL programming Change-Id: If860751c35e60255fb977f73bc33e8c2649e728e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet')
-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
8 files changed, 29 insertions, 46 deletions
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);