From 2711d7af9f4fb85c8ad44728fc7e297ebf38a0f7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 28 Jan 2022 11:17:53 -0500 Subject: [PATCH 1/2] pimd: Only remove bsr NHT if we actually have tracked something I'm now seeing in my log file: 2022/01/28 11:20:05 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0 2022/01/28 11:20:05 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0 2022/01/28 11:20:06 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0 When I run pimd. Looking at the code there are 3 places where pim_bsm.c removes the NHT BSR tracking. In 2 of them the code ensures that the address is already setup in 1 place it is not. Fix. Signed-off-by: Donald Sharp (cherry picked from commit 2d51f27f028412ad089ff1f910f6489eb917631d) --- pimd/pim_bsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 238c19d2cc..cd50cdd678 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -171,7 +171,8 @@ static int pim_on_bs_timer(struct thread *t) zlog_debug("%s: Bootstrap Timer expired for scope: %d", __func__, scope->sz_id); - pim_nht_bsr_del(scope->pim, scope->current_bsr); + if (scope->current_bsr.s_addr) + pim_nht_bsr_del(scope->pim, scope->current_bsr); /* Reset scope zone data */ scope->accept_nofwd_bsm = false; From 03a097c32d8485db3a5aaa68095d55d6529adaee Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 4 Feb 2022 08:49:39 -0500 Subject: [PATCH 2/2] pim: Use INADDR_ANY for current_bsr checking is valid yet In all places that pim_nht_bsr_del is called, the code needs to not unregister if the current_bsr is INADDR_ANY. Signed-off-by: Donald Sharp (cherry picked from commit 5f010b1205a9b4977d08329bd3e100fb5f41c0ff) --- pimd/pim_bsm.c | 9 +++------ pimd/pim_nht.c | 8 ++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index cd50cdd678..c8b6d4e404 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -171,8 +171,7 @@ static int pim_on_bs_timer(struct thread *t) zlog_debug("%s: Bootstrap Timer expired for scope: %d", __func__, scope->sz_id); - if (scope->current_bsr.s_addr) - pim_nht_bsr_del(scope->pim, scope->current_bsr); + pim_nht_bsr_del(scope->pim, scope->current_bsr); /* Reset scope zone data */ scope->accept_nofwd_bsm = false; @@ -558,8 +557,7 @@ static void pim_bsm_update(struct pim_instance *pim, struct in_addr bsr, uint32_t bsr_prio) { if (bsr.s_addr != pim->global_scope.current_bsr.s_addr) { - if (pim->global_scope.current_bsr.s_addr) - pim_nht_bsr_del(pim, pim->global_scope.current_bsr); + pim_nht_bsr_del(pim, pim->global_scope.current_bsr); pim_nht_bsr_add(pim, bsr); pim->global_scope.current_bsr = bsr; @@ -583,8 +581,7 @@ void pim_bsm_clear(struct pim_instance *pim) struct rp_info *rp_info; bool upstream_updated = false; - if (pim->global_scope.current_bsr.s_addr) - pim_nht_bsr_del(pim, pim->global_scope.current_bsr); + pim_nht_bsr_del(pim, pim->global_scope.current_bsr); /* Reset scope zone data */ pim->global_scope.accept_nofwd_bsm = false; diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index cd6f4c45fa..94a624e2c4 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -259,6 +259,14 @@ void pim_nht_bsr_del(struct pim_instance *pim, struct in_addr addr) struct pim_nexthop_cache *pnc = NULL; struct pim_nexthop_cache lookup; + /* + * Nothing to do here if the address to unregister + * is 0.0.0.0 as that the BSR has not been registered + * for tracking yet. + */ + if (addr.s_addr == INADDR_ANY) + return; + lookup.rpf.rpf_addr.family = AF_INET; lookup.rpf.rpf_addr.prefixlen = IPV4_MAX_BITLEN; lookup.rpf.rpf_addr.u.prefix4 = addr;