summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2021-05-29 09:00:45 -0400
committerFlorin Coras <florin.coras@gmail.com>2021-05-31 16:23:38 +0000
commit64d20e76b9108c9158b2b538cd2312d740f48103 (patch)
treeed41eb1a3eee970434bd224779c25c3b4fc7b0d6
parent71ee375f7266b450d6a3d4e28247f4b12016abfb (diff)
interface: fix vnet_sw_interface_update_unnumbered
Unless a software interface is actually unnumbered, do not set ip[46]_main.lookup_main.if_address_pool_index_by_sw_if_index [sw_if_index] to ~0 Fixes this scenario: loop create set int state loop0 up create sub-interface loop0 1 set interface ip addr loop0.1 192.168.1.1/24 delete sub-interface loop0.1 set int ip addr loop0 192.168.1.1/24 Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I46141d862fa57d70b93d7bb0c105403708165264
-rw-r--r--src/vnet/interface.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 278cd6e50c3..44ea52a870d 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -1639,13 +1639,20 @@ vnet_sw_interface_update_unnumbered (u32 unnumbered_sw_if_index,
}
else
{
- si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED);
- si->unnumbered_sw_if_index = (u32) ~ 0;
+ /*
+ * Unless the interface is actually unnumbered, don't
+ * smash e.g. if_address_pool_index_by_sw_if_index
+ */
+ if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED)
+ {
+ si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED);
+ si->unnumbered_sw_if_index = (u32) ~0;
- ip4_main.lookup_main.if_address_pool_index_by_sw_if_index
- [unnumbered_sw_if_index] = ~0;
- ip6_main.lookup_main.if_address_pool_index_by_sw_if_index
- [unnumbered_sw_if_index] = ~0;
+ ip4_main.lookup_main
+ .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
+ ip6_main.lookup_main
+ .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
+ }
}
if (was_unnum != (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED))