RIOT
RIOT copied to clipboard
net/gnrc_netif: add bus for interface events, gnrc_netif_up()/gnrc_netif_down() functions
Contribution description
It can be useful to know when an interface is up / down, e.g. to (re)start or stop the DHCP client.
This adds a bus to gnrc netif where users interested in interface events (up/down) can subscripe.
It also adds convenience functions gnrc_netif_up(), gnrc_netif_down() that block until the interface event is generated (or timeout).
Testing procedure
Issues/PRs references
includes #17893
The approach makes sense to me and can be easily extended to other netif link layers (e.g 802.15.4). Let's get https://github.com/RIOT-OS/RIOT/pull/17893 first and then proceed with this one
With 8de8d05d3e0a0208a7d89e9271a449cf3cda477c we can now also make use of the bus mechanism in gnrc_ipv6_nib.
This makes the gnrc_netif_bus module mandatory and drops the GNRC_IPV6_NIB_IFACE_UP/DOWN events as they are no longer needed. This unfortunately adds ~400 bytes to the ROM.
To register with the interface events, we have to wait for the interfaces to be initialized. Especially on esp32 this can take surprisingly long.
If you don't agree with this, I can drop the commit.
Murdock results
:x: FAILED
8de8d05d3e0a0208a7d89e9271a449cf3cda477c gnrc_ipv6_nib: make use of gnrc_netif_bus for interface events
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 371 | 0 | 2006 | 01m:37s |
Artifacts
This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.