mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
examples: common connect component to use both interfaces at once
This commit is contained in:
@@ -1446,7 +1446,7 @@ static esp_err_t esp_netif_create_ip6_linklocal_api(esp_netif_api_msg_t *msg)
|
||||
{
|
||||
esp_netif_t *esp_netif = msg->esp_netif;
|
||||
|
||||
ESP_LOGD(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
ESP_LOGV(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
|
||||
struct netif *p_netif = esp_netif->lwip_netif;
|
||||
if (p_netif != NULL && netif_is_up(p_netif)) {
|
||||
@@ -1462,7 +1462,7 @@ esp_err_t esp_netif_create_ip6_linklocal(esp_netif_t *esp_netif) _RUN_IN_LWIP_TA
|
||||
|
||||
esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
|
||||
{
|
||||
ESP_LOGD(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
ESP_LOGV(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
|
||||
if (esp_netif == NULL || if_ip6 == NULL || esp_netif->is_ppp_netif) {
|
||||
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||
@@ -1479,7 +1479,7 @@ esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if
|
||||
|
||||
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);
|
||||
ESP_LOGV(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
|
||||
if (esp_netif == NULL || if_ip6 == NULL) {
|
||||
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||
@@ -1496,10 +1496,31 @@ esp_err_t esp_netif_get_ip6_global(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
|
||||
{
|
||||
ESP_LOGV(TAG, "%s esp-netif:%p", __func__, esp_netif);
|
||||
|
||||
if (esp_netif == NULL || if_ip6 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int addr_count = 0;
|
||||
struct netif *p_netif = esp_netif->lwip_netif;
|
||||
|
||||
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)) {
|
||||
memcpy(&if_ip6[addr_count++], &p_netif->ip6_addr[i], sizeof(ip6_addr_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
return addr_count;
|
||||
}
|
||||
|
||||
esp_netif_flags_t esp_netif_get_flags(esp_netif_t *esp_netif)
|
||||
{
|
||||
return esp_netif->flags;
|
||||
|
Reference in New Issue
Block a user