Skip to content

Commit

Permalink
Merge pull request #11877 from cy-arsm/cy-arsm/topic/dualstack-ipv6-l…
Browse files Browse the repository at this point in the history
…inklocal-fix

Fix for sending IPv6 UDP packet over link local interface
  • Loading branch information
0xc0170 authored Nov 21, 2019
2 parents 30bab09 + dc7178f commit 784b03b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion features/lwipstack/LWIPStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
7 changes: 2 additions & 5 deletions features/lwipstack/lwip_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,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
Expand Down

0 comments on commit 784b03b

Please sign in to comment.