From be41eb6823defd48d7e84c63fffb3e618b67ab36 Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Fri, 23 Feb 2018 02:16:47 -0800 Subject: [PATCH] bgpd: Attach PMSI to only type-3 routes and rmac to only type-2 routes 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 --- bgpd/bgp_evpn.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index ec8e2907a6..9d32e0c375 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -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. */ -- 2.39.5