]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix export, and selects l3vpn aggregated prefix
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 3 Mar 2025 13:40:42 +0000 (14:40 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 3 Mar 2025 17:51:18 +0000 (18:51 +0100)
On a L3VPN setup, an aggretated prefix can not be exported and selected.
The below example illustrates the 172.31.0.0/24 aggregated prefix, which
is valid as a VRF prefix, but invalid as a VPN prefix:

> r1# show bgp ipv4 vpn 172.31.0.0/24
> BGP routing table entry for 444:1:172.31.0.0/24, version 0
> not allocated
> Paths: (1 available, no best path)
>   Not advertised to any peer
>   Local, (aggregated by 65500 192.0.2.1)
>     0.0.0.0 from 0.0.0.0 (192.0.2.1) vrf vrf1(4) announce-nh-self
>       Origin incomplete, metric 0, weight 32768, invalid, sourced,
local, atomic-aggregate
>       Extended Community: RT:52:100
>       Originator: 192.0.2.1
>       Remote label: 101
>       Last update: Mon Mar  3 14:35:04 2025
> r1# show bgp vrf vrf1 ipv4 172.31.0.0/24
> BGP routing table entry for 172.31.0.0/24, version 1
> Paths: (1 available, best #1, vrf vrf1)
>   Not advertised to any peer
>   Local, (aggregated by 65500 192.0.2.1)
>     0.0.0.0 from 0.0.0.0 (192.0.2.1)
>       Origin incomplete, metric 0, weight 32768, valid, aggregated,
local, atomic-aggregate, best (First path received)
>       Last update: Mon Mar  3 14:35:03 2025
> r1#

Actually, the aggregated prefix nexthop is considered, and 0.0.0.0 is
an invalid nexthop.

> r1# show bgp vrf vrf1 nexthop
> Current BGP nexthop cache:
>  0.0.0.0 invalid, #paths 1
>   Is not Registered
>   Last update: Thu Feb 13 18:33:43 2025

Fix this by considering the L3VPN prefix selected, if the VRF prefix
is selected too.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_mplsvpn.c

index ac2f90e8679dc02b849c66bc920fa38d0f735151..8057b3d56a15616077cf7a5589265d74a7f637a6 100644 (file)
@@ -1097,6 +1097,9 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn,
                         * then mark the nexthop as valid.
                         */
                        nh_valid = true;
+       } else if (bpi_ultimate->type == ZEBRA_ROUTE_BGP &&
+                  bpi_ultimate->sub_type == BGP_ROUTE_AGGREGATE) {
+               nh_valid = true;
        } else
                /*
                 * TBD do we need to do anything about the