Skip to content

Commit dc7178f

Browse files
author
Arun S
committed
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.
1 parent fd22997 commit dc7178f

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

features/lwipstack/LWIPStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ nsapi_size_or_error_t LWIP::socket_sendto(nsapi_socket_t handle, const SocketAdd
439439
}
440440
if (netif_) {
441441
if ((addr.version == NSAPI_IPv4 && !get_ipv4_addr(netif_)) ||
442-
(addr.version == NSAPI_IPv6 && !get_ipv6_addr(netif_))) {
442+
(addr.version == NSAPI_IPv6 && !get_ipv6_addr(netif_) && !get_ipv6_link_local_addr(netif_))) {
443443
return NSAPI_ERROR_PARAMETER;
444444
}
445445
}

features/lwipstack/lwip_tools.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,8 @@ bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in)
273273

274274
#if LWIP_IPV4 && LWIP_IPV6
275275
if (in->version == NSAPI_UNSPEC) {
276-
#if IP_VERSION_PREF == PREF_IPV4
277-
ip_addr_set_zero_ip4(out);
278-
#else
279-
ip_addr_set_zero_ip6(out);
280-
#endif
276+
ip6_addr_set_zero(ip_2_ip6(out));
277+
IP_SET_TYPE(out, IPADDR_TYPE_ANY);
281278
return true;
282279
}
283280
#endif

0 commit comments

Comments
 (0)