Commit fd76afea18 for frr
commit fd76afea1879c6cfeea4383037b76b7c5984a69a
Author: Carmine Scarpitta <cscarpit@cisco.com>
Date: Sun Jul 5 09:00:08 2026 +0200
bgpd: Make EVPN Type-5 extcomm helper encap-aware
The EVPN Type-5 extended-community helper always added a VXLAN tunnel
encapsulation community. That is correct for VXLAN Type-5 routes.
VPN-backed Type-5 routes use VPN forwarding information, such as an MPLS
label or an SRv6 Service SID, so they must not be advertised as VXLAN
encapsulated routes.
Pass the tunnel type to the helper and add the VXLAN encap community only
when the caller requests it.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 2e7ec11fc0..33bbc7adb9 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1327,10 +1327,10 @@ bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
/*
* Build extended communities for EVPN prefix route.
*/
-static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf, struct attr *attr)
+static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf, struct attr *attr,
+ bgp_encap_types tnl_type)
{
struct ecommunity_val eval_tmp;
- bgp_encap_types tnl_type;
struct bgp_evpn_effective_fq_rt *fq_rt;
struct ecommunity *old_ecom;
struct ecommunity *ecom;
@@ -1347,10 +1347,11 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf, struct attr *att
ecom = ecommunity_new();
/* Encap */
- tnl_type = BGP_ENCAP_TYPE_VXLAN;
- encode_encap_extcomm(tnl_type, &eval_tmp);
- ecommunity_append_val_unchecked(ecom, &eval_tmp);
- attr->encap_tunneltype = tnl_type;
+ if (tnl_type == BGP_ENCAP_TYPE_VXLAN) {
+ encode_encap_extcomm(tnl_type, &eval_tmp);
+ ecommunity_append_val_unchecked(ecom, &eval_tmp);
+ attr->encap_tunneltype = tnl_type;
+ }
/* Add the export RTs for L3VNI/VRF (the effective export list is
* sorted and duplicate free)
@@ -2072,7 +2073,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct bgp_path_info *or
}
/* Setup RT and encap extended community */
- build_evpn_type5_route_extcomm(bgp_vrf, &attr);
+ build_evpn_type5_route_extcomm(bgp_vrf, &attr, BGP_ENCAP_TYPE_VXLAN);
/* get the route node in global table */
dest = bgp_evpn_global_node_get(bgp_evpn->rib[afi][safi], afi, safi,