sys/net/gnrc/netif: fixing no global address wait #19402
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
The function
gnrc_netif_ipv6_wait_global_address()
will always return true, even if no global address is attached to the interface.Currently the function only waits for any message and does not check if it was from the bus or not. So in
msg.content.ptr
is no valid address and therefore it returns true.I added just the check, if the message is from the bus of any interface and then checking the address. We could also first check if the address in
msg.content.ptr
is valid, but this will just hide the bug. Also the timeout was never checked. It was just assuming that no other message will be received during the wait.Testing procedure
Use two devices, one works as a border router and supports the global address, the other will wait for the global address. You can call the function
gnrc_netif_ipv6_wait_global_address()
on the waiting node and see whether it returns true and finds the global address in the given time-range.