From 079954bbf7e48f9b7b6b625e5c1c4a1476a58d03 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 6 Apr 2020 15:57:29 +0800 Subject: [PATCH] esp-netif: esp_netif_is_netif_up should also check netif_is_link_up Otherwise esp_netif_update_default_netif_lwip() may select wrong interface as default route. e.g. calling esp_netif_is_netif_up() for ppp interface before dialing up returns true without this patch then it's selected as the default route due to higher priority. Signed-off-by: Axel Lin --- components/esp_netif/lwip/esp_netif_lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index 83492e6d70da..e29b5efe00ed 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -1141,7 +1141,7 @@ bool esp_netif_is_netif_up(esp_netif_t *esp_netif) { ESP_LOGV(TAG, "%s esp_netif:%p", __func__, esp_netif); - if (esp_netif != NULL && esp_netif->lwip_netif != NULL && netif_is_up(esp_netif->lwip_netif)) { + if (esp_netif != NULL && esp_netif->lwip_netif != NULL && netif_is_up(esp_netif->lwip_netif) && netif_is_link_up(esp_netif->lwip_netif)) { return true; } else { return false;