]> git.puffer.fish Git - mirror/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>
Sun, 8 Dec 2024 19:46:59 +0000 (21:46 +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>
bgpd/bgp_mplsvpn.c

index ca7f73dde993121421add72ac38cc3e4c633d33f..69248d961d506813d1c5c212374a4812c242ca90 100644 (file)
@@ -2167,6 +2167,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);
 
@@ -2227,7 +2229,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 &&