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

benpicco notifications at github.com
Wed Aug 4 16:03:17 CEST 2021


@benpicco commented on this pull request.



> +        /* 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);

Assume we start with `20010DB800000010/60`. For simplicity's sake let's ignore the first 56 bit, those remain constant anyway, and only focus on the last 8 bits, which are 0x10 or 0001 0000.

If we want so split this into two subnets we could have 0001 1000 and 0001 0100 - or 0x18 and 0x14.
So we just count down 2 -> 10, shift it left to the end up the prefix -> 0001 1000
1 -> 01, shift it left to the end up the prefix -> 0001 0100


-- 
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_r682647099
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210804/9d7dce9a/attachment.htm>


More information about the notifications mailing list