Skip to content

Commit 784b03b

Browse files
authored
Merge pull request #11877 from cy-arsm/cy-arsm/topic/dualstack-ipv6-linklocal-fix
Fix for sending IPv6 UDP packet over link local interface
2 parents 30bab09 + dc7178f commit 784b03b

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
@@ -279,11 +279,8 @@ bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in)
279279

280280
#if LWIP_IPV4 && LWIP_IPV6
281281
if (in->version == NSAPI_UNSPEC) {
282-
#if IP_VERSION_PREF == PREF_IPV4
283-
ip_addr_set_zero_ip4(out);
284-
#else
285-
ip_addr_set_zero_ip6(out);
286-
#endif
282+
ip6_addr_set_zero(ip_2_ip6(out));
283+
IP_SET_TYPE(out, IPADDR_TYPE_ANY);
287284
return true;
288285
}
289286
#endif

0 commit comments

Comments
 (0)