]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Remove private ASNs after we modify the as-path with the route-map
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 14 Sep 2023 18:17:07 +0000 (21:17 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 14 Sep 2023 18:17:07 +0000 (21:17 +0300)
If we modify as-path with route-map and prepend with private ASNs, then we
advertise a new as-path without stripping private ASNs. Let's fix this, and
remove private ASNs despite if they were sent by the origin or prepended locally.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c

index 227a68ee55915612c3311a69d57140ea85f55f43..df3397af999ec562aa438f179128e1db073a657a 100644 (file)
@@ -2378,9 +2378,6 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
            bgp_otc_egress(peer, attr))
                return false;
 
-       bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
-       bgp_peer_as_override(bgp, afi, safi, peer, attr);
-
        if (filter->advmap.update_type == UPDATE_TYPE_WITHDRAW &&
            filter->advmap.aname &&
            route_map_lookup_by_name(filter->advmap.aname)) {
@@ -2453,6 +2450,9 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
                }
        }
 
+       bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
+       bgp_peer_as_override(bgp, afi, safi, peer, attr);
+
        /* RFC 8212 to prevent route leaks.
         * This specification intends to improve this situation by requiring the
         * explicit configuration of both BGP Import and Export Policies for any