diff options
author | Neale Ranns <nranns@cisco.com> | 2020-11-25 09:14:22 +0000 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2020-11-26 10:16:58 +0000 |
commit | 87866037c44be7dd7467981757d3206835901996 (patch) | |
tree | 0bf439e7459b7d6c1808395ecf73f344e8ec5541 | |
parent | cfe949dbf001d8fa18301ecc11c644f8cb39c5d7 (diff) |
fib: Only track cover if activated
Type: fix
also cleanup any tracking at delete
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: Id1037920c88c63e2029384af931064c00ed497aa
-rw-r--r-- | src/vnet/fib/fib_entry_src_adj.c | 16 | ||||
-rw-r--r-- | test/test_ip4.py | 14 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/vnet/fib/fib_entry_src_adj.c b/src/vnet/fib/fib_entry_src_adj.c index ec80a867d49..fb46f2e4708 100644 --- a/src/vnet/fib/fib_entry_src_adj.c +++ b/src/vnet/fib/fib_entry_src_adj.c @@ -125,6 +125,12 @@ static void fib_entry_src_adj_remove (fib_entry_src_t *src) { src->fes_pl = FIB_NODE_INDEX_INVALID; + + if (FIB_NODE_INDEX_INVALID != src->u.adj.fesa_cover) + { + fib_entry_cover_untrack(fib_entry_get(src->u.adj.fesa_cover), + src->u.adj.fesa_sibling); + } } /* @@ -311,6 +317,7 @@ fib_entry_src_adj_deactivate (fib_entry_src_t *src, fib_attached_export_covered_removed(cover, fib_entry_get_index(fib_entry)); src->u.adj.fesa_cover = FIB_NODE_INDEX_INVALID; + src->u.adj.fesa_sibling = FIB_NODE_INDEX_INVALID; } static u8* @@ -341,10 +348,17 @@ fib_entry_src_adj_cover_change (fib_entry_src_t *src, const fib_entry_t *fib_entry) { fib_entry_src_cover_res_t res = { - .install = !0, + .install = 0, .bw_reason = FIB_NODE_BW_REASON_FLAG_NONE, }; + /* + * not interested in a change to the cover if the cover + * is not being tracked, i.e. the source is not active + */ + if (FIB_NODE_INDEX_INVALID == src->u.adj.fesa_cover) + return res; + fib_entry_src_adj_deactivate(src, fib_entry); res.install = fib_entry_src_adj_activate(src, fib_entry); diff --git a/test/test_ip4.py b/test/test_ip4.py index 2592f584656..35be24ca34d 100644 --- a/test/test_ip4.py +++ b/test/test_ip4.py @@ -2243,15 +2243,19 @@ class TestIPCover(VppTestCase): register=False).add_vpp_config() # add/remove/add a longer mask cover - r = VppIpRoute(self, "127.0.0.0", 8, - [VppRoutePath("127.0.0.1", - lo.sw_if_index)]).add_vpp_config() - r.remove_vpp_config() - r.add_vpp_config() + r8 = VppIpRoute(self, "127.0.0.0", 8, + [VppRoutePath("127.0.0.1", + lo.sw_if_index)]).add_vpp_config() + r8.remove_vpp_config() + r8.add_vpp_config() + r8.remove_vpp_config() # remove the default route r.remove_vpp_config() + # remove the interface prefix + a.remove_vpp_config() + class TestIP4Replace(VppTestCase): """ IPv4 Interface Address Replace """ |