]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: move bgp_aggregate_increment() after bgp_path_info_add()
authorEnke Chen <enchen@paloaltonetworks.com>
Tue, 14 Jan 2025 18:29:22 +0000 (10:29 -0800)
committerEnke Chen <enchen@paloaltonetworks.com>
Tue, 14 Jan 2025 18:29:22 +0000 (10:29 -0800)
Route aggregation should be checked after a route is added, and
not before. This is for code flow and consistency.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
bgpd/bgp_mplsvpn.c
bgpd/bgp_route.c
bgpd/rfapi/rfapi.c

index 1d10831ca134a9e1b6d9ea7072c8205acdac4962..46e529f03dfc0efc9bef0be1753d2f24c713050c 100644 (file)
@@ -1312,8 +1312,8 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
        else
                bgp_path_info_unset_flag(bn, new, BGP_PATH_VALID);
 
-       bgp_aggregate_increment(to_bgp, p, new, afi, safi);
        bgp_path_info_add(bn, new);
+       bgp_aggregate_increment(to_bgp, p, new, afi, safi);
 
        bgp_process(to_bgp, bn, new, afi, safi);
 
index 2a7ccd7ee796d9b9714e726c8a20112458bae6d9..c02638a5bdbb76d9c4d1c922b0b954210c12b4c0 100644 (file)
@@ -5592,12 +5592,12 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
        /* Addpath ID */
        new->addpath_rx_id = addpath_id;
 
-       /* Increment prefix */
-       bgp_aggregate_increment(bgp, p, new, afi, safi);
-
        /* Register new BGP information. */
        bgp_path_info_add(dest, new);
 
+       /* Increment prefix */
+       bgp_aggregate_increment(bgp, p, new, afi, safi);
+
        /* route_node_get lock */
        bgp_dest_unlock_node(dest);
 
@@ -7186,12 +7186,12 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
 
        bgp_nexthop_reachability_check(afi, safi, new, p, dest, bgp, bgp);
 
-       /* Aggregate address increment. */
-       bgp_aggregate_increment(bgp, p, new, afi, safi);
-
        /* Register new BGP information. */
        bgp_path_info_add(dest, new);
 
+       /* Aggregate address increment. */
+       bgp_aggregate_increment(bgp, p, new, afi, safi);
+
        /* route_node_get lock */
        bgp_dest_unlock_node(dest);
 
@@ -9336,8 +9336,8 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
                                bgp->peer_self, new_attr, bn);
                SET_FLAG(new->flags, BGP_PATH_VALID);
 
-               bgp_aggregate_increment(bgp, p, new, afi, SAFI_UNICAST);
                bgp_path_info_add(bn, new);
+               bgp_aggregate_increment(bgp, p, new, afi, SAFI_UNICAST);
                bgp_dest_unlock_node(bn);
                SET_FLAG(bn->flags, BGP_NODE_FIB_INSTALLED);
                bgp_process(bgp, bn, new, afi, SAFI_UNICAST);
index 61d154f1b436c217a1290dcb88392200d2297799..241cbcb35992f49472b589e8f0dd715b7b729710 100644 (file)
@@ -1029,8 +1029,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
                rfapiPrintBi(NULL, new);
        }
 
-       bgp_aggregate_increment(bgp, p, new, afi, safi);
        bgp_path_info_add(bn, new);
+       bgp_aggregate_increment(bgp, p, new, afi, safi);
 
        if (safi == SAFI_MPLS_VPN) {
                struct bgp_dest *pdest = NULL;