Merge branch 'bugfix/esp_netif_get_ip6addr_should_be_valid' into 'master'

fix(esp_netif): netif should return only valid addr

See merge request espressif/esp-idf!31880
This commit is contained in:
Zhang Wen Xu 2024-07-09 11:17:44 +08:00
commit 3c9cd354ec

View File

@ -2265,7 +2265,7 @@ int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
if (p_netif != NULL && netif_is_up(p_netif)) {
for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
if (!ip_addr_cmp(&p_netif->ip6_addr[i], IP6_ADDR_ANY)) {
if (ip6_addr_isvalid(netif_ip6_addr_state(p_netif, i)) && !ip_addr_cmp(&p_netif->ip6_addr[i], IP6_ADDR_ANY)) {
memcpy(&if_ip6[addr_count++], &p_netif->ip6_addr[i], sizeof(ip6_addr_t));
}
}