diff --git a/etc/rc.d/network b/etc/rc.d/network index 7a40b4b1aae1..50b47c5f74c0 100755 --- a/etc/rc.d/network +++ b/etc/rc.d/network @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: network,v 1.76 2018/10/23 09:25:33 mrg 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 @@ -447,10 +455,9 @@ network_start_ipv6_autoconf() network_wait_dad() { - # Wait for the DAD flags to clear form all addresses. + # Wait for the DAD flags to clear from all addresses. if [ -n "$ifconfig_wait_dad_flags" ]; then - echo 'Waiting for DAD to complete for' \ - 'statically configured addresses...' + echo "Waiting for duplicate address detection to finish..." ifconfig $ifconfig_wait_dad_flags fi } diff --git a/share/man/man5/ifconfig.if.5 b/share/man/man5/ifconfig.if.5 index ecf274c217d1..978687f12a8d 100644 --- a/share/man/man5/ifconfig.if.5 +++ b/share/man/man5/ifconfig.if.5 @@ -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.20 2020/04/17 13:36:48 kim Exp $ .\" .\" Copyright (c) 1996 Matthew R. Green .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 18, 2014 +.Dd April 15, 2020 .Dt IFCONFIG.IF 5 .Os .Sh NAME @@ -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 diff --git a/usr.sbin/rtsold/rtsold.8 b/usr.sbin/rtsold/rtsold.8 index 7fda7dfc1bc9..374315704a97 100644 --- a/usr.sbin/rtsold/rtsold.8 +++ b/usr.sbin/rtsold/rtsold.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: rtsold.8,v 1.37 2017/10/22 18:09:33 abhinav Exp $ +.\" $NetBSD: rtsold.8,v 1.42 2020/04/17 13:36:49 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. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 12, 2014 +.Dd April 15, 2020 .Dt RTSOLD 8 .Os .\" @@ -46,8 +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: -.Bd -literal - dhcpcd -dB6T --nodhcp6 -.Ed +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 ifconfig.if 5 , +.Xr dhcpcd 8