LWIP::get_ipv6_addr fixed to avoid returning NULL even if only linklocal adress exits.

pull/11894/head
Tymoteusz Bloch 2019-10-18 17:13:08 +02:00 committed by adbridge
parent ce2800b01d
commit 1097ba7bda
2 changed files with 12 additions and 0 deletions

View File

@ -228,7 +228,13 @@ void LWIP::Interface::netif_status_irq(struct netif *netif)
if (interface->has_addr_state & HAS_ANY_ADDR) {
interface->connected = NSAPI_STATUS_GLOBAL_UP;
#if LWIP_IPV6
if (ip_addr_islinklocal(get_ipv6_addr(netif))) {
interface->connected = NSAPI_STATUS_LOCAL_UP;
}
#endif
}
} else if (!netif_is_up(&interface->netif) && netif_is_link_up(&interface->netif)) {
interface->connected = NSAPI_STATUS_DISCONNECTED;
}

View File

@ -92,6 +92,12 @@ const ip_addr_t *LWIP::get_ipv6_link_local_addr(const struct netif *netif)
return netif_ip_addr6(netif, i);
}
}
for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) {
return netif_ip_addr6(netif, i);
}
}
#endif
return NULL;
}