]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: handle ipv6-mapped-ipv4 with DVNI
authorStephen Worley <sworley@nvidia.com>
Tue, 15 Jun 2021 03:43:05 +0000 (23:43 -0400)
committerStephen Worley <sworley@nvidia.com>
Mon, 13 Feb 2023 23:12:05 +0000 (18:12 -0500)
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 <sworley@nvidia.com>
zebra/rt_netlink.c

index 31f35a92ad230c5eef0749b72be3c75a08f19946..7f6252e67158c1ff9a4e88d7ae3f42c752fec0f4 100644 (file)
@@ -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(