From: vivek Date: Tue, 6 Mar 2018 22:19:24 +0000 (+0000) Subject: Merge branch 'master' of https://github.com/frrouting/frr into evpn-ipv6-tenant-routing X-Git-Tag: frr-5.0-dev~167^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=bfd498f0dab9a1937c6036cd35ed020b64a69e8f;p=mirror_frr.git Merge branch 'master' of https://github.com/frrouting/frr into evpn-ipv6-tenant-routing Conflicts: zebra/zserv.c --- bfd498f0dab9a1937c6036cd35ed020b64a69e8f diff --cc lib/ipaddr.h index e8dbe9cf0,98c28008d..44bde45ad --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@@ -85,15 -85,4 +85,21 @@@ static inline char *ipaddr2str(struct i } return buf; } + ++/* ++ * Convert IPv4 address to IPv4-mapped IPv6 address which is of the ++ * form ::FFFF: (RFC 4291). This IPv6 address can then ++ * be used to represent the IPv4 address, wherever only an IPv6 address ++ * is required. ++ */ +static inline void ipv4_to_ipv4_mapped_ipv6(struct in6_addr *in6, + struct in_addr in) +{ + u_int32_t addr_type = htonl(0xFFFF); + + memset(in6, 0, sizeof(struct in6_addr)); + memcpy((char *)in6 + 8, &addr_type, sizeof(addr_type)); + memcpy((char *)in6 + 12, &in, sizeof(struct in_addr)); +} + #endif /* __IPADDR_H__ */ diff --cc zebra/zserv.c index 1fc2bfd30,bca8a509d..07258cdb7 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@@ -1172,9 -1171,11 +1172,9 @@@ static int zread_route_add(struct zser case NEXTHOP_TYPE_IPV4: nexthop = route_entry_nexthop_ipv4_add( re, &api_nh->gate.ipv4, NULL, - re->vrf_id); + api_nh->vrf_id); break; - case NEXTHOP_TYPE_IPV4_IFINDEX: { - - struct ipaddr vtep_ip; + case NEXTHOP_TYPE_IPV4_IFINDEX: memset(&vtep_ip, 0, sizeof(struct ipaddr)); if (CHECK_FLAG(api.flags, @@@ -1187,10 -1188,10 +1187,10 @@@ nexthop = route_entry_nexthop_ipv4_ifindex_add( re, &api_nh->gate.ipv4, NULL, ifindex, - re->vrf_id); + api_nh->vrf_id); /* if this an EVPN route entry, - program the nh as neigh + * program the nh as neigh */ if (CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { @@@ -1207,41 -1208,15 +1207,41 @@@ &api.prefix); } break; - } case NEXTHOP_TYPE_IPV6: nexthop = route_entry_nexthop_ipv6_add( - re, &api_nh->gate.ipv6, re->vrf_id); + re, &api_nh->gate.ipv6, api_nh->vrf_id); break; case NEXTHOP_TYPE_IPV6_IFINDEX: + memset(&vtep_ip, 0, sizeof(struct ipaddr)); + if (CHECK_FLAG(api.flags, + ZEBRA_FLAG_EVPN_ROUTE)) { + ifindex = + get_l3vni_svi_ifindex(vrf_id); + } else { + ifindex = api_nh->ifindex; + } + nexthop = route_entry_nexthop_ipv6_ifindex_add( - re, &api_nh->gate.ipv6, api_nh->ifindex, + re, &api_nh->gate.ipv6, ifindex, - re->vrf_id); + api_nh->vrf_id); + + /* if this an EVPN route entry, + * program the nh as neigh + */ + if (CHECK_FLAG(api.flags, + ZEBRA_FLAG_EVPN_ROUTE)) { + SET_FLAG(nexthop->flags, + NEXTHOP_FLAG_EVPN_RVTEP); + vtep_ip.ipa_type = IPADDR_V6; + memcpy(&vtep_ip.ipaddr_v6, + &(api_nh->gate.ipv6), + sizeof(struct in6_addr)); + zebra_vxlan_evpn_vrf_route_add( + vrf_id, + &api.rmac, + &vtep_ip, + &api.prefix); + } break; case NEXTHOP_TYPE_BLACKHOLE: nexthop = route_entry_nexthop_blackhole_add(