-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc_netif: handle NETDEV_EVENT_LINK_UP/DOWN events #17893
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
Conversation
I don't have hardware to test, but the approach seems reasonable to me. |
5959d85
to
45dcdf8
Compare
Currently the event is implemented by
|
Code looks good to me. @fabian18 has recently dived deep into the NDP code, maybe he could also talk a quick look, as I'm not that familiar with the code. |
123a60d
to
499085a
Compare
LGTM, but @benpicco offline told me that sometimes the prefix is not received, regardless, after the interface is brought up. If that could be debugged (or at least some sniffing output to guess the problem) before this is merged, that would be nice. |
I meant with that primarily that it should be ensured that this problem is not introduced by this PR. If this is a general problem or if this PR only makes the cause of a bigger symptom more obvious, then I am fine with merging this PR as is. |
Lines 274 to 276 in 7ee1b58
This assertion is triggered, after the call to netif_get_opt(&netif->netif, NETOPT_LINK, 0, &link, sizeof(netopt_enable_t)); ,for me at least. |
I would wish that addresses are auto (re-)configured in |
What about addresses that were configured manually by the application? |
They are lost. The application must take care of that, I think. |
The problem is that without #17902 we don't have any way to notify the application that the interface is up again. With WiFi we could then just lose a manually configured address if the node gets out of range for some time. |
So the status in this PR is, as far as I understand. You would rather keep the addresses of an interface during a link restart, until there is a way to notify an application that a link has restarted, right? And if this PR is merged, your plan is to add address reconfiguration on link up and address dropping on link down in #17902? I was hoping to see the correct behavior in this PR already. But... if you prefer to keep it that way I think this PR is about ready. I don´t want to ACK a PR in a hurry, so let me go through this one more time in the evening or at latest tomorrow. |
Yes, I try not to do so many things at once in a PR.
Dropping addresses/generating events to the application would be another behavior change that I'd rather keep separate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I searched the code base for netdev_driver_t
, and i think there are some more netdevs to be adjusted.
For netdev_test.c
and nimble_netif.c
I am not sure whether they must be adjusted because they do not call netdev->event_callback()
at all. My guess is that they don´t have to be adjusted.
Oh sorry those are the netdevs which support |
Ok but |
e0f6aa6
to
a4a9cab
Compare
Thank you, missed that one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
a4a9cab
to
838a5e4
Compare
I had to rebase to make static checks happy - spell checks have been fixed in a different PR. |
I think this broke tests/gnrc_ipv6_nib samr21-xpro. |
But… how? |
|
Huh this is weird - why does this not fail on |
This PR broke the LoRa tests :/ (see https://forum.riot-os.org/t/lora-e5-dev-any-working-lora-examples/3755/13). |
Contribution description
If an interface goes offline we can to stop sending router solicitations on it.
But more importantly, if the interface gets online again, we need to send out a router solicitation immediately to get a fresh address.
Testing procedure
This was tested with a
atwinc15x0
WiFi module. When it connects to a WiFi network it generates aNETDEV_EVENT_LINK_UP
event, when the WiFi is no longer connected aNETDEV_EVENT_LINK_DOWN
event is generated.I used two custom functions to manage the netif state, but
ifconfig
should work too:Issues/PRs references