Skip to content

Commit

Permalink
Fixed LWIPStack socket_sendto member to fail if interface IP4/6 versi…
Browse files Browse the repository at this point in the history
…on differ from destination adress IP version
  • Loading branch information
tymoteuszblochmobica committed Jun 14, 2019
1 parent fc645bc commit 5e1cc17
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions features/lwipstack/LWIPStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,18 @@ nsapi_size_or_error_t LWIP::socket_sendto(nsapi_socket_t handle, const SocketAdd
{
struct mbed_lwip_socket *s = (struct mbed_lwip_socket *)handle;
ip_addr_t ip_addr;
nsapi_addr_t interface_addr;

nsapi_addr_t addr = address.get_addr();
if (!convert_mbed_addr_to_lwip(&ip_addr, &addr)) {
return NSAPI_ERROR_PARAMETER;
}

convert_lwip_addr_to_mbed(&interface_addr, get_ip_addr(true, &default_interface->netif));
if (addr.version != interface_addr.version) {
return NSAPI_ERROR_PARAMETER;
}

struct netbuf *buf = netbuf_new();

err_t err = netbuf_ref(buf, data, (u16_t)size);
Expand Down

0 comments on commit 5e1cc17

Please sign in to comment.