Wed Apr 15 20:31:58 2020 UTC ()
Add an "rtsol" keyword to ifconfig.if for enabling IPv6 RS/RA


(kim)
diff -r1.77 -r1.78 src/etc/rc.d/network
diff -r1.18 -r1.19 src/share/man/man5/ifconfig.if.5
diff -r1.39 -r1.40 src/usr.sbin/rtsold/rtsold.8

cvs diff -r1.77 -r1.78 src/etc/rc.d/network (expand / switch to unified diff)

--- src/etc/rc.d/network 2020/02/22 11:52:45 1.77
+++ src/etc/rc.d/network 2020/04/15 20:31:57 1.78
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: network,v 1.77 2020/02/22 11:52:45 roy Exp $ 3# $NetBSD: network,v 1.78 2020/04/15 20:31:57 kim Exp $
4# 4#
5 5
6# PROVIDE: network 6# PROVIDE: network
7# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl 7# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl
8# BEFORE: NETWORKING 8# BEFORE: NETWORKING
9 9
10$_rc_subr_loaded . /etc/rc.subr 10$_rc_subr_loaded . /etc/rc.subr
11 11
12name="network" 12name="network"
13start_cmd="network_start" 13start_cmd="network_start"
14stop_cmd="network_stop" 14stop_cmd="network_stop"
15 15
16nl=' 16nl='
@@ -205,27 +205,28 @@ network_start_interfaces() @@ -205,27 +205,28 @@ network_start_interfaces()
205{ 205{
206 # Configure all of the network interfaces listed in $net_interfaces; 206 # Configure all of the network interfaces listed in $net_interfaces;
207 # if $auto_ifconfig is YES, grab all interfaces from ifconfig. 207 # if $auto_ifconfig is YES, grab all interfaces from ifconfig.
208 # In the following, "xxN" stands in for interface names, like "le0". 208 # In the following, "xxN" stands in for interface names, like "le0".
209 # 209 #
210 # For any interfaces that has an $ifconfig_xxN variable 210 # For any interfaces that has an $ifconfig_xxN variable
211 # associated, we break it into lines using ';' as a separator, 211 # associated, we break it into lines using ';' as a separator,
212 # then process it just like the contents of an /etc/ifconfig.xxN 212 # then process it just like the contents of an /etc/ifconfig.xxN
213 # file. 213 # file.
214 # 214 #
215 # For each line from the $ifconfig_xxN variable or the 215 # For each line from the $ifconfig_xxN variable or the
216 # /etc/ifconfig.xxN file, we ignore comments and blank lines, 216 # /etc/ifconfig.xxN file, we ignore comments and blank lines,
217 # treat lines beginning with "!" as commands to execute, treat 217 # treat lines beginning with "!" as commands to execute, treat
218 # "dhcp" as a special case to invoke dhcpcd, and for any other 218 # "dhcp" as a special case to invoke dhcpcd, treat "rtsol" as
 219 # a special case to send a router solicitation, and for any other
219 # line we run "ifconfig xxN", using each line of the file as the 220 # line we run "ifconfig xxN", using each line of the file as the
220 # arguments for a separate "ifconfig" invocation. 221 # arguments for a separate "ifconfig" invocation.
221 # 222 #
222 # In order to configure an interface reasonably, you at the very least 223 # In order to configure an interface reasonably, you at the very least
223 # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), 224 # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"),
224 # and probably a netmask (as in "netmask 0xffffffe0"). You will 225 # and probably a netmask (as in "netmask 0xffffffe0"). You will
225 # frequently need to specify a media type, as in "media UTP", for 226 # frequently need to specify a media type, as in "media UTP", for
226 # interface cards with multiple media connections that do not 227 # interface cards with multiple media connections that do not
227 # autoconfigure. See the ifconfig manual page for details. 228 # autoconfigure. See the ifconfig manual page for details.
228 # 229 #
229 # Note that /etc/ifconfig.xxN takes multiple lines. The following 230 # Note that /etc/ifconfig.xxN takes multiple lines. The following
230 # configuration is possible: 231 # configuration is possible:
231 # inet 10.1.1.1 netmask 0xffffff00 232 # inet 10.1.1.1 netmask 0xffffff00
@@ -312,26 +313,33 @@ network_start_interfaces() @@ -312,26 +313,33 @@ network_start_interfaces()
312 case "$args" in 313 case "$args" in
313 ''|"#"*|create) 314 ''|"#"*|create)
314 ;; 315 ;;
315 "!"*) 316 "!"*)
316 # Run arbitrary command in a subshell. 317 # Run arbitrary command in a subshell.
317 ( eval "${args#*!}" ) 318 ( eval "${args#*!}" )
318 ;; 319 ;;
319 dhcp) 320 dhcp)
320 if ! checkyesno dhcpcd; then 321 if ! checkyesno dhcpcd; then
321 /sbin/dhcpcd -n \ 322 /sbin/dhcpcd -n \
322 ${dhcpcd_flags} $int 323 ${dhcpcd_flags} $int
323 fi 324 fi
324 ;; 325 ;;
 326 rtsol)
 327 if ! checkyesno dhcpcd; then
 328 /sbin/sysctl -qw \
 329 net.inet6.ip6.accept_rtadv=1
 330 /sbin/dhcpcd -q6T --nodhcp6 $int
 331 fi
 332 ;;
