[riot-notifications] [RIOT-OS/RIOT] net/gnrc/ipv6: move gnrc_util_conf_prefix() to common code (#16672)

Martine Lenders notifications at github.com
Thu Jul 22 19:08:18 CEST 2021


@miri64 requested changes on this pull request.



> +#include "net/gnrc/netif/internal.h"
+
+#define ENABLE_DEBUG 0
+#include "debug.h"
+
+static char addr_str[IPV6_ADDR_MAX_STR_LEN];
+
+static bool _ctx_match(const gnrc_sixlowpan_ctx_t *ctx,
+                       const ipv6_addr_t *prefix, uint8_t prefix_len)
+{
+    return (ctx != NULL) &&
+           (ctx->prefix_len == prefix_len) &&
+           (ipv6_addr_match_prefix(&ctx->prefix, prefix) >= prefix_len);
+}
+
+static void _update_6ctx(const ipv6_addr_t *prefix, uint8_t prefix_len,

Setting the context is typically only something you want to do on the border router, so putting that into the generic code seem misplaced. 

> +        if (pref < UINT32_MAX) { /* UINT32_MAX means infinite lifetime */
+            /* same treatment for pref */
+            pref = (pref > (UINT32_MAX / MS_PER_SEC)) ?
+                         (UINT32_MAX - 1) : pref * MS_PER_SEC;
+        }
+        gnrc_ipv6_nib_pl_set(netif->pid, pfx, pfx_len, valid, pref);
+        if (IS_USED(MODULE_GNRC_IPV6_NIB) &&
+            IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LBR) &&
+            IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) &&
+            gnrc_netif_is_6ln(netif)) {
+            if (IS_USED(MODULE_GNRC_SIXLOWPAN_CTX)) {
+                _update_6ctx(pfx, pfx_len, valid);
+            }
+            (void)gnrc_ipv6_nib_abr_add(&addr);
+        }
+        if (IS_USED(MODULE_GNRC_RPL)) {

Same for the RPL root. You do not necessarily want to add one. On every node you want to set a prefix for... 

-- 
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/16672#pullrequestreview-713031836
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210722/a2d639a4/attachment.htm>


More information about the notifications mailing list