summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2017-06-14 13:56:55 +0200
committerJohn Lo <loj@cisco.com>2017-06-30 11:29:44 +0000
commitf45bc738aaf6bdaff59840932daf546187e38c33 (patch)
treed6faf7ace5328594d3a0590c52874c01e39d3db8 /src/vnet
parentc02bd03ddf5eec9e9c79811360685f13e4ba8ee1 (diff)
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> (cherry picked from commit 9f5a2b6310ce5c8e59c32ca6f27d8a187b0e4346)
Diffstat (limited to 'src/vnet')
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c17
-rw-r--r--src/vnet/ip/ip6_forward.c21
-rw-r--r--src/vnet/ip/ip6_neighbor.c2
-rw-r--r--src/vnet/ip/ip6_neighbor.h3
4 files changed, 42 insertions, 1 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index f4ecc395ab1..8263e01c188 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -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);
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 17a4a6dd34b..4b574b9adbd 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -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);
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 073b67fed61..ba7ea143318 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -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)
{
diff --git a/src/vnet/ip/ip6_neighbor.h b/src/vnet/ip/ip6_neighbor.h
index ef1e84c22a5..0e302ed4a49 100644
--- a/src/vnet/ip/ip6_neighbor.h
+++ b/src/vnet/ip/ip6_neighbor.h
@@ -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 */
/*