Merge branch 'backport/esp_netif_get_ip6addr_should_be_valid_v52' into 'release/v5.2'

fix(esp_netif): netif should return only valid addr(Backportv5.2)

See merge request espressif/esp-idf!32160
This commit is contained in:
Jiang Jiang Jian 2024-08-22 19:45:22 +08:00
commit bf3bd01f2c

View File

@ -2153,7 +2153,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));
}
}