summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2021-05-29 09:00:45 -0400
committerDave Wallace <dwallacelf@gmail.com>2021-06-01 14:46:57 +0000
commitcd01b3a73596a6c4e741b9cd8349b81f0ccc8ee0 (patch)
treedf31fda7220bece6381f96cd41770088993f0a3e /src
parentce48c877443dcaa13790620823a3a8c20a6e27b8 (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 (cherry picked from commit 64d20e76b9108c9158b2b538cd2312d740f48103)
Diffstat (limited to 'src')
-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 5c0ccaa900b..e81589bd0e8 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -1640,13 +1640,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))