From: Stephen Worley Date: Tue, 15 Jun 2021 03:43:05 +0000 (-0400) Subject: zebra: handle ipv6-mapped-ipv4 with DVNI X-Git-Tag: base_9.0~402^2~26 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fb99ca86c4a8a8a2b67e1463b2653ef92ad0e6b6;p=matthieu%2Ffrr.git zebra: handle ipv6-mapped-ipv4 with DVNI Properly handle ipv6-mapped-ipv4 with DVNI by converting the address to ipv4 and setting that as the DST field for the encap. Signed-off-by: Stephen Worley --- diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 31f35a92ad..7f6252e671 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1370,6 +1370,7 @@ static bool _netlink_route_encode_label_info(const struct nexthop *nexthop, struct rtattr *nest; struct mpls_label_stack *nh_label; enum lsp_types_t nh_label_type; + struct in_addr ipv4; nh_label = nexthop->nh_label; nh_label_type = nexthop->nh_label_type; @@ -1405,10 +1406,18 @@ static bool _netlink_route_encode_label_info(const struct nexthop *nexthop, return false; } else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { - if (!nl_attr_put(nlmsg, buflen, LWTUNNEL_IP_DST, - &nexthop->gate.ipv6, 16)) - return false; + if (IS_MAPPED_IPV6(&nexthop->gate.ipv6)) { + ipv4_mapped_ipv6_to_ipv4(&nexthop->gate.ipv6, + &ipv4); + if (!nl_attr_put(nlmsg, buflen, LWTUNNEL_IP_DST, + &ipv4, 4)) + return false; + } else { + if (!nl_attr_put(nlmsg, buflen, LWTUNNEL_IP_DST, + &nexthop->gate.ipv6, 16)) + return false; + } } else { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug(