[riot-notifications] [RIOT-OS/RIOT] gnrc/netif_bus: generate distinct events for global and link-local addresses (#15415)

benpicco notifications at github.com
Tue Nov 10 00:24:04 CET 2020

### Contribution description

The `GNRC_IPV6_EVENT_ADDR_VALID event would be generated for *both* link-local and global addresses.

So if a user wants to be notified about a global address, they have to do

    msg_bus_subscribe(&sub, GNRC_IPV6_EVENT_ADDR_VALID);
    msg_t m;
    do {
        if (xtimer_msg_receive_timeout(&m, ADDR_TIMEOUT_US) < 0) {
            return -1;
    } while (ipv6_addr_is_link_local(m.content.ptr));

This is cumbersome and error-prone.

Instead, introduce a two separate events for link-local and global addresses.
Now we don't have to loop anymore until the 'proper' message is received, we
can simply do

    msg_bus_subscribe(&sub, GNRC_IPV6_EVENT_GLOBAL_ADDR_VALID);
    return xtimer_msg_receive_timeout(&m, ADDR_TIMEOUT_US);
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

### Testing procedure

Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * gnrc/netif_bus: generate distinct events for global and link-local addresses

-- File Changes --

    M sys/include/net/gnrc/netif.h (18)
    M sys/net/gnrc/netif/gnrc_netif.c (5)
    M sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c (8)
    M sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c (8)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201109/1020d238/attachment.htm>

More information about the notifications mailing list