From bb71bc02fd9c6b0aac66fafaef0ca9737e501dfb Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 5 Jul 2022 15:22:12 +0200 Subject: bgpd: fix VRF leaking with 'network import-check' (2/4) "if not XX else" statements are confusing. Replace two "if not XX else" statements by "if XX else" to prepare next commits. The patch is only cosmetic. Signed-off-by: Louis Scalbert --- bgpd/bgp_nht.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'bgpd') diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 05fd0dc4e..dbf1fd2ea 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -918,24 +918,22 @@ void bgp_nexthop_update(struct vrf *vrf, struct prefix *match, tree = &bgp->nexthop_cache_table[afi]; bnc_nhc = bnc_find(tree, match, nhr->srte_color, 0); - if (!bnc_nhc) { - if (BGP_DEBUG(nht, NHT)) - zlog_debug("parse nexthop update %pFX(%u)(%s): bnc info not found for nexthop cache", - &nhr->prefix, nhr->srte_color, - bgp->name_pretty); - } else + if (bnc_nhc) bgp_process_nexthop_update(bnc_nhc, nhr, false); + else if (BGP_DEBUG(nht, NHT)) + zlog_debug("parse nexthop update %pFX(%u)(%s): bnc info not found for nexthop cache", + &nhr->prefix, nhr->srte_color, + bgp->name_pretty); tree = &bgp->import_check_table[afi]; bnc_import = bnc_find(tree, match, nhr->srte_color, 0); - if (!bnc_import) { - if (BGP_DEBUG(nht, NHT)) - zlog_debug("parse nexthop update %pFX(%u)(%s): bnc info not found for import check", - &nhr->prefix, nhr->srte_color, - bgp->name_pretty); - } else + if (bnc_import) bgp_process_nexthop_update(bnc_import, nhr, true); + else if (BGP_DEBUG(nht, NHT)) + zlog_debug("parse nexthop update %pFX(%u)(%s): bnc info not found for import check", + &nhr->prefix, nhr->srte_color, + bgp->name_pretty); /* * HACK: if any BGP route is dependant on an SR-policy that doesn't -- cgit v1.2.3