Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppp interface is UP after calling esp_netif_new() (IDFGH-3044) #5069

Closed
AxelLin opened this issue Apr 6, 2020 · 4 comments
Closed

ppp interface is UP after calling esp_netif_new() (IDFGH-3044) #5069

AxelLin opened this issue Apr 6, 2020 · 4 comments

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Apr 6, 2020

Module or chip used: ESP32-WROOM-32
IDF version: v4.2-dev-1034-ge599b794bebe
Build System: CMake
Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r1) 8.2.0
Operating System: Linux
Power Supply: USB

With below code, the esp_netif_is_netif_up() returns true.

esp_netif_config_t cfg = ESP_NETIF_DEFAULT_PPP();
esp_netif_t *esp_netif = esp_netif_new(&cfg);
assert(esp_netif);

bool is_up = esp_netif_is_netif_up(esp_netif);

This looks wrong to me because the modem is not yet dial-up and it even not yet init the modem.
For comparison, in STA and AP cases, after calling esp_netif_create_default_wifi_sta() or esp_netif_create_default_wifi_ap()
the interface is still DOWN.

The problem is when PPP is consider UP, the route algorithm will select it as default route.
But there could be some reason the application doesn't call dial-up immediately or never calls dial-up because sim card is not properly inserted.

@AxelLin
Copy link
Contributor Author

AxelLin commented Apr 6, 2020

add @david-cermak

@github-actions github-actions bot changed the title ppp interface is UP after calling esp_netif_new() ppp interface is UP after calling esp_netif_new() (IDFGH-3044) Apr 6, 2020
@AxelLin
Copy link
Contributor Author

AxelLin commented Apr 7, 2020

If add checking netif_is_link_up() in esp_netif_is_netif_up(), the result looks fine.

see espressif/esp-lwip@3ca5184
the ppp netif now using netif_set_link_{up,down} instead of netif_set_{up,down} when PPP
reaches/leaves running state. PPP interface is now set to administratively
UP when created with link state down.

@david-cermak
Copy link
Collaborator

Hi @AxelLin

Thanks for reporting this issue and posting the hint on ppp netif status.
This needs to be fixed!

@AxelLin
Copy link
Contributor Author

AxelLin commented Apr 25, 2020

I fixed it by below changes:
#5183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants