}
return buf;
}
+
++/*
++ * Convert IPv4 address to IPv4-mapped IPv6 address which is of the
++ * form ::FFFF:<IPv4 address> (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__ */
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,
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)) {
&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(