]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix prefix VRF leaking with 'network import-check' (3/5)
authorLouis Scalbert <louis.scalbert@6wind.com>
Tue, 5 Jul 2022 13:22:12 +0000 (15:22 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 16 Dec 2022 13:52:47 +0000 (14:52 +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 cf8ff524e963b2d79ef7988c55819fc4d3e8f507..78482aeb40335dc376408e27b39359a1da27f24a 100644 (file)
@@ -858,24 +858,22 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
        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