Merge branch 'bugfix/enable_ipv6_address_autoconfig' into 'master'

lw-ip:  Enable IPv6 stateless address autoconfiguration

Closes WIFI-1237

See merge request espressif/esp-idf!6313
This commit is contained in:
Jiang Jiang Jian 2020-01-15 11:27:56 +08:00
commit 5f803b8283
6 changed files with 59 additions and 1 deletions

View File

@ -613,6 +613,22 @@ esp_err_t esp_netif_create_ip6_linklocal(esp_netif_t *esp_netif);
*/
esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6);
/**
* @brief Get interface global IPv6 address
*
* If the specified interface is up and a preferred global IPv6 address
* has been created for the interface, return a copy of it.
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[out] if_ip6 IPv6 information will be returned in this argument if successful.
*
* @return
* - ESP_OK
* - ESP_FAIL If interface is down, does not have a global IPv6 address,
* or the global IPv6 address is not a preferred address.
*/
esp_err_t esp_netif_get_ip6_global(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6);
/**
* @brief Sets IPv4 address to the specified octets
*

View File

@ -412,6 +412,11 @@ esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if
return ESP_ERR_NOT_SUPPORTED;
}
esp_err_t esp_netif_get_ip6_global(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
{
return ESP_ERR_NOT_SUPPORTED;
}
esp_netif_flags_t esp_netif_get_flags(esp_netif_t *esp_netif)
{
return esp_netif->flags;

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;

@ -1 +1 @@
Subproject commit b4eaf11fe5e980a2d9b655e6617d4163c11465ec
Subproject commit 066ffe0abb83eee47808bf77c1bcfef51ad077fe

View File

@ -60,6 +60,15 @@ esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i
*/
esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6);
/**
* @brief Translates to esp_netif_get_ip6_global
*
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif
* @param if_ip6 See esp_netif_get_ip6_global
* @return See esp_netif_get_ip6_global
*/
esp_err_t tcpip_adapter_get_ip6_global(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6);
/**
* @brief`Translates to esp_netif_dhcpc_get_status
* @param tcpip_if Interface type corresponding to appropriate instance of esp-netif

View File

@ -200,6 +200,11 @@ esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_
return esp_netif_get_ip6_linklocal(netif_from_if(tcpip_if), (esp_ip6_addr_t*)if_ip6);
}
esp_err_t tcpip_adapter_get_ip6_global(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6)
{
return esp_netif_get_ip6_global(netif_from_if(tcpip_if), (esp_ip6_addr_t*)if_ip6);
}
esp_err_t tcpip_adapter_dhcpc_get_status(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dhcp_status_t *status)
{
return esp_netif_dhcpc_get_status(netif_from_if(tcpip_if), status);