325 *) 333 *)
326 # Pass args to ifconfig. Note 334 # Pass args to ifconfig. Note
327 # that args may contain embedded 335 # that args may contain embedded
328 # shell metacharacters, such as 336 # shell metacharacters, such as
329 # "ssid 'foo;*>bar'". We eval 337 # "ssid 'foo;*>bar'". We eval
330 # one more time so that things 338 # one more time so that things
331 # like ssid "Columbia University" work. 339 # like ssid "Columbia University" work.
332 ( 340 (
333 set -o noglob 341 set -o noglob
334 eval set -- $args 342 eval set -- $args
335 #echo >&2 "[$#] [$1] [$2] [$3]" 343 #echo >&2 "[$#] [$1] [$2] [$3]"
336 /sbin/ifconfig $int "$@" 344 /sbin/ifconfig $int "$@"
337 ) 345 )

cvs diff -r1.18 -r1.19 src/share/man/man5/ifconfig.if.5 (expand / switch to unified diff)

--- src/share/man/man5/ifconfig.if.5 2014/12/29 14:22:25 1.18
+++ src/share/man/man5/ifconfig.if.5 2020/04/15 20:31:57 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: ifconfig.if.5,v 1.18 2014/12/29 14:22:25 wiz Exp $ 1.\" $NetBSD: ifconfig.if.5,v 1.19 2020/04/15 20:31:57 kim Exp $
2.\" 2.\"
3.\" Copyright (c) 1996 Matthew R. Green 3.\" Copyright (c) 1996 Matthew R. Green
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 14.\"
@@ -84,51 +84,81 @@ Arguments with embedded shell metacharac @@ -84,51 +84,81 @@ Arguments with embedded shell metacharac
84style. 84style.
85.Pp 85.Pp
86If the line is equal to 86If the line is equal to
87.Dq dhcp , 87.Dq dhcp ,
88.Xr dhcpcd 8 88.Xr dhcpcd 8
89will be started for the interface. 89will be started for the interface.
90However, it is instead recommended that 90However, it is instead recommended that
91.Sy dhcpcd 91.Sy dhcpcd
92is set to true in 92is set to true in
93.Xr rc.conf 5 93.Xr rc.conf 5
94and any per interface configuration or restriction is done in 94and any per interface configuration or restriction is done in
95.Xr dhcpcd.conf 5 . 95.Xr dhcpcd.conf 5 .
96.Pp 96.Pp
 97If the line is equal to
 98.Dq rtsol ,
 99kernel processing of router advertisements will be enabled and an IPv6
 100router solicitation message will be sent out on the interface.
 101This is useful on networks where default routes can best be learned
 102from router advertisements.
 103However, if
 104.Sy dhcpcd
 105has been set to true in
 106.Xr rc.conf 5 ,
 107it is assumed that
 108.Xr dhcpcd 8
 109will take care of sending any necessary router solicitation messages and
 110processing received router advertisements through its configuration in
 111.Xr dhcpcd.conf 5
 112instead.
 113.Pp
97If a line is empty, or starts with 114If a line is empty, or starts with
98.Sq # , 115.Sq # ,
99the line will be ignored as comment. 116the line will be ignored as comment.
100.Pp 117.Pp
101If a line starts with 118If a line starts with
102.Sq \&! , 119.Sq \&! ,
103the rest of line will get evaluated as shell script fragment. 120the rest of line will get evaluated as shell script fragment.
104Shell variables declared in 121Shell variables declared in
105.Pa /etc/rc.d/network 122.Pa /etc/rc.d/network
106are accessible but may not be modified. 123are accessible but may not be modified.
107The most useful variable is 124The most useful variable is
108.Li $int , 125.Li $int ,
109as it will be bound to the interface being configured with the file. 126as it will be bound to the interface being configured with the file.
110.Pp 127.Pp
111For example, the following illustrates static interface configuration: 128For example, the following illustrates static interface configuration:
112.Bd -literal -offset indent 129.Bd -literal -offset indent
113# IPv4, with an alias 130# IPv4, with an alias
114inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX 131inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX
115inet 10.0.1.13 netmask 255.255.255.255 alias 132inet 10.0.1.13 netmask 255.255.255.255 alias
116# let us have IPv6 address on this interface 133# let us have IPv6 address on this interface
117inet6 2001:db8::1 prefixlen 64 alias 134inet6 2001:db8::1 prefixlen 64 alias
118# have subnet router anycast address too 135# have subnet router anycast address too
119inet6 2001:db8:: prefixlen 64 alias anycast 136inet6 2001:db8:: prefixlen 64 alias anycast
120.Ed 137.Ed
121.Pp 138.Pp
 139For networks that do not use a virtual address for the default gateway
 140that could be set using a single address in
 141.Sy defaultroute6 ,
 142static IPv6 address configuration could use the
 143.Dq rtsol
 144keyword instead to solicit router advertisements for learning a default
 145route and even achieving route redundancy given multiple responding
 146routers:
 147.Bd -literal -offset indent
 148inet6 2001:db8::100 prefixlen 64 alias
 149rtsol
 150.Ed
 151.Pp
122The following example sets a network name for a wireless interface 152The following example sets a network name for a wireless interface
123(using quotes to protect special characters in the name), 153(using quotes to protect special characters in the name),
124and starts 154and starts
125.Xr dhcpcd 8 : 155.Xr dhcpcd 8 :
126.Bd -literal -offset indent 156.Bd -literal -offset indent
127ssid 'my network' 157ssid 'my network'
128dhcp 158dhcp
129.Ed 159.Ed
130.Pp 160.Pp
131The following example is for dynamically-created pseudo interfaces like 161The following example is for dynamically-created pseudo interfaces like
132.Xr gif 4 . 162.Xr gif 4 .
133Earlier versions of 163Earlier versions of
134.Pa /etc/rc.d/network 164.Pa /etc/rc.d/network

cvs diff -r1.39 -r1.40 src/usr.sbin/rtsold/rtsold.8 (expand / switch to unified diff)

--- src/usr.sbin/rtsold/rtsold.8 2020/04/13 20:44:39 1.39
+++ src/usr.sbin/rtsold/rtsold.8 2020/04/15 20:31:58 1.40
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: rtsold.8,v 1.39 2020/04/13 20:44:39 wiz Exp $ 1.\" $NetBSD: rtsold.8,v 1.40 2020/04/15 20:31:58 kim Exp $
2.\" $KAME: rtsold.8,v 1.17 2001/07/09 22:30:37 itojun Exp $ 2.\" $KAME: rtsold.8,v 1.17 2001/07/09 22:30:37 itojun Exp $
3.\" 3.\"
4.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5.\" All rights reserved. 5.\" All rights reserved.
6.\" 6.\"
7.\" Redistribution and use in source and binary forms, with or without 7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions 8.\" modification, are permitted provided that the following conditions
9.\" are met: 9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright 10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer. 11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the 13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution. 14.\" documentation and/or other materials provided with the distribution.
@@ -36,20 +36,33 @@ @@ -36,20 +36,33 @@
36.Nm rtsold , 36.Nm rtsold ,
37.Nm rtsol 37.Nm rtsol
38.Nd router solicitation daemon 38.Nd router solicitation daemon
39.\" 39.\"
40.Sh DESCRIPTION 40.Sh DESCRIPTION
41.Nm 41.Nm
42and 42and
43.Nm rtsol 43.Nm rtsol
44have been removed from 44have been removed from
45.Nx 45.Nx
46as their functionality is now included in 46as their functionality is now included in
47.Xr dhcpcd 8 . 47.Xr dhcpcd 8 .
48.Pp 48.Pp
49For example to send a routing solicitation message and print information 49For example to send a router solicitation message and print information
50about it without changing the actual routing table: 50about the response without changing the actual routing table:
51.Pp 51.Pp
52.Dl dhcpcd -dB6T --nodhcp6 < Ns Ar interface Ns \^> 52.Dl dhcpcd -dB6T --nodhcp6 < Ns Ar interface Ns \^>
 53.Pp
 54To quietly send a router solicitation message:
 55.Pp
 56.Dl dhcpcd -q6T --nodhcp6 < Ns Ar interface Ns \^>
 57.Pp
 58The
 59.Xr ifconfig.if 5
 60network interface configuration files and variables can also use an
 61.Dq rtsol
 62keyword to invoke
 63.Xr dhcpcd 8
 64to send a router solicitation message, without running it as daemon.
53.\" 65.\"
54.Sh SEE ALSO 66.Sh SEE ALSO
55.Xr dhcpcd 8 67.Xr dhcpcd 8 ,
 68.Xr ifconfig.if 5