[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_nib: auto-configure downstream subnets (#16536)

Martine Lenders notifications at github.com
Wed Aug 4 15:11:07 CEST 2021


@miri64 commented on this pull request.



> +    if (new_prefix_len > 64) {
+        DEBUG("simple_subnets: can't split /%u into %u subnets\n", prefix_len, subnets);
+        return;
+    }
+
+    while ((downstream = gnrc_netif_iter(downstream))) {
+        ipv6_addr_t new_prefix;
+
+        if (downstream == upstream) {
+            continue;
+        }
+
+        /* create subnet by adding interface index */
+        new_prefix.u64[0].u64 = byteorder_ntohll(prefix->u64[0]);
+        new_prefix.u64[0].u64 |= (uint64_t)subnets-- << (63 - prefix_len);
+        new_prefix.u64[0] = byteorder_htonll(new_prefix.u64[0].u64);

Maybe add a comment to elevate code understanding.

-- 
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/16536#discussion_r682600618
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210804/1e8b1499/attachment.htm>


More information about the notifications mailing list