ref: b2fc8d4a337e2f82eb78ac8fe53c57648d200793
parent: 29416fe9f670d9c02e409a76ee40f9a07772c506
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 10 10:22:14 EDT 2021
devip: use top bit (type) | subnet-id for V6H() route hash macro theres no structure in the lower 32 bits of an ipv6 address. use the top bit to distinguish special stuff like multicast and link-local addresses, and use the 16-bit subnet-id bits for the rest.
--- a/sys/src/9/ip/iproute.c
+++ b/sys/src/9/ip/iproute.c
@@ -383,7 +383,7 @@
}
#define V4H(a) ((a&0x07ffffff)>>(32-Lroot-5))
-#define V6H(a) (((a)[IPllen-1]&0x07ffffff)>>(32-Lroot-5))
+#define V6H(a) (((a)[0]&0x80000000)>>(32-Lroot) | ((a)[(IPllen/2)-1]&(0xffff>>(16-Lroot))))
static void
routeadd(Fs *f, Route *r)
--
⑨