lwip: Enable IPv6 stateless address autoconfiguration

This commit is contained in:
xiehang
2019-11-27 10:34:00 +08:00
committed by bot
parent 1512219905
commit c0148ef1e8
6 changed files with 59 additions and 1 deletions

View File

@@ -1396,6 +1396,29 @@ esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if
return ESP_OK;
}
esp_err_t esp_netif_get_ip6_global(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
{
ESP_LOGD(TAG, "%s esp-netif:%p", __func__, esp_netif);
if (esp_netif == NULL || if_ip6 == NULL) {
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
}
int i;
struct netif *p_netif = esp_netif->lwip_netif;
if (p_netif != NULL && netif_is_up(p_netif)) {
for (i = 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
if (ip6_addr_ispreferred(netif_ip6_addr_state(p_netif, i))) {
memcpy(if_ip6, &p_netif->ip6_addr[i], sizeof(ip6_addr_t));
return ESP_OK;
}
}
}
return ESP_FAIL;
}
esp_netif_flags_t esp_netif_get_flags(esp_netif_t *esp_netif)
{
return esp_netif->flags;