9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] select correct ipv6 source when using both ULA and GUA
@ 2022-10-22 16:18 Arne Meyer
  0 siblings, 0 replies; only message in thread
From: Arne Meyer @ 2022-10-22 16:18 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

9front has no concept of ULA addresses. We are treating ULAs as GUAs which results in selecting a ULA as a source address for GUA address space. This breaks routing when using both scopes.

Greetings,
Arne

[-- Attachment #2: ula.patch --]
[-- Type: application/octet-stream, Size: 1018 bytes --]

diff e938acc8ff64a3cbbd6ef7ba88f83e3f03ede681 uncommitted
--- 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;
 }
@@ -1219,7 +1222,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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-22 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 16:18 [9front] [patch] select correct ipv6 source when using both ULA and GUA Arne Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).