]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Import allowed routes with self AS if desired
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 8 Dec 2024 19:46:59 +0000 (21:46 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 10 Dec 2024 19:35:20 +0000 (21:35 +0200)
Previously we couldn't install VPN routes with self AS in the path because
we never checked if we have allowas-in enabled, or not.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 222ba5f39048953f384ab3aa207af753dfa92e67)

bgpd/bgp_mplsvpn.c

index df45cf237e5110f355bad8ced634ac90e0f8fff8..5eca5e3e9b7e9dd2947ba81be428cb00ada626fe 100644 (file)
@@ -2158,6 +2158,8 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
        struct interface *ifp = NULL;
        char rd_buf[RD_ADDRSTRLEN];
        struct aspath *new_aspath;
+       int32_t aspath_loop_count = 0;
+       struct peer *peer = path_vpn->peer;
 
        int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
 
@@ -2218,7 +2220,9 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */
        bn = bgp_afi_node_get(to_bgp->rib[afi][safi], afi, safi, p, NULL);
 
        /* Check if leaked route has our asn. If so, don't import it. */
-       if (aspath_loop_check(path_vpn->attr->aspath, to_bgp->as)) {
+       if (CHECK_FLAG(peer->af_flags[afi][SAFI_MPLS_VPN], PEER_FLAG_ALLOWAS_IN))
+               aspath_loop_count = peer->allowas_in[afi][SAFI_MPLS_VPN];
+       if (aspath_loop_check(path_vpn->attr->aspath, to_bgp->as) > aspath_loop_count) {
                for (bpi = bgp_dest_get_bgp_path_info(bn); bpi;
                     bpi = bpi->next) {
                        if (bpi->extra && bpi->extra->vrfleak &&