]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Attach PMSI to only type-3 routes and rmac to only type-2 routes
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Fri, 23 Feb 2018 10:16:47 +0000 (02:16 -0800)
committermitesh <mitesh@cumulusnetworks.com>
Tue, 27 Feb 2018 09:14:43 +0000 (01:14 -0800)
The PMSI attribute is only applicable to EVPN type-3 route.
Rmac is applicable to type-2 and type-5 routes.
We should attach these attributes appropiately based on route-type.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_evpn.c

index ec8e2907a69c5b641005259c6df6f30ccbd34627..9d32e0c375102922b2e3c5e19fd5aaae6bbc5603 100644 (file)
@@ -1254,8 +1254,14 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
        attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
        attr.sticky = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY) ? 1 : 0;
        attr.default_gw = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW) ? 1 : 0;
-       attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL);
-       bgpevpn_get_rmac(vpn, &attr.rmac);
+
+       /* PMSI is only needed for type-3 routes */
+       if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE)
+               attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL);
+
+       /* router mac is only needed for type-2 and type-5  routes */
+       if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
+               bgpevpn_get_rmac(vpn, &attr.rmac);
        vni2label(vpn->vni, &(attr.label));
 
        /* Set up RT and ENCAP extended community. */