From 05d7f355145e1d941a25ac6029a8e5c02bdbc2a9 Mon Sep 17 00:00:00 2001 From: harios Date: Tue, 23 Jun 2020 20:05:20 +0530 Subject: [PATCH] Fix done for nexthop as IPv4 mapped IPv6 address 1. "RTF_MAPPED_IPV6" flag is set for IPv4 mapped IPv6 nexthop address. 2. This changes are tested with danos-1908 revision. Signed-off-by: harios --- src/ip_netlink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ip_netlink.c b/src/ip_netlink.c index 309ca908..52ef1806 100644 --- a/src/ip_netlink.c +++ b/src/ip_netlink.c @@ -492,6 +492,8 @@ static bool nexthop6_fill(struct nlattr *ntb_gateway, next->gateway.address.ip_v6 = *(struct in6_addr *)mnl_attr_get_payload(ntb_gateway); next->flags = RTF_GATEWAY; + if (IN6_IS_ADDR_V4MAPPED(&next->gateway.address.ip_v6)) + next->flags |= RTF_MAPPED_IPV6; } else { next->gateway.address.ip_v6 = anyaddr; next->flags = 0; @@ -852,6 +854,8 @@ static int handle_route6(vrfid_t vrf_id, uint16_t type, if (exp_ifp && !ifp && !is_ignored_interface(ifindex)) return -1; size = 1; + if (IN6_IS_ADDR_V4MAPPED(&ip_addr.address.ip_v6)) + flags |= RTF_MAPPED_IPV6; next = nexthop_create(ifp, &ip_addr, flags, num_labels, labels); }