[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_nib: only add prefix of same interface to ABR (#13740)

Martine Lenders notifications at github.com
Tue May 12 09:16:48 CEST 2020


@miri64 commented on this pull request.



>      _nib_acquire();
     if ((abr = _nib_abr_add(addr)) == NULL) {
         _nib_release();
         return -ENOMEM;
     }
     abr->valid_until = 0U;
+    /* Associate all existing prefixes in the prefix list of the border router's
+     * downstream interface to the authoritative border router so they are
+     * advertised with the ABRO in a respective PIO. */

Huh?

<details><summary><code>$ git grep -i pio -- sys/net/gnrc/network_layer/ipv6/nib/</code></summary>

```
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl,
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:    gnrc_pktsnip_t *pio;
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:    DEBUG("nib: Build PIO for %s/%u\n",
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:     * https://tools.ietf.org/html/rfc6775#section-6.1 otherwise the PIO will be
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:    pio = gnrc_ndp_opt_pi_build(&offl->pfx, offl->pfx_len, valid_ltime,
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:    if ((pio == NULL) && (ext_opts != NULL)) {
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:        DEBUG("nib: No space left in packet buffer. Not adding PIO\n");
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:    return pio;
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:            if ((ext_opts = _offl_to_pio(pfx, ext_opts)) == NULL) {
sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c:            if ((ext_opts = _offl_to_pio(pfx, ext_opts)) == NULL) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                            const ndp_opt_pi_t *pio,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                            const ndp_opt_pi_t *pio);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                min_pfx_timeout = _handle_pio(netif,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                min_pfx_timeout = _handle_pio(netif,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                            const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr)
sys/net/gnrc/network_layer/ipv6/nib/nib.c:static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                            const ndp_opt_pi_t *pio)
sys/net/gnrc/network_layer/ipv6/nib/nib.c:    valid_ltime = byteorder_ntohl(pio->valid_ltime);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:    pref_ltime = byteorder_ntohl(pio->pref_ltime);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:    if ((pio->len != NDP_OPT_PI_LEN) || (icmpv6->type != ICMPV6_RTR_ADV) ||
sys/net/gnrc/network_layer/ipv6/nib/nib.c:        ipv6_addr_is_link_local(&pio->prefix) || (valid_ltime < pref_ltime)) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:        DEBUG("nib: ignoring PIO with invalid data\n");
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          ipv6_addr_to_str(addr_str, &pio->prefix, sizeof(addr_str)),
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          pio->prefix_len);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          (pio->flags & NDP_OPT_PI_FLAGS_L) ? 'L' : '-',
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          (pio->flags & NDP_OPT_PI_FLAGS_A) ? 'A' : '-');
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          byteorder_ntohl(pio->valid_ltime));
sys/net/gnrc/network_layer/ipv6/nib/nib.c:          byteorder_ntohl(pio->pref_ltime));
sys/net/gnrc/network_layer/ipv6/nib/nib.c:    if (pio->flags & NDP_OPT_PI_FLAGS_A) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:        _auto_configure_addr(netif, &pio->prefix, pio->prefix_len);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:    if ((pio->flags & NDP_OPT_PI_FLAGS_L) || _multihop_p6c(netif, abr)) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:        if (pio->valid_ltime.u32 == 0) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:            DEBUG("nib: PIO for %s/%u with lifetime 0. Removing prefix.\n",
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                  ipv6_addr_to_str(addr_str, &pio->prefix, sizeof(addr_str)),
sys/net/gnrc/network_layer/ipv6/nib/nib.c:                  pio->prefix_len);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:            _remove_prefix(&pio->prefix, pio->prefix_len);
sys/net/gnrc/network_layer/ipv6/nib/nib.c:        if ((pfx = _nib_pl_add(netif->pid, &pio->prefix, pio->prefix_len,
sys/net/gnrc/network_layer/ipv6/nib/nib.c:            if (pio->flags & NDP_OPT_PI_FLAGS_L) {
sys/net/gnrc/network_layer/ipv6/nib/nib.c:            if (pio->flags & NDP_OPT_PI_FLAGS_A) {
```

</details>

TBH a person reading this code and not knowing what a PIO is, has no business reading this code, because I expect at least a passing familiarity with RFC 4861 and 6775.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13740#discussion_r423512696
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200512/bb3fc97b/attachment-0001.htm>


More information about the notifications mailing list