svn commit: r222693 - user/hrs/ipv6/usr.sbin/rtadvd

Hiroki Sato hrs at FreeBSD.org
Sat Jun 4 17:22:44 UTC 2011


Author: hrs
Date: Sat Jun  4 17:22:43 2011
New Revision: 222693
URL: http://svn.freebsd.org/changeset/base/222693

Log:
  "noonlinkprefix" directive has been added.  This disables gathering on-link
  prefixes from the kernel's routing table.  A rtadvd.conf with "noonlinkprefix"
  + no "addr" generates an RA message with no prefix information option.
  
  PR:	bin/152458

Modified:
  user/hrs/ipv6/usr.sbin/rtadvd/config.c
  user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.conf.5
  user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.h

Modified: user/hrs/ipv6/usr.sbin/rtadvd/config.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/config.c	Sat Jun  4 16:42:51 2011	(r222692)
+++ user/hrs/ipv6/usr.sbin/rtadvd/config.c	Sat Jun  4 17:22:43 2011	(r222693)
@@ -185,6 +185,12 @@ getconfig(char *intface)
 		if ((forwarding = getinet6sysctl(IPV6CTL_FORWARDING)) < 0)
 			exit(1);
 
+	/* gather on-link prefixes from the kernel or not. */
+	if (agetflag("noonlinkprefix"))
+		rai->rai_advonlinkprefix = 0;
+	else
+		rai->rai_advonlinkprefix = 1;
+
 	/* get interface information */
 	if (agetflag("nolladdr"))
 		rai->rai_advlinkopt = 0;
@@ -433,7 +439,7 @@ getconfig(char *intface)
 			    now.tv_sec + pfx->pfx_preflifetime;
 		}
 	}
-	if (rai->rai_pfxs == 0)
+	if (rai->rai_advonlinkprefix && rai->rai_pfxs == 0)
 		get_prefix(rai);
 
 	MAYHAVE(val, "mtu", 0);

Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.conf.5
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.conf.5	Sat Jun  4 16:42:51 2011	(r222692)
+++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.conf.5	Sat Jun  4 17:22:43 2011	(r222693)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 28, 2011
+.Dd June 4, 2011
 .Dt RTADVD.CONF 5
 .Os
 .Sh NAME
@@ -179,10 +179,25 @@ will automatically get appropriate prefi
 and advertise the prefixes with the default parameters.
 Keywords other than
 .Cm clockskew
+and
+.Cm noonlinkprefix
 can be augmented with a number, like
 .Dq Li prefix2 ,
 to specify multiple prefixes.
 .Bl -tag -width indent
+.It Cm \&noonlinkprefix
+(bool) Specifies no prefix in the kernel will be advertised.
+By default
+.Nm rtadvd
+automatically obtains valid and on-link prefixes from the kernel's routing
+table.
+The
+.Cm noonlinkprefix
+disables that behavior.
+If this is specified and no
+.Cm addr
+keyword is specified, no prefix information option will be included in the
+message.
 .It Cm \&clockskew
 (num) Time skew to adjust link propagation delays and clock skews
 between routers on the link

Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.h
==============================================================================
--- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.h	Sat Jun  4 16:42:51 2011	(r222692)
+++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.h	Sat Jun  4 17:22:43 2011	(r222693)
@@ -185,6 +185,7 @@ struct	rainfo {
 	/* interface information */
 	int	rai_ifindex;
 	int	rai_advlinkopt;	/* bool: whether include link-layer addr opt */
+	int	rai_advonlinkprefix;	/* bool: gather on-link prefixes? */
 	struct sockaddr_dl *rai_sdl;
 	char	rai_ifname[IFNAMSIZ];
 	u_int32_t	rai_phymtu;	/* mtu of the physical interface */


More information about the svn-src-user mailing list