IP4/IP6 FIB: fix crash during interface delete

after deleting a sub interface with IP4/IP6 address vpp crash

Change-Id: Ie768ca845b9e2394f61e2a8e9722a80a788746e7
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
This commit is contained in:
Pavel Kotucek
2017-06-14 13:56:55 +02:00
parent 39f92401c6
commit 9f5a2b6310
4 changed files with 42 additions and 1 deletions

View File

@ -1136,6 +1136,23 @@ ip4_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
vec_validate (im->mfib_index_by_sw_if_index, sw_if_index);
if (!is_add)
{
ip4_main_t *im4 = &ip4_main;
ip_lookup_main_t *lm4 = &im4->lookup_main;
ip_interface_address_t *ia = 0;
ip4_address_t *address;
vlib_main_t *vm = vlib_get_main ();
/* *INDENT-OFF* */
foreach_ip_interface_address (lm4, ia, sw_if_index, 1 /* honor unnumbered */,
({
address = ip_interface_address_get_address (lm4, ia);
ip4_add_del_interface_address(vm, sw_if_index, address, ia->address_length, 1);
}));
/* *INDENT-ON* */
}
vnet_feature_enable_disable ("ip4-unicast", "ip4-drop", sw_if_index,
is_add, 0, 0);

View File

@ -39,6 +39,7 @@
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/ip/ip6_neighbor.h>
#include <vnet/ethernet/ethernet.h> /* for ethernet_header_t */
#include <vnet/srp/srp.h> /* for srp_hw_interface_class */
#include <vppinfra/cache.h>
@ -688,6 +689,26 @@ ip6_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
vec_validate (im->mfib_index_by_sw_if_index, sw_if_index);
if (!is_add)
{
/* Ensure that IPv6 is disabled */
ip6_main_t *im6 = &ip6_main;
ip_lookup_main_t *lm6 = &im6->lookup_main;
ip_interface_address_t *ia = 0;
ip6_address_t *address;
vlib_main_t *vm = vlib_get_main ();
ip6_neighbor_sw_interface_add_del (vnm, sw_if_index, 0 /* is_add */ );
/* *INDENT-OFF* */
foreach_ip_interface_address (lm6, ia, sw_if_index, 1 /* honor unnumbered */,
({
address = ip_interface_address_get_address (lm6, ia);
ip6_add_del_interface_address(vm, sw_if_index, address, ia->address_length, 1);
}));
/* *INDENT-ON* */
ip6_mfib_interface_enable_disable (sw_if_index, 0);
}
vnet_feature_enable_disable ("ip6-unicast", "ip6-drop", sw_if_index,
is_add, 0, 0);

View File

@ -2081,7 +2081,7 @@ ip6_neighbor_add_mld_grp (ip6_radv_t * a,
* @brief create and initialize router advertisement parameters with default
* values for this intfc
*/
static u32
u32
ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
u32 sw_if_index, u32 is_add)
{

View File

@ -87,6 +87,9 @@ extern int vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm,
extern int ip6_neighbor_proxy_add_del (u32 sw_if_index,
ip6_address_t * addr, u8 is_add);
u32 ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index,
u32 is_add);
#endif /* included_ip6_neighbor_h */
/*