Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Apr 2007 23:02:42 +0900
From:      JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <jinmei@isl.rdc.toshiba.co.jp>
To:        Andrew McDonald <andrew@mcdonald.org.uk>
Cc:        freebsd-net@freebsd.org
Subject:   Re: IPv6 Router Alert breaks forwarding
Message-ID:  <m11wiyq5q5.wl%jinmei@isl.rdc.toshiba.co.jp>
In-Reply-To: <20070405081639.GB6798@mcdonald.org.uk>
References:  <20070404211815.GA6798@mcdonald.org.uk> <m1d52jpd5c.wl%jinmei@isl.rdc.toshiba.co.jp> <20070405081639.GB6798@mcdonald.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
At Thu, 5 Apr 2007 09:16:39 +0100,
Andrew McDonald <andrew@mcdonald.org.uk> wrote:

> Thinking about it a bit, there is a simple fix that leaves MLD working
> (but currently doesn't provide a way for other applications to use
> router alert). The IPv6 Router Alert Option (RAO) has a 16-bit value
> field. For MLD this is zero. Other uses would contain different values
> (as per RFC2711).
> 
> rtalert contains the contents of this value field, or (u_int32_t)~0 if
> there is no router alert option. So, if we change the check to:
> 	/*
> 	 * accept the packet if a router alert option with value 0
> 	 * is included and we act as an IPv6 router.
> 	 */
> 	if (rtalert == 0 && ip6_forwarding)
> 		ours = 1;
> we'll only pick up packets containing ipv6 router alerts with value 0
> (i.e. MLD router alerted packets).

The behavior looks reasonable, but I'd code it more explicitly with
some comments so that the intent is clear and others can correctly
modify it for future extensions.  A possible patch to implement it is
pasted below.  One thing I'm not really sure is whether someone is
using (or has used) other predefined alert values:

         1        Datagram contains RSVP message.
         2        Datagram contains an Active Networks message.

(I guess you're now going to use values 3-35 per RFC3175).

If there is a user, we need to be careful not to break compatibility.

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					jinmei@isl.rdc.toshiba.co.jp

Index: ip6_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.90
diff -u -r1.90 ip6_input.c
--- ip6_input.c	24 Feb 2007 11:38:47 -0000	1.90
+++ ip6_input.c	5 Apr 2007 13:57:21 -0000
@@ -657,11 +657,25 @@
 		nxt = hbh->ip6h_nxt;
 
 		/*
-		 * accept the packet if a router alert option is included
-		 * and we act as an IPv6 router.
+		 * If we are acting as a router and the packet contains a
+		 * router alert option, see if we know the option value.
+		 * Currently, we only support the option value for MLD, in which
+		 * case we should pass the packet to the multicast routing
+		 * daemon.
 		 */
-		if (rtalert != ~0 && ip6_forwarding)
-			ours = 1;
+		if (rtalert != ~0 && ip6_forwarding) {
+			switch (rtalert) {
+			case IP6OPT_RTALERT_MLD: 
+				ours = 1;
+				break;
+			default:
+				/*
+				 * RFC2711 requires unrecognized values must be
+				 * silently ignored.
+				 */
+				break;
+			}
+		}
 	} else
 		nxt = ip6->ip6_nxt;
 



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