Module Name:    src
Committed By:   kim
Date:           Wed Apr 15 20:31:58 UTC 2020

Modified Files:
        src/etc/rc.d: network
        src/share/man/man5: ifconfig.if.5
        src/usr.sbin/rtsold: rtsold.8

Log Message:
Add an "rtsol" keyword to ifconfig.if for enabling IPv6 RS/RA


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/etc/rc.d/network
cvs rdiff -u -r1.18 -r1.19 src/share/man/man5/ifconfig.if.5
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/rtsold/rtsold.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.77 src/etc/rc.d/network:1.78
--- src/etc/rc.d/network:1.77	Sat Feb 22 11:52:45 2020
+++ src/etc/rc.d/network	Wed Apr 15 20:31:57 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.77 2020/02/22 11:52:45 roy Exp $
+# $NetBSD: network,v 1.78 2020/04/15 20:31:57 kim Exp $
 #
 
 # PROVIDE: network
@@ -215,7 +215,8 @@ network_start_interfaces()
 	# For each line from the $ifconfig_xxN variable or the
 	# /etc/ifconfig.xxN file, we ignore comments and blank lines,
 	# treat lines beginning with "!" as commands to execute, treat
-	# "dhcp" as a special case to invoke dhcpcd, and for any other
+	# "dhcp" as a special case to invoke dhcpcd, treat "rtsol" as
+	# a special case to send a router solicitation, and for any other
 	# line we run "ifconfig xxN", using each line of the file as the
 	# arguments for a separate "ifconfig" invocation.
 	#
@@ -322,6 +323,13 @@ network_start_interfaces()
 						${dhcpcd_flags} $int
 				fi
 				;;
+			rtsol)
+				if ! checkyesno dhcpcd; then
+					/sbin/sysctl -qw \
+						net.inet6.ip6.accept_rtadv=1
+					/sbin/dhcpcd -q6T --nodhcp6 $int
+				fi
+				;;
 			*)
 				# Pass args to ifconfig.  Note
 				# that args may contain embedded

Index: src/share/man/man5/ifconfig.if.5
diff -u src/share/man/man5/ifconfig.if.5:1.18 src/share/man/man5/ifconfig.if.5:1.19
--- src/share/man/man5/ifconfig.if.5:1.18	Mon Dec 29 14:22:25 2014
+++ src/share/man/man5/ifconfig.if.5	Wed Apr 15 20:31:57 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.if.5,v 1.18 2014/12/29 14:22:25 wiz Exp $
+.\"	$NetBSD: ifconfig.if.5,v 1.19 2020/04/15 20:31:57 kim Exp $
 .\"
 .\" Copyright (c) 1996 Matthew R. Green
 .\" All rights reserved.
@@ -94,6 +94,23 @@ is set to true in
 and any per interface configuration or restriction is done in
 .Xr dhcpcd.conf 5 .
 .Pp
+If the line is equal to
+.Dq rtsol ,
+kernel processing of router advertisements will be enabled and an IPv6
+router solicitation message will be sent out on the interface.
+This is useful on networks where default routes can best be learned
+from router advertisements.
+However, if
+.Sy dhcpcd
+has been set to true in
+.Xr rc.conf 5 ,
+it is assumed that
+.Xr dhcpcd 8
+will take care of sending any necessary router solicitation messages and
+processing received router advertisements through its configuration in
+.Xr dhcpcd.conf 5
+instead.
+.Pp
 If a line is empty, or starts with
 .Sq # ,
 the line will be ignored as comment.
@@ -119,6 +136,19 @@ inet6 2001:db8::1 prefixlen 64 alias
 inet6 2001:db8:: prefixlen 64 alias anycast
 .Ed
 .Pp
+For networks that do not use a virtual address for the default gateway
+that could be set using a single address in
+.Sy defaultroute6 ,
+static IPv6 address configuration could use the
+.Dq rtsol
+keyword instead to solicit router advertisements for learning a default
+route and even achieving route redundancy given multiple responding
+routers:
+.Bd -literal -offset indent
+inet6 2001:db8::100 prefixlen 64 alias
+rtsol
+.Ed
+.Pp
 The following example sets a network name for a wireless interface
 (using quotes to protect special characters in the name),
 and starts

Index: src/usr.sbin/rtsold/rtsold.8
diff -u src/usr.sbin/rtsold/rtsold.8:1.39 src/usr.sbin/rtsold/rtsold.8:1.40
--- src/usr.sbin/rtsold/rtsold.8:1.39	Mon Apr 13 20:44:39 2020
+++ src/usr.sbin/rtsold/rtsold.8	Wed Apr 15 20:31:58 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rtsold.8,v 1.39 2020/04/13 20:44:39 wiz Exp $
+.\"	$NetBSD: rtsold.8,v 1.40 2020/04/15 20:31:58 kim Exp $
 .\"	$KAME: rtsold.8,v 1.17 2001/07/09 22:30:37 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -46,10 +46,23 @@ have been removed from
 as their functionality is now included in
 .Xr dhcpcd 8 .
 .Pp
-For example to send a routing solicitation message and print information
-about it without changing the actual routing table:
+For example to send a router solicitation message and print information
+about the response without changing the actual routing table:
 .Pp
 .Dl dhcpcd -dB6T --nodhcp6 < Ns Ar interface Ns \^>
+.Pp
+To quietly send a router solicitation message:
+.Pp
+.Dl dhcpcd -q6T --nodhcp6 < Ns Ar interface Ns \^>
+.Pp
+The
+.Xr ifconfig.if 5
+network interface configuration files and variables can also use an
+.Dq rtsol
+keyword to invoke
+.Xr dhcpcd 8
+to send a router solicitation message, without running it as daemon.
 .\"
 .Sh SEE ALSO
-.Xr dhcpcd 8
+.Xr dhcpcd 8 ,
+.Xr ifconfig.if 5

Reply via email to