Skip to content

Commit 7cfa6fa

Browse files
authored
Merge pull request #11714 from tymoteuszblochmobica/linklocal
LWIP::get_ipv6_addr for link-local only
2 parents 6bc2831 + 6514433 commit 7cfa6fa

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

features/lwipstack/LWIPInterface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,13 @@ void LWIP::Interface::netif_status_irq(struct netif *netif)
228228

229229
if (interface->has_addr_state & HAS_ANY_ADDR) {
230230
interface->connected = NSAPI_STATUS_GLOBAL_UP;
231+
#if LWIP_IPV6
232+
if (ip_addr_islinklocal(get_ipv6_addr(netif))) {
233+
interface->connected = NSAPI_STATUS_LOCAL_UP;
234+
}
235+
#endif
231236
}
237+
232238
} else if (!netif_is_up(&interface->netif) && netif_is_link_up(&interface->netif)) {
233239
interface->connected = NSAPI_STATUS_DISCONNECTED;
234240
}

features/lwipstack/lwip_tools.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ const ip_addr_t *LWIP::get_ipv6_addr(const struct netif *netif)
109109
return netif_ip_addr6(netif, i);
110110
}
111111
}
112+
113+
for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
114+
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) {
115+
return netif_ip_addr6(netif, i);
116+
}
117+
}
112118
#endif
113119
return NULL;
114120
}

0 commit comments

Comments
 (0)