-
Notifications
You must be signed in to change notification settings - Fork 141
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
IP_EVENT_PPP_LOST_IP only received after lost ip timer fires when initiating disconnect, is this expected? (IDFGH-11378) #415
Comments
Yes, this is expected and how the network layers behave in IDF. These "lost-IP" events (not only PPP, but all others) are triggered from a timer and do not reflect the actual (link) state of the network interface. The reason is probably historical and based on the way the TCP protocol works, because the connection is up and running and you can send data to sockets even if you're physically disconnected. |
Yeah I was kind of treating those events like that, would be convenient so the link state can be directly reflected through an LED/on the screen. I guess the best way to go about this is to have component/esp_modem specific events that get posted to inform the app about link state changes? Or is this something that could easily be done for any interface through lwIP? |
Yes, currently it's user code that needs to treat interfaces separately to react on link based events,; In case of
Yes, lwIP provides a link status callback. There's been a plan to support this in |
Ok thanks. So I have a PPPoS client running with esp_modem and it's battery powered, I need to go back to sleep as soon as possible. Calling |
Yes, this should be enough for the clean closure
Do you still get this event, even after those two calls? This sounds a bit odd to me, since calling
so you would see this line in the debug log:
but no event should be fired anymore |
You're right, it doesn't actually fire the Thanks for clarifying! |
Answers checklist.
General issue report
From looking at the (ESP-IDF) code and my own experiments it seems that the
IP_EVENT_PPP_LOST_IP
event is only posted immediately when the PPP connection disconnects unexpectedly but much later (~minute) when the shutdown is deliberately initiated by callingesp_netif_action_stop
.I can see in the logs that
esp_netif_action_stop
properly shuts the PPP link down, it just doesn't postIP_EVENT_PPP_LOST_IP
, this is only done by the netif lost ip timer, about a minute later.Is this the desired behavior? I expected the PPP code to post an
IP_EVENT_PPP_LOST_IP
event in both cases and not rely on the netif lost ip timer to post that event a while later when the PPP code knows perfectly well when the link is down.NETIF_PPP_ERRORUSER
event is properly fired but it's odd to then also get anIP_EVENT_PPP_LOST_IP
so much later.The text was updated successfully, but these errors were encountered: