bgpd: fix self type-2 routes rmac and nexhtop

For self type-2 routes, do not assign system-rmac
as attribute RMAC value if advertise-pip is disable
or macvlan is not present.

Ticket:CM-26923
Reviewed By:CCR-9397
Testing Done:

pip is disabled under bgp vrf2 instance.
Trigger frr-restart.

Before fix:
*> [2]:[0]:[48]:[00:02:00:00:00:2e]:[32]:[45.0.4.4]
                    36.0.0.11                          32768 i
                    ET:8 RT:5546:1004 RT:5546:4002 Rmac:00:02:00:00:00:2e

After fix:
*> [2]:[0]:[48]:[00:02:00:00:00:2e]:[32]:[45.0.4.4]
                    36.0.0.11                          32768 i
                    ET:8 RT:5546:1004 RT:5546:4002 Rmac:44:38:39:ff:ff:01

TOR# ifquery vlan1004
auto vlan1004
iface vlan1004
        address 45.0.4.4/24
        vlan-id 1004
        vrf vrf2

VNI: 4002 (known to the kernel)
  Type: L3
  Tenant VRF: vrf2
  RD: 45.0.6.4:3
  Originator IP: 36.0.0.11
  Advertise-pip: Yes
  System-IP: 27.0.0.11
  System-MAC: 00:02:00:00:00:2e
  Router-MAC: 44:38:39:ff:ff:01

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
Chirag Shah 2019-10-24 14:32:49 -07:00
parent 1c97c9fd23
commit b96cafa338

View File

@ -504,29 +504,29 @@ static void bgp_evpn_get_rmac_nexthop(struct bgpevpn *vpn,
if (!bgp_vrf) if (!bgp_vrf)
return; return;
if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) { if (p->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
/* Copy sys (pip) RMAC and PIP IP as nexthop return;
* in case of route is self MAC-IP,
* advertise-pip and advertise-svi-ip features /* Copy sys (pip) RMAC and PIP IP as nexthop
* are enabled. * in case of route is self MAC-IP,
* Otherwise, for all host MAC-IP route's * advertise-pip and advertise-svi-ip features
* copy anycast RMAC * are enabled.
*/ * Otherwise, for all host MAC-IP route's
if (CHECK_FLAG(flags, BGP_EVPN_MACIP_TYPE_SVI_IP) * copy anycast RMAC
&& bgp_evpn_is_svi_macip_enabled(vpn)) { */
/* copy sys rmac */ if (CHECK_FLAG(flags, BGP_EVPN_MACIP_TYPE_SVI_IP)
memcpy(&attr->rmac, &bgp_vrf->evpn_info->pip_rmac, && bgp_vrf->evpn_info->advertise_pip &&
ETH_ALEN); bgp_vrf->evpn_info->is_anycast_mac) {
if (bgp_vrf->evpn_info->advertise_pip && /* copy sys rmac */
bgp_vrf->evpn_info->is_anycast_mac) { memcpy(&attr->rmac, &bgp_vrf->evpn_info->pip_rmac,
attr->nexthop = bgp_vrf->evpn_info->pip_ip; ETH_ALEN);
attr->mp_nexthop_global_in = attr->nexthop = bgp_vrf->evpn_info->pip_ip;
bgp_vrf->evpn_info->pip_ip; attr->mp_nexthop_global_in =
} bgp_vrf->evpn_info->pip_ip;
} else } else
memcpy(&attr->rmac, &bgp_vrf->rmac, ETH_ALEN); memcpy(&attr->rmac, &bgp_vrf->rmac, ETH_ALEN);
}
} }
/* /*
* Create RT extended community automatically from passed information: * Create RT extended community automatically from passed information:
* of the form AS:VNI. * of the form AS:VNI.