Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWIP::get_ip_addr: Prefer IPv4 over IPv6 link local addresses #161

Merged
merged 1 commit into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions connectivity/lwipstack/source/lwip_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ const ip_addr_t *LWIP::get_ipv6_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;
}
Expand Down Expand Up @@ -164,6 +158,9 @@ const ip_addr_t *LWIP::get_ip_addr(bool any_addr, const struct netif *netif)
pref_ip_addr = get_ipv6_addr(netif);
npref_ip_addr = get_ipv4_addr(netif);
#endif
if (!npref_ip_addr) {
npref_ip_addr = get_ipv6_link_local_addr(netif);
}
#elif LWIP_IPV6
pref_ip_addr = get_ipv6_addr(netif);
#elif LWIP_IPV4
Expand Down