]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Fix IP-VRF ext-comm check for MACIP routes
authorTrey Aspelund <taspelund@nvidia.com>
Tue, 13 Apr 2021 03:42:11 +0000 (03:42 +0000)
committerTrey Aspelund <taspelund@nvidia.com>
Tue, 20 Apr 2021 14:00:20 +0000 (14:00 +0000)
When validating a MACIP route's IP address,
bgp_evpn_route_add_l3_ecomm_ok checked for a non link-local v6 address
without checking if the v6 address existed.  Since empty v6 addresses
do not fall into the fe80 range, MAC-Only routes were always passing
this check and getting IP-VRF extended communities (RMAC/IP-VRF RT)
added to the routes.
This commit requires ipaddr_v6 to exist AND fall outside of the
link-local range for IP-VRF ext-comms to be added.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
bgpd/bgp_evpn.c

index 2d4fea413a1a4f1fc9c189d5f6ac55edd0decd0f..eb962d54301d28b3d1811055bab3f5d8ac29ef2e 100644 (file)
@@ -1670,8 +1670,9 @@ static inline bool bgp_evpn_route_add_l3_ecomm_ok(struct bgpevpn *vpn,
 {
        return p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
               && (is_evpn_prefix_ipaddr_v4(p)
-                  || !IN6_IS_ADDR_LINKLOCAL(
-                          &p->prefix.macip_addr.ip.ipaddr_v6))
+                  || (is_evpn_prefix_ipaddr_v6(p)
+                      && !IN6_IS_ADDR_LINKLOCAL(
+                              &p->prefix.macip_addr.ip.ipaddr_v6)))
               && CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)
               && bgpevpn_get_l3vni(vpn) && bgp_evpn_es_add_l3_ecomm_ok(esi);
 }