]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix VRF leaking with 'network import-check' (2/4)
authorLouis Scalbert <louis.scalbert@6wind.com>
Tue, 5 Jul 2022 13:22:12 +0000 (15:22 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Mon, 29 Jan 2024 09:30:37 +0000 (10:30 +0100)
"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 <louis.scalbert@6wind.com>
bgpd/bgp_nht.c

index 05fd0dc4e73626d30e1c8624d24ea075c70ba353..dbf1fd2ea51a3005b1c5718997b6a68b326545c7 100644 (file)
@@ -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