Skip to content

Commit

Permalink
bgpd: Reinstall aggregated routes if using route-maps and it was changed
Browse files Browse the repository at this point in the history
Without this change when we change the route-map, we never reinstall the route
if the route-map has changed.

We checked only some attributes like aspath, communities, large-communities,
extended-communities, but ignoring the rest of attributes.

With this change, let's check if the route-map has changed.

bgp_route_map_process_update() is triggered on route-map change, and we set
`changed` to true, which treats aggregated route as not the same as it was before.

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Jan 30, 2024
1 parent cd869eb commit ee1986f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -7369,8 +7369,9 @@ static void bgp_aggregate_install(
* If the aggregate information has not changed
* no need to re-install it again.
*/
if (pi && bgp_aggregate_info_same(pi, origin, aspath, community,
ecommunity, lcommunity)) {
if (pi && (!aggregate->rmap.changed &&
bgp_aggregate_info_same(pi, origin, aspath, community,
ecommunity, lcommunity))) {
bgp_dest_unlock_node(dest);

if (aspath)
Expand Down Expand Up @@ -8377,6 +8378,7 @@ static int bgp_aggregate_set(struct vty *vty, const char *prefix_str, afi_t afi,
aggregate->rmap.name =
XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
aggregate->rmap.map = route_map_lookup_by_name(rmap);
aggregate->rmap.changed = true;
route_map_counter_increment(aggregate->rmap.map);
}

Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ struct bgp_aggregate {
struct {
char *name;
struct route_map *map;
bool changed;
} rmap;

/* Suppress-count. */
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4596,6 +4596,7 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name,
route_map_counter_increment(map);

aggregate->rmap.map = map;
aggregate->rmap.changed = true;

matched = true;
}
Expand Down

0 comments on commit ee1986f

Please sign in to comment.