Subject: ipv6 link-local multicast problems
To: None <tech-net@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-net
Date: 11/05/2003 21:07:41
This is a multipart MIME message.

--==_Exmh_11601758067200
Content-Type: text/plain; charset=us-ascii


Hi -
I was testing some exciting features of current NTP4, namely
public-key-authenticated IPv6 multicasts, and found that
multicasting works well with site-local addresses, but doesn't
with link-local ones.

One problem is that the IPV6_JOIN_GROUP sockopt doesn't work if
the "interface" parameter is left to zero (which means that the
kernel ought to pick one itself). The appended patch fixes it.
(The effect is easily verified by ifmcstat(8).)

A more complicated issue is where to bind(2) to: In theory, the
user is supposed to pass an sin6_scope_id pointing to the interface
to use. In the link-local-multicast case, this leads to an
inconsistency: IPV6_JOIN_GROUP has a notion of "pick yourself",
but the bind(), which has to happen before, has not. This means
that the "pick yourself" option of IPV6_JOIN_GROUP is quite useless,
if one doesn't just use an in6addr_any socket.
I haven't found any RFC considering this case.
Any clues?

The other patch I'll append fixes link-local multicast address
display in netstat(1).

best regards
Matthias



--==_Exmh_11601758067200
Content-Type: text/plain ; name="join.txt"; charset=us-ascii
Content-Description: join.txt
Content-Disposition: attachment; filename="join.txt"

--- ip6_output.c.~1.72.~	Thu Oct 30 20:12:41 2003
+++ ip6_output.c	Wed Nov  5 19:40:21 2003
@@ -1843,7 +1843,7 @@ ip6_setmoptions(optname, im6op, m)
 		 */
 		if (IN6_IS_ADDR_MC_LINKLOCAL(&mreq->ipv6mr_multiaddr)) {
 			mreq->ipv6mr_multiaddr.s6_addr16[1] =
-			    htons(mreq->ipv6mr_interface);
+			    htons(ifp->if_index);
 		}
 		/*
 		 * See if the membership already exists.

--==_Exmh_11601758067200
Content-Type: text/plain ; name="netstat.txt"; charset=us-ascii
Content-Description: netstat.txt
Content-Disposition: attachment; filename="netstat.txt"

--- inet6.c.~1.30.~	Fri Sep 12 13:45:41 2003
+++ inet6.c	Wed Nov  5 20:00:13 2003
@@ -1229,7 +1229,8 @@ inet6name(in6p)
 		sin6.sin6_family = AF_INET6;
 		sin6.sin6_addr = *in6p;
 #ifdef __KAME__
-		if (IN6_IS_ADDR_LINKLOCAL(in6p)) {
+		if (IN6_IS_ADDR_LINKLOCAL(in6p)
+		    || IN6_IS_ADDR_MC_LINKLOCAL(in6p)) {
 			sin6.sin6_scope_id =
 				ntohs(*(u_int16_t *)&in6p->s6_addr[2]);
 			sin6.sin6_addr.s6_addr[2] = 0;

--==_Exmh_11601758067200--