9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Arne Meyer <meyer.arne83@netcologne.de>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] [patch] select correct ipv6 source when using both ULA and GUA
Date: Sat, 22 Oct 2022 18:18:25 +0200 (CEST)	[thread overview]
Message-ID: <1218253500.4053607.1666455505897@comcenter.netcologne.de> (raw)

[-- 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)

                 reply	other threads:[~2022-10-22 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218253500.4053607.1666455505897@comcenter.netcologne.de \
    --to=meyer.arne83@netcologne.de \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).