Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jan 2012 19:41:19 +0900
From:      Hajimu UMEMOTO <ume@mahoroba.org>
To:        "Rainer Bredehorn" <Bredehorn@gmx.de>
Cc:        freebsd-net@freebsd.org
Subject:   Re: IPv6 multicast routes with  interface local scope
Message-ID:  <ygesjjtyuy8.wl%ume@mahoroba.org>
In-Reply-To: <20120106091320.209360@gmx.net>
References:  <20120106091320.209360@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Fri_Jan__6_19:41:18_2012-1
Content-Type: text/plain; charset=US-ASCII

Hi,

>>>>> On Fri, 06 Jan 2012 10:13:20 +0100
>>>>> "Rainer Bredehorn" <Bredehorn@gmx.de> said:

Bredehorn> The output of netstat is fixed but what about the route command?
Bredehorn> I would like to add or delete a route like "ff01::%fxp1/32" manually.
Bredehorn> The route command complains: "hostname nor servname provided, or not known"
Bredehorn> when I use the "%interface" notation.

Okay, please try the attached patch.

Sincerely,


--Multipart_Fri_Jan__6_19:41:18_2012-1
Content-Type: text/x-patch; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="route-nodelocal.diff"
Content-Transfer-Encoding: 7bit

Index: lib/libc/net/getaddrinfo.c
diff -u -p lib/libc/net/getaddrinfo.c.orig lib/libc/net/getaddrinfo.c
--- lib/libc/net/getaddrinfo.c.orig	2011-12-24 03:27:52.000000000 +0900
+++ lib/libc/net/getaddrinfo.c	2012-01-06 19:30:42.191095539 +0900
@@ -1577,7 +1577,8 @@ ip6_str2scopeid(char *scope, struct sock
 	if (*scope == '\0')
 		return -1;
 
-	if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) {
+	if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6) ||
+	    IN6_IS_ADDR_MC_NODELOCAL(a6)) {
 		/*
 		 * We currently assume a one-to-one mapping between links
 		 * and interfaces, so we simply use interface indices for
Index: sbin/route/route.c
diff -u -p sbin/route/route.c.orig sbin/route/route.c
--- sbin/route/route.c.orig	2011-09-23 09:51:37.000000000 +0900
+++ sbin/route/route.c	2012-01-06 19:30:17.819091371 +0900
@@ -375,7 +375,8 @@ routename(struct sockaddr *sa)
 #ifdef __KAME__
 		if (sa->sa_len == sizeof(struct sockaddr_in6) &&
 		    (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
-		     IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) &&
+		     IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) ||
+		     IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) &&
 		    sin6.sin6_scope_id == 0) {
 			sin6.sin6_scope_id =
 			    ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
@@ -500,7 +501,8 @@ netname(struct sockaddr *sa)
 #ifdef __KAME__
 		if (sa->sa_len == sizeof(struct sockaddr_in6) &&
 		    (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
-		     IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) &&
+		     IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) ||
+		     IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) &&
 		    sin6.sin6_scope_id == 0) {
 			sin6.sin6_scope_id =
 			    ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
@@ -1002,7 +1004,8 @@ getaddr(int which, char *str, struct hos
 		memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
 #ifdef __KAME__
 		if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) ||
-		     IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) &&
+		     IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr) ||
+		     IN6_IS_ADDR_MC_NODELOCAL(&su->sin6.sin6_addr)) &&
 		    su->sin6.sin6_scope_id) {
 			*(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] =
 				htons(su->sin6.sin6_scope_id);

--Multipart_Fri_Jan__6_19:41:18_2012-1
Content-Type: text/plain; charset=US-ASCII


--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

--Multipart_Fri_Jan__6_19:41:18_2012-1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygesjjtyuy8.wl%ume>