ref: 9984f40f07b94a2b71074d78237ff87d893ccf1e
parent: 037c6189a59166b4d404ca3b014465dc82ebeeda
author: Jacob Moody <moody@posixcafe.org>
date: Wed Nov 2 01:44:01 EDT 2022
kernel: Do not treat IPv6 ULA's as GUA's (thanks Arne Meyer)
--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -70,6 +70,7 @@
unknownv6, /* UGH */
unspecifiedv6,
linklocalv6,
+ ulav6,
globalv6,
};
@@ -81,6 +82,8 @@
else if(islinklocal(addr) || ipcmp(addr, v6loopback) == 0 ||
isv6mcast(addr) && (addr[1] & 0xF) <= Link_local_scop)
return linklocalv6;
+ else if(isula(addr))
+ return ulav6;
else
return globalv6;
}
@@ -1218,7 +1221,7 @@
}
/*
- * find "best" (global > link local > unspecified)
+ * find "best" (global > ula > link local > unspecified)
* local address; address must be current.
*/
static void
--- a/sys/src/9/ip/ipv6.h
+++ b/sys/src/9/ip/ipv6.h
@@ -16,6 +16,7 @@
*/
#define isv6mcast(addr) ((addr)[0] == 0xff)
#define islinklocal(addr) ((addr)[0] == 0xfe && ((addr)[1] & 0xc0) == 0x80)
+#define isula(addr) ((addr)[0] == 0xfd)
#define optexsts(np) (nhgets((np)->ploadlen) > 24)
#define issmcast(addr) (memcmp((addr), v6solicitednode, 13) == 0)