summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-01-30 14:44:38 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-01-30 14:47:49 +0100
commitee1986f1b5ae6b94b446b12e1b77cc30d8f5f46d (patch)
treec955d5db57aae6b8d6ff819c4dcb24890f0c5cbd /bgpd
parentMerge pull request #15238 from louis-6wind/bgp-leak-network (diff)
downloadfrr-ee1986f1b5ae6b94b446b12e1b77cc30d8f5f46d.tar.xz
frr-ee1986f1b5ae6b94b446b12e1b77cc30d8f5f46d.zip
bgpd: Reinstall aggregated routes if using route-maps and it was changed
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 <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c6
-rw-r--r--bgpd/bgp_route.h1
-rw-r--r--bgpd/bgp_routemap.c1
3 files changed, 6 insertions, 2 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 8bcbd3dd8..518e84825 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -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)
@@ -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);
}
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 0599e8dce..935dafccf 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -419,6 +419,7 @@ struct bgp_aggregate {
struct {
char *name;
struct route_map *map;
+ bool changed;
} rmap;
/* Suppress-count. */
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 382e8ae40..36e04c5e6 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -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;
}