]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Cleanup bnch_nexthop_cache_reset to fit cleaner
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 17 Oct 2018 15:31:34 +0000 (11:31 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 17 Oct 2018 15:31:34 +0000 (11:31 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_nexthop.c

index be219d23740d565f083665c23be344d00f2217b4..453afea24c39a18c1264f86a481a5b0b3e772352 100644 (file)
@@ -84,18 +84,18 @@ static void bgp_nexthop_cache_reset(struct bgp_table *table)
 
        for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
                bnc = bgp_nexthop_get_node_info(rn);
-               if (bnc != NULL) {
-                       while (!LIST_EMPTY(&(bnc->paths))) {
-                               struct bgp_path_info *path =
-                                       LIST_FIRST(&(bnc->paths));
+               if (!bnc)
+                       continue;
 
-                               path_nh_map(path, bnc, false);
-                       }
+               while (!LIST_EMPTY(&(bnc->paths))) {
+                       struct bgp_path_info *path = LIST_FIRST(&(bnc->paths));
 
-                       bnc_free(bnc);
-                       bgp_nexthop_set_node_info(rn, NULL);
-                       bgp_unlock_node(rn);
+                       path_nh_map(path, bnc, false);
                }
+
+               bnc_free(bnc);
+               bgp_nexthop_set_node_info(rn, NULL);
+               bgp_unlock_node(rn);
        }
 }