From dc7178f1761a3baf3dac56934c0e57388ae9685c Mon Sep 17 00:00:00 2001 From: Arun S Date: Thu, 14 Nov 2019 13:07:38 +0530 Subject: [PATCH] Modified LwIP stack and LwIP mbed-os wrapper to support sending IPv6 UDP packets when IPv4 and IPv6 dual mode stack is enabled and the IPv6 packet is sent over link-local inerface. --- features/lwipstack/LWIPStack.cpp | 2 +- features/lwipstack/lwip_tools.cpp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/features/lwipstack/LWIPStack.cpp b/features/lwipstack/LWIPStack.cpp index 34345dc0c94..254863e17a6 100644 --- a/features/lwipstack/LWIPStack.cpp +++ b/features/lwipstack/LWIPStack.cpp @@ -439,7 +439,7 @@ nsapi_size_or_error_t LWIP::socket_sendto(nsapi_socket_t handle, const SocketAdd } if (netif_) { if ((addr.version == NSAPI_IPv4 && !get_ipv4_addr(netif_)) || - (addr.version == NSAPI_IPv6 && !get_ipv6_addr(netif_))) { + (addr.version == NSAPI_IPv6 && !get_ipv6_addr(netif_) && !get_ipv6_link_local_addr(netif_))) { return NSAPI_ERROR_PARAMETER; } } diff --git a/features/lwipstack/lwip_tools.cpp b/features/lwipstack/lwip_tools.cpp index 6a9ca39db0f..f4c38fcb2f1 100644 --- a/features/lwipstack/lwip_tools.cpp +++ b/features/lwipstack/lwip_tools.cpp @@ -273,11 +273,8 @@ bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in) #if LWIP_IPV4 && LWIP_IPV6 if (in->version == NSAPI_UNSPEC) { -#if IP_VERSION_PREF == PREF_IPV4 - ip_addr_set_zero_ip4(out); -#else - ip_addr_set_zero_ip6(out); -#endif + ip6_addr_set_zero(ip_2_ip6(out)); + IP_SET_TYPE(out, IPADDR_TYPE_ANY); return true; } #endif