From 1ec31309bb056e4492ebf50a12e8bb29a9c4b29a Mon Sep 17 00:00:00 2001 From: vivek Date: Wed, 28 Feb 2018 02:07:23 +0000 Subject: *: EVPN symmetric routing for IPv6 tenant routes Implement support for EVPN symmetric routing for IPv6 routes. The next hop for EVPN routes is the IP address of the remote VTEP which is only an IPv4 address. This means that for IPv6 symmetric routing, there will be IPv6 destinations with IPv4 next hops. To make this work, the IPv4 next hops are converted into IPv4-mapped IPv6 addresses. As part of support, ensure that "L3" route-targets are not announced with IPv6 link-local addresses so that they won't be installed in the routing table. Signed-off-by: Vivek Venkatraman vivek@cumulusnetworks.com Reviewed-by: Mitesh Kanjariya mitesh@cumulusnetworks.com Reviewed-by: Donald Sharp sharpd@cumulusnetworks.com --- zebra/zebra_rib.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'zebra/zebra_rib.c') diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5c316e077f..cc4888f3e7 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -305,6 +305,8 @@ struct nexthop *route_entry_nexthop_ipv6_ifindex_add(struct route_entry *re, nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX; nexthop->gate.ipv6 = *ipv6; nexthop->ifindex = ifindex; + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)) + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); route_entry_nexthop_add(re, nexthop); @@ -421,6 +423,10 @@ static int nexthop_active(afi_t afi, struct route_entry *re, re->nexthop_mtu = 0; } + /* Next hops (remote VTEPs) for EVPN routes are fully resolved. */ + if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP)) + return 1; + /* Skip nexthops that have been filtered out due to route-map */ /* The nexthops are specific to this route and so the same */ /* nexthop for a different route may not have this flag set */ @@ -858,9 +864,7 @@ static unsigned nexthop_active_check(struct route_node *rn, case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: family = AFI_IP; - if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP)) - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); - else if (nexthop_active(AFI_IP, re, nexthop, set, rn)) + if (nexthop_active(AFI_IP, re, nexthop, set, rn)) SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); else UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); @@ -2548,10 +2552,17 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, struct ipaddr vtep_ip; memset(&vtep_ip, 0, sizeof(struct ipaddr)); - vtep_ip.ipa_type = IPADDR_V4; - memcpy(&(vtep_ip.ipaddr_v4), - &(tmp_nh->gate.ipv4), - sizeof(struct in_addr)); + if (afi == AFI_IP) { + vtep_ip.ipa_type = IPADDR_V4; + memcpy(&(vtep_ip.ipaddr_v4), + &(tmp_nh->gate.ipv4), + sizeof(struct in_addr)); + } else { + vtep_ip.ipa_type = IPADDR_V6; + memcpy(&(vtep_ip.ipaddr_v6), + &(tmp_nh->gate.ipv6), + sizeof(struct in6_addr)); + } zebra_vxlan_evpn_vrf_route_del(re->vrf_id, rmac, &vtep_ip, p); } -- cgit v1.2.3