From 1cbbc94e5528981c981453a5d5f5d2143c142831 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 3 Mar 2025 14:40:42 +0100 Subject: [PATCH] bgpd: fix export, and selects l3vpn aggregated prefix 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 --- bgpd/bgp_mplsvpn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index ac2f90e867..8057b3d56a 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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