Skip to content
Snippets Groups Projects
Commit 4cb8979e authored by Artur Tynecki's avatar Artur Tynecki Committed by Hugues Kamba Mpiana
Browse files

lwip: Fix function to copy IP address


Extend copy_lwip_ip() function to handle cases with support
only IPv4 or IPv6.

Signed-off-by: Artur Tynecki's avatarArtur Tynecki <artur.tynecki@arm.com>
parent 3565c815
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ static const ip_addr_t *get_ip_addr(bool any_addr, const struct netif *netif)
static void copy_lwip_ip(ip_address_t *dst, const ip_addr_t *src)
{
#if LWIP_IPV4 && LWIP_IPV6
switch (src->type) {
case IPADDR_TYPE_V4:
dst->type = IP_V4_ADDR;
......@@ -116,6 +117,15 @@ static void copy_lwip_ip(ip_address_t *dst, const ip_addr_t *src)
LWIP_PLATFORM_ASSERT("Unreachable");
break;
}
#elif LWIP_IPV6
dst->type = IP_V6_ADDR;
memcpy(dst->addr.ipv6, src->addr, sizeof(dst->addr.ipv6));
#elif LWIP_IPV4
dst->type = IP_V4_ADDR;
dst->addr.ipv4 = src->addr;
#else
#error At least one of LWIP_IPV6 and LWIP_IPV4 is required
#endif
}
static void dispatch_network_event(netif_context_t *context, network_state_callback_event_t event)
......
lwip: Fix function to copy IP address
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment