diff options
| author | Enke Chen <enchen@paloaltonetworks.com> | 2025-01-14 10:29:22 -0800 | 
|---|---|---|
| committer | Enke Chen <enchen@paloaltonetworks.com> | 2025-01-14 10:29:22 -0800 | 
| commit | c467af10b2a97e8452b5b3bce245dbcae4ff21fa (patch) | |
| tree | da62dfbbd6b63fd6efaef8589e500b68c302e90f /bgpd | |
| parent | 4212bac7dec9b9e3ce692ad56ce46a211749754c (diff) | |
bgpd: move bgp_aggregate_increment() after bgp_path_info_add()
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>
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 14 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 2 | 
3 files changed, 9 insertions, 9 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 1d10831ca1..46e529f03d 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2a7ccd7ee7..c02638a5bd 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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); diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 61d154f1b4..241cbcb359 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -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;  | 
