Sat Sep 20 12:12:38 2008 UTC ()
* Allow multiple commands in $ifconfig_xxN variables in rc.conf(5).
  This may be done either by embedding newlines in the value,
  or by using semicolons to represent line breaks (but not both at once).
* Allow shell quoting insode $ifconfig_xxN variables or /etc/ifconfig.xxN
  files.  This allows something like ifconfig_wi0="ssid 'my network'; dhcp"


(apb)
diff -r1.1122 -r1.1123 src/doc/CHANGES
diff -r1.53 -r1.54 src/etc/rc.d/network
diff -r1.10 -r1.11 src/share/man/man5/ifconfig.if.5
diff -r1.119 -r1.120 src/share/man/man5/rc.conf.5

cvs diff -r1.1122 -r1.1123 src/doc/CHANGES (expand / switch to unified diff)

--- src/doc/CHANGES 2008/09/19 21:44:13 1.1122
+++ src/doc/CHANGES 2008/09/20 12:12:38 1.1123
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1122 $> 1# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1123 $>
2# 2#
3# 3#
4# [Note: This file does not mention every change made to the NetBSD source tree. 4# [Note: This file does not mention every change made to the NetBSD source tree.
5# For an exhaustive list, please subscribe to the `source-changes' mailing list, 5# For an exhaustive list, please subscribe to the `source-changes' mailing list,
6# or see the mailing list archives. For more information, send a message 6# or see the mailing list archives. For more information, send a message
7# containing just the word `help' to `majordomo@NetBSD.org'.] 7# containing just the word `help' to `majordomo@NetBSD.org'.]
8# 8#
9# ---------------------------------------------------------------------------- 9# ----------------------------------------------------------------------------
10# PLEASE USE THE FOLLOWING STYLE WHEN ADDING ITEMS: 10# PLEASE USE THE FOLLOWING STYLE WHEN ADDING ITEMS:
11# 11#
12# theme: Content ... 12# theme: Content ...
13# more content ... 13# more content ...
14# more content. [developer DATE-FORMAT] 14# more content. [developer DATE-FORMAT]
@@ -865,13 +865,17 @@ Changes from NetBSD 4.0 to NetBSD 5.0: @@ -865,13 +865,17 @@ Changes from NetBSD 4.0 to NetBSD 5.0:
865 instead. [apb 20080914] 865 instead. [apb 20080914]
866 postinstall(8): Deprecate the "-s tgz1:tgz2" option; please use 866 postinstall(8): Deprecate the "-s tgz1:tgz2" option; please use
867 "-s tgz1 -s tgz2" instead. [apb 20080914] 867 "-s tgz1 -s tgz2" instead. [apb 20080914]
868 ataraid(4): Add support for status reports via bio(4) contributed 868 ataraid(4): Add support for status reports via bio(4) contributed
869 by Juan RP. [tron 20080915] 869 by Juan RP. [tron 20080915]
870 gem(4): Add support for Sun SBus SX fibre cards. [jdc 20080915] 870 gem(4): Add support for Sun SBus SX fibre cards. [jdc 20080915]
871 ataraid(4): Add support for multiple volumes attached to 871 ataraid(4): Add support for multiple volumes attached to
872 Intel MatrixRAID controllers contributed by Juan RP. 872 Intel MatrixRAID controllers contributed by Juan RP.
873 [tron 20080916] 873 [tron 20080916]
874 patch(1): Merge improved version from DragonFly. 874 patch(1): Merge improved version from DragonFly.
875 patch -b behaves as specified by POSIX. [joerg 20080919] 875 patch -b behaves as specified by POSIX. [joerg 20080919]
876 am-utils: Upgrade to 6.2a3 to add new fs flags (log,symperm,...) 876 am-utils: Upgrade to 6.2a3 to add new fs flags (log,symperm,...)
877 and efs and tmpfs. 877 and efs and tmpfs.
 878 rc.conf(5): ifconfig_xxN variables may now have multi-line
 879 values, just like /etc/ifconfig.xxN files, and
 880 semicolons may be used instead of line breaks.
 881 [apb 20080920]

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

--- src/etc/rc.d/network 2008/07/24 19:48:19 1.53
+++ src/etc/rc.d/network 2008/09/20 12:12:38 1.54
@@ -1,28 +1,31 @@ @@ -1,28 +1,31 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: network,v 1.53 2008/07/24 19:48:19 reed Exp $ 3# $NetBSD: network,v 1.54 2008/09/20 12:12:38 apb 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='
 17' # a newline
 18
16network_start() 19network_start()
17{ 20{
18 # set hostname, turn on network 21 # set hostname, turn on network
19 # 22 #
20 echo "Starting network." 23 echo "Starting network."
21 24
22 # If $hostname is set, use it for my Internet name, 25 # If $hostname is set, use it for my Internet name,
23 # otherwise use /etc/myname 26 # otherwise use /etc/myname
24 # 27 #
25 if [ -z "$hostname" ] && [ -f /etc/myname ]; then 28 if [ -z "$hostname" ] && [ -f /etc/myname ]; then
26 hostname=$(cat /etc/myname) 29 hostname=$(cat /etc/myname)
27 fi 30 fi
28 if [ -n "$hostname" ]; then 31 if [ -n "$hostname" ]; then
@@ -145,32 +148,38 @@ network_start() @@ -145,32 +148,38 @@ network_start()
145 host)  148 host)
146 echo 'IPv6 mode: host' 149 echo 'IPv6 mode: host'
147 ;; 150 ;;
148 151
149 *) warn "invalid \$ip6mode value "\"$ip6mode\" 152 *) warn "invalid \$ip6mode value "\"$ip6mode\"
150 ;; 153 ;;
151 154
152 esac 155 esac
153 fi 156 fi
154 157
155 # Configure all of the network interfaces listed in $net_interfaces; 158 # Configure all of the network interfaces listed in $net_interfaces;
156 # if $auto_ifconfig is YES, grab all interfaces from ifconfig. 159 # if $auto_ifconfig is YES, grab all interfaces from ifconfig.
157 # In the following, "xxN" stands in for interface names, like "le0". 160 # In the following, "xxN" stands in for interface names, like "le0".
158 # For any interfaces that has an $ifconfig_xxN variable associated, 161 #
159 # we do "ifconfig xxN $ifconfig_xxN". 162 # For any interfaces that has an $ifconfig_xxN variable
160 # If there is no such variable, we take the contents of the file 163 # associated, we break it into lines using ';' as a separator,
161 # /etc/ifconfig.xxN, and run "ifconfig xxN" repeatedly, using each 164 # then process it just like the contents of an /etc/ifconfig.xxN
162 # line of the file as the arguments for a separate "ifconfig" 165 # file.
163 # invocation. 166 #
 167 # For each line from the $ifconfig_xxN variable or the
 168 # /etc/ifconfig.xxN file, we ignore comments and blank lines,
 169 # treat lines beginning with "!" as commands to execute, treat
 170 # "dhcp" as a special case to invoke dhcpcd, and for any other
 171 # line we run "ifconfig xxN", using each line of the file as the
 172 # arguments for a separate "ifconfig" invocation.
164 # 173 #
165 # In order to configure an interface reasonably, you at the very least 174 # In order to configure an interface reasonably, you at the very least
166 # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), 175 # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"),
167 # and probably a netmask (as in "netmask 0xffffffe0"). You will 176 # and probably a netmask (as in "netmask 0xffffffe0"). You will
168 # frequently need to specify a media type, as in "media UTP", for 177 # frequently need to specify a media type, as in "media UTP", for
169 # interface cards with multiple media connections that do not 178 # interface cards with multiple media connections that do not
170 # autoconfigure. See the ifconfig manual page for details. 179 # autoconfigure. See the ifconfig manual page for details.
171 # 180 #
172 # Note that /etc/ifconfig.xxN takes multiple lines. The following 181 # Note that /etc/ifconfig.xxN takes multiple lines. The following
173 # configuration is possible: 182 # configuration is possible:
174 # inet 10.1.1.1 netmask 0xffffff00 183 # inet 10.1.1.1 netmask 0xffffff00
175 # inet 10.1.1.2 netmask 0xffffff00 alias 184 # inet 10.1.1.2 netmask 0xffffff00 alias
176 # inet6 2001:db8::1 prefixlen 64 alias 185 # inet6 2001:db8::1 prefixlen 64 alias
@@ -182,68 +191,107 @@ network_start() @@ -182,68 +191,107 @@ network_start()
182 if checkyesno auto_ifconfig; then 191 if checkyesno auto_ifconfig; then
183 tmp=$(/sbin/ifconfig -l) 192 tmp=$(/sbin/ifconfig -l)
184 for cloner in $(/sbin/ifconfig -C 2>/dev/null); do 193 for cloner in $(/sbin/ifconfig -C 2>/dev/null); do
185 for int in /etc/ifconfig.${cloner}[0-9]*; do 194 for int in /etc/ifconfig.${cloner}[0-9]*; do
186 [ ! -f $int ] && break 195 [ ! -f $int ] && break
187 tmp="$tmp ${int##*.}" 196 tmp="$tmp ${int##*.}"
188 done 197 done
189 done 198 done
190 else 199 else
191 tmp="$net_interfaces" 200 tmp="$net_interfaces"
192 fi 201 fi
193 echo -n 'Configuring network interfaces:' 202 echo -n 'Configuring network interfaces:'
194 for int in $tmp; do 203 for int in $tmp; do
195 eval args=\$ifconfig_$int 204 eval argslist=\$ifconfig_$int
196 if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then 205
197 if /sbin/ifconfig $int create 2>/dev/null && \ 206 # Skip interfaces that do not have explicit
198 checkyesno ipfilter; then 207 # configuration information. If auto_ifconfig is
199 # resync ipf(4) 208 # false then also warn about such interfaces.
200 /sbin/ipf -y >/dev/null 209 #
201 fi 210 if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ]
202 fi 211 then
203 if [ "$args" = "dhcp" ]; then 
204 echo -n " $int" 
205 /sbin/dhcpcd -n ${dhcpcd_flags} $int 
206 elif [ -n "$args" ]; then 
207 echo -n " $int" 
208 /sbin/ifconfig $int $args 
209 elif [ -f /etc/ifconfig.$int ]; then 
210 echo -n " $int" 
211 while read args; do 
212 [ -z "$args" ] && continue 
213 case "$args" in 
214 "#"*|create) 
215 ;; 
216 "!"*) 
217 eval ${args#*!} 
218 ;; 
219 dhcp) 
220 /sbin/dhcpcd -n ${dhcpcd_flags} \ 
221 $int 
222 ;; 
223 *) 
224 eval /sbin/ifconfig $int $args 
225 ;; 
226 esac 
227 done < /etc/ifconfig.$int 
228 else 
229 if ! checkyesno auto_ifconfig; then 212 if ! checkyesno auto_ifconfig; then
230 echo 213 echo
231 warn \ 214 warn \
232 "/etc/ifconfig.$int missing and ifconfig_$int not set;" 215 "/etc/ifconfig.$int missing and ifconfig_$int not set;"
233 warn "interface $int not configured." 216 warn "interface $int not configured."
234 fi 217 fi
235 continue 218 continue
236 fi 219 fi
 220
 221 echo -n " $int"
 222
 223 # Create the interface if necessary.
 224 # If the interface did not exist before,
 225 # then also resync ipf(4).
 226 #
 227 if /sbin/ifconfig $int create 2>/dev/null && \
 228 checkyesno ipfilter; then
 229 /sbin/ipf -y >/dev/null
 230 fi
 231
 232 # If $ifconfig_xxN is empty, then use
 233 # /etc/ifconfig.xxN, which we know exists due to
 234 # an earlier test.
 235 #
 236 # If $ifconfig_xxN is non-empty and contains a
 237 # newline, then just use it as is. (This allows
 238 # semicolons through unmolested.)
 239 #
 240 # If $ifconfig_xxN is non-empty and does not
 241 # contain a newline, then convert all semicolons
 242 # to newlines.
 243 #
 244 case "$argslist" in
 245 '')
 246 cat /etc/ifconfig.$int
 247 ;;
 248 *"${nl}"*)
 249 echo "$argslist"
 250 ;;
 251 *)
 252 (
 253 set -o noglob
 254 IFS=';'; set -- $argslist
 255 #echo >&2 "[$#] [$1] [$2] [$3] [$4]"
 256 IFS="$nl"; echo "$*"
 257 )
 258 ;;
 259 esac |
 260 while read -r args; do
 261 case "$args" in
 262 ''|"#"*|create)
 263 ;;
 264 "!"*)
 265 # Run arbitrary command in a subshell.
 266 ( eval "${args#*!}" )
 267 ;;
 268 dhcp)
 269 /sbin/dhcpcd -n ${dhcpcd_flags} $int
 270 ;;
 271 *)
 272 # Pass args to ifconfig. Note
 273 # that args may contain embedded
 274 # shell metacharacters, such as
 275 # "ssid 'foo;*>bar'".
 276 (
 277 set -o noglob
 278 eval set -- "$args"
 279 #echo >&2 "[$#] [$1] [$2] [$3]"
 280 /sbin/ifconfig $int "$@"
 281 )
 282 ;;
 283 esac
 284 done
237 configured_interfaces="$configured_interfaces $int" 285 configured_interfaces="$configured_interfaces $int"
238 done 286 done
239 echo "." 287 echo "."
240 fi 288 fi
241 289
242 # Check $defaultroute, then /etc/mygate, for the name or address 290 # Check $defaultroute, then /etc/mygate, for the name or address
243 # of my IPv4 gateway host. If using a name, that name must be in 291 # of my IPv4 gateway host. If using a name, that name must be in
244 # /etc/hosts. 292 # /etc/hosts.
245 # 293 #
246 if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then 294 if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then
247 defaultroute=$(cat /etc/mygate) 295 defaultroute=$(cat /etc/mygate)
248 fi 296 fi
249 if [ -n "$defaultroute" ]; then 297 if [ -n "$defaultroute" ]; then
@@ -264,56 +312,56 @@ network_start() @@ -264,56 +312,56 @@ network_start()
264 warn \ 312 warn \
265 "ip6mode is set to 'autohost' and a v6 default route is also set." 313 "ip6mode is set to 'autohost' and a v6 default route is also set."
266 fi 314 fi
267 /sbin/route add -inet6 default $defaultroute6 315 /sbin/route add -inet6 default $defaultroute6
268 fi 316 fi
269 317
270 echo -n "Adding interface aliases:" 318 echo -n "Adding interface aliases:"
271 319
272 # Check if each configured interface xxN has an $ifaliases_xxN variable 320 # Check if each configured interface xxN has an $ifaliases_xxN variable
273 # associated, then configure additional IP addresses for that interface. 321 # associated, then configure additional IP addresses for that interface.
274 # The variable contains a list of "address netmask" pairs, with 322 # The variable contains a list of "address netmask" pairs, with
275 # "netmask" set to "-" if the interface default netmask is to be used. 323 # "netmask" set to "-" if the interface default netmask is to be used.
276 # 324 #
277 # Note that $ifaliases_xxN works only with certain configurations and 325 # Note that $ifaliases_xxN works only in certain cases and its
278 # considered not recommended. Use /etc/ifconfig.xxN if possible. 326 # use is not recommended. Use /etc/ifconfig.xxN or multiple
279 #  327 # commands in $ifconfig_xxN instead.
280 # 328 #
281 for int in lo0 $configured_interfaces; do 329 for int in lo0 $configured_interfaces; do
282 eval args=\$ifaliases_$int 330 eval args=\$ifaliases_$int
283 if [ -n "$args" ]; then 331 if [ -n "$args" ]; then
284 set -- $args 332 set -- $args
285 while [ $# -ge 2 ]; do 333 while [ $# -ge 2 ]; do
286 addr=$1 ; net=$2 ; shift 2 334 addr=$1 ; net=$2 ; shift 2
287 if [ "$net" = "-" ]; then 335 if [ "$net" = "-" ]; then
288 # for compatibility only, obsolete 336 # for compatibility only, obsolete
289 /sbin/ifconfig $int inet alias $addr 337 /sbin/ifconfig $int inet alias $addr
290 else 338 else
291 /sbin/ifconfig $int inet alias $addr \ 339 /sbin/ifconfig $int inet alias $addr \
292 netmask $net 340 netmask $net
293 fi 341 fi
294 echo -n " $int:$addr" 342 echo -n " $int:$addr"
295 done 343 done
296 fi 344 fi
297 done 345 done
298 346
299 # /etc/ifaliases, if it exists, contains the names of additional IP 347 # /etc/ifaliases, if it exists, contains the names of additional IP
300 # addresses for each interface. It is formatted as a series of lines 348 # addresses for each interface. It is formatted as a series of lines
301 # that contain 349 # that contain
302 # address interface netmask 350 # address interface netmask
303 # 351 #
304 # Note that /etc/ifaliases works only with certain cases only and its 352 # Note that /etc/ifaliases works only in certain cases and its
305 # use is not recommended. Use /etc/ifconfig.xxN instead. 353 # use is not recommended. Use /etc/ifconfig.xxN or multiple
306 # 354 # commands in $ifconfig_xxN instead.
307 # 355 #
308 if [ -f /etc/ifaliases ]; then 356 if [ -f /etc/ifaliases ]; then
309 while read addr int net; do 357 while read addr int net; do
310 if [ -z "$net" ]; then 358 if [ -z "$net" ]; then
311 # for compatibility only, obsolete 359 # for compatibility only, obsolete
312 /sbin/ifconfig $int inet alias $addr 360 /sbin/ifconfig $int inet alias $addr
313 else 361 else
314 /sbin/ifconfig $int inet alias $addr netmask $net 362 /sbin/ifconfig $int inet alias $addr netmask $net
315 fi 363 fi
316 done < /etc/ifaliases 364 done < /etc/ifaliases
317 fi 365 fi
318 366
319 echo 367 echo

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

--- src/share/man/man5/ifconfig.if.5 2008/05/29 15:38:35 1.10
+++ src/share/man/man5/ifconfig.if.5 2008/09/20 12:12:38 1.11
@@ -1,79 +1,102 @@ @@ -1,79 +1,102 @@
1.\" $NetBSD: ifconfig.if.5,v 1.10 2008/05/29 15:38:35 joerg Exp $ 1.\" $NetBSD: ifconfig.if.5,v 1.11 2008/09/20 12:12:38 apb 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.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE. 25.\" SUCH DAMAGE.
26.\" 26.\"
27.Dd May 27, 2008 27.Dd September 20, 2008
28.Dt IFCONFIG.IF 5 28.Dt IFCONFIG.IF 5
29.Os 29.Os
30.Sh NAME 30.Sh NAME
31.Nm ifconfig.if 31.Nm ifconfig.if
32.Nd interface-specific configuration files 32.Nd interface-specific configuration files or variables
33.Sh DESCRIPTION 33.Sh DESCRIPTION
34The 34The
35.Nm 35.Nm
36files contain information regarding the configuration of each network interface. 36files or variables contain information regarding the configuration
 37of each network interface.
37.Nm 38.Nm
38is processed by 39is processed by
39.Pa /etc/rc.d/network 40.Pa /etc/rc.d/network
40at system boot time. 41at system boot time.
41.Pp 42.Pp
42One file should exist for each interface that is to be configured, such as 43For each interface
43.Pa /etc/ifconfig.fxp0 . 44.Pq Ar nnX
44The file will get evaluated only if the interface exists on the system. 45that is to be configured, there should be either an
45Multiple lines can be placed in a file, and will be evaluated sequentially. 46.Sy ifconfig_nnX
 47variable in
 48.Xr rc.conf 5 ,
 49or an
 50.Pa /etc/ifconfig.nnX
 51file
 52(such as the
 53.Sy ifconfig_fxp0
 54variable or the
 55.Pa /etc/ifconfig.fxp0
 56file for the
 57.Sy fxp0
 58interface).
 59The variable or file will get evaluated only if the interface exists on
 60the system.
 61Multiple lines can be placed in a variable or file, and will be
 62evaluated sequentially.
 63In the case of a variable, semicolons may be used instead of
 64newlines, as described in
 65.Xr rc.conf 5 .
46.Pp 66.Pp
47Normally, a line will be evaluated as command line arguments to 67Normally, a line will be evaluated as command line arguments to
48.Xr ifconfig 8 . 68.Xr ifconfig 8 .
49.Dq Li ifconfig if 69.Dq Li ifconfig Ar nnX
50will be prepended on evaluation. 70will be prepended on evaluation.
 71Arguments with embedded shell metacharacters should be quoted in
 72.Xr sh 1
 73style.
51.Pp 74.Pp
52If the line is equal to 75If the line is equal to
53.Dq dhcp , 76.Dq dhcp ,
54.Xr dhcpcd 8 77.Xr dhcpcd 8
55will be started for the interface. 78will be started for the interface.
56.Pp 79.Pp
57If a line is empty, or starts with 80If a line is empty, or starts with
58.Sq # , 81.Sq # ,
59the line will be ignored as comment. 82the line will be ignored as comment.
60.Pp 83.Pp
61If a line starts with 84If a line starts with
62.Sq \&! , 85.Sq \&! ,
63the rest of line will get evaluated as shell script fragment. 86the rest of line will get evaluated as shell script fragment.
64Shell variables declared in 87Shell variables declared in
65.Pa /etc/rc.d/network 88.Pa /etc/rc.d/network
66are accessible. 89are accessible but may not be modified.
67The most useful variable is 90The most useful variable is
68.Li $int , 91.Li $int ,
69as it will be bound to the interface being configured with the file. 92as it will be bound to the interface being configured with the file.
70.Pp 93.Pp
71For example, the following illustrates static interface configuration: 94For example, the following illustrates static interface configuration:
72.Bd -literal -offset indent 95.Bd -literal -offset indent
73# IPv4, with an alias 96# IPv4, with an alias
74inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX 97inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX
75inet 10.0.1.13 netmask 255.255.255.255 alias 98inet 10.0.1.13 netmask 255.255.255.255 alias
76# let us have IPv6 address on this interface 99# let us have IPv6 address on this interface
77inet6 2001:db8::1 prefixlen 64 alias 100inet6 2001:db8::1 prefixlen 64 alias
78# have subnet router anycast address too 101# have subnet router anycast address too
79inet6 2001:db8:: prefixlen 64 alias anycast 102inet6 2001:db8:: prefixlen 64 alias anycast
@@ -90,24 +113,33 @@ up @@ -90,24 +113,33 @@ up
90# autoconfigure IPv6 address. Be sure to set $ip6mode to autohost. 113# autoconfigure IPv6 address. Be sure to set $ip6mode to autohost.
91!rtsol $int 114!rtsol $int
92.Ed 115.Ed
93.Pp 116.Pp
94The following example is for dynamically-created pseudo interfaces like 117The following example is for dynamically-created pseudo interfaces like
95.Xr gif 4 : 118.Xr gif 4 :
96.Bd -literal -offset indent 119.Bd -literal -offset indent
97up 120up
98# configure IPv6 default route toward the interface 121# configure IPv6 default route toward the interface
99!route add -inet6 default ::1 122!route add -inet6 default ::1
100!route change -inet6 default -ifp $int 123!route change -inet6 default -ifp $int
101.Ed 124.Ed
102.Pp 125.Pp
 126The following example sets a network name for a wireless interface
 127(using quotes to protect special characters in the name),
 128and starts
 129.Xr dhcpcd 8 ) :
 130.Bd -literal -offset indent
 131ssid 'my network'
 132dhcp
 133.Ed
 134.Pp
103Earlier versions of 135Earlier versions of
104.Pa /etc/rc.d/network 136.Pa /etc/rc.d/network
105required an explicit 137required an explicit
106.Sq create 138.Sq create
107command for such interfaces. 139command for such interfaces.
108This is now handled automatically. 140This is now handled automatically.
109.Sh FILES 141.Sh FILES
110.Pa /etc/rc.d/network 142.Pa /etc/rc.d/network
111.Sh SEE ALSO 143.Sh SEE ALSO
112.Xr rc.conf 5 , 144.Xr rc.conf 5 ,
113.Xr ifconfig 8 145.Xr ifconfig 8

cvs diff -r1.119 -r1.120 src/share/man/man5/rc.conf.5 (expand / switch to unified diff)

--- src/share/man/man5/rc.conf.5 2008/06/18 09:06:26 1.119
+++ src/share/man/man5/rc.conf.5 2008/09/20 12:12:38 1.120
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: rc.conf.5,v 1.119 2008/06/18 09:06:26 yamt Exp $ 1.\" $NetBSD: rc.conf.5,v 1.120 2008/09/20 12:12:38 apb 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.\"
@@ -45,27 +45,27 @@ @@ -45,27 +45,27 @@
45.\" 45.\"
46.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 46.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
47.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 47.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
48.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 48.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 49.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
50.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 50.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
51.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 51.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
52.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 52.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
53.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 53.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56.\" SUCH DAMAGE. 56.\" SUCH DAMAGE.
57.\" 57.\"
58.Dd June 13, 2008 58.Dd September 20, 2008
59.Dt RC.CONF 5 59.Dt RC.CONF 5
60.Os 60.Os
61.Sh NAME 61.Sh NAME
62.Nm rc.conf 62.Nm rc.conf
63.Nd system startup configuration file 63.Nd system startup configuration file
64.Sh DESCRIPTION 64.Sh DESCRIPTION
65The 65The
66.Nm 66.Nm
67file specifies which services are enabled during system startup by 67file specifies which services are enabled during system startup by
68the startup scripts invoked by 68the startup scripts invoked by
69.Pa /etc/rc 69.Pa /etc/rc
70(see 70(see
71.Xr rc 8 ) , 71.Xr rc 8 ) ,
@@ -505,27 +505,29 @@ If you wish to configure all broadcast @@ -505,27 +505,29 @@ If you wish to configure all broadcast
505network interfaces using the DHCP client, you can leave this blank. 505network interfaces using the DHCP client, you can leave this blank.
506To configure only specific interfaces, name the interfaces to be configured 506To configure only specific interfaces, name the interfaces to be configured
507on the command line. 507on the command line.
508.Pp 508.Pp
509If you must run the DHCP client before mounting critical file systems, 509If you must run the DHCP client before mounting critical file systems,
510then you should specify an alternate location for the DHCP client's lease 510then you should specify an alternate location for the DHCP client's lease
511file in the 511file in the
512.Sy dhclient_flags 512.Sy dhclient_flags
513variable - for example, "-lf /tmp/dhclient.leases". 513variable - for example, "-lf /tmp/dhclient.leases".
514.It Sy dhcpcd_flags 514.It Sy dhcpcd_flags
515Additional arguments to pass to 515Additional arguments to pass to
516.Xr dhcpcd 8 516.Xr dhcpcd 8
517when requesting configuration via 517when requesting configuration via
518.Sy ifconfig_xxN . 518.Sy ifconfig_xxN
 519or
 520.Pa /etc/ifconfig.xxN .
519.It Sy flushroutes 521.It Sy flushroutes
520.Sq YES 522.Sq YES
521or 523or
522.Sq NO . 524.Sq NO .
523Flushes the route table on networking startup. 525Flushes the route table on networking startup.
524Useful when coming up to multiuser mode after going down to 526Useful when coming up to multiuser mode after going down to
525single-user mode. 527single-user mode.
526.It Sy hostapd 528.It Sy hostapd
527.Sq YES 529.Sq YES
528or 530or
529.Sq NO . 531.Sq NO .
530Runs 532Runs
531.Xr hostapd 8 , 533.Xr hostapd 8 ,
@@ -538,28 +540,30 @@ pairs to configure additional network ad @@ -538,28 +540,30 @@ pairs to configure additional network ad
538configured interface 540configured interface
539.Dq * 541.Dq *
540(e.g. 542(e.g.
541.Sy ifaliases_le0 ) . 543.Sy ifaliases_le0 ) .
542If 544If
543.Em netmask 545.Em netmask
544is 546is
545.Dq - , 547.Dq - ,
546then use the default netmask for the interface. 548then use the default netmask for the interface.
547.Pp 549.Pp
548.Sy ifaliases_* 550.Sy ifaliases_*
549covers limited cases only and considered unrecommended. 551covers limited cases only and considered unrecommended.
550We recommend using 552We recommend using
 553.Sy ifconfig_nnX
 554variables or
551.Pa /etc/ifconfig.xxN 555.Pa /etc/ifconfig.xxN
552with multiple lines instead. 556files with multiple lines instead.
553.It Sy ifwatchd 557.It Sy ifwatchd
554.Sq YES 558.Sq YES
555or 559or
556.Sq NO . 560.Sq NO .
557Monitor dynamic interfaces and perform actions upon address changes. 561Monitor dynamic interfaces and perform actions upon address changes.
558Passes 562Passes
559.Sy ifwatchd_flags . 563.Sy ifwatchd_flags .
560.It Sy ip6mode 564.It Sy ip6mode
561A string. 565A string.
562An IPv6 node can be a router 566An IPv6 node can be a router
563.Pq nodes that forward packet for others 567.Pq nodes that forward packet for others
564or a host 568or a host
565.Pq nodes that do not forward . 569.Pq nodes that do not forward .
@@ -668,44 +672,57 @@ See @@ -668,44 +672,57 @@ See
668.It Sy ipsec 672.It Sy ipsec
669.Sq YES 673.Sq YES
670or 674or
671.Sq NO . 675.Sq NO .
672Runs 676Runs
673.Xr setkey 8 677.Xr setkey 8
674to load in IPsec manual keys and policies from 678to load in IPsec manual keys and policies from
675.Pa /etc/ipsec.conf 679.Pa /etc/ipsec.conf
676at network boot time, before any interfaces are configured. 680at network boot time, before any interfaces are configured.
677.It Sy net_interfaces 681.It Sy net_interfaces
678A string. 682A string.
679The list of network interfaces to be configured at boot time. 683The list of network interfaces to be configured at boot time.
680For each interface "xxN", the system first looks for ifconfig 684For each interface "xxN", the system first looks for ifconfig
681parameters in 685parameters in the variable
682.Pa /etc/ifconfig.xxN 686.Sy ifconfig_xxN ,
683and then in the variable 687and then in the file
684.Sy ifconfig_xxN . 688.Pa /etc/ifconfig.xxN .
685If this variable is equal to 
686.Dq dhcp , 
687.Xr dhcpcd 8 
688is started for the interface. 
689Otherwise the contents of the file or the variable are handed to ifconfig 
690after the interface name. 
691If 689If
692.Sy auto_ifconfig 690.Sy auto_ifconfig
693is set to "NO" and neither the file nor the variable is found, 691is set to "NO" and neither the file nor the variable is found,
694a warning is printed. 692a warning is printed.
 693Information in either the variable or the file is parsed identically,
 694except that, if an
 695.Sy ifconfig_xxN
 696variable contains a single line with embedded semicolons,
 697then the value is split into multiple lines prior to further parsing,
 698treating the semicolon as a line separator.
 699One common case it to set
 700.Sy ifconfig_xxN Ns Li \&= Ns Qq dhcp ,
 701which will cause
 702.Xr dhcpcd 8
 703to be started for the interface.
 704Another common case it to set the
 705.Sy ifconfig_xxN
 706variable to a set of arguments to be passed to an
 707.Xr ifconfig 8
 708command after the interface name.
695Refer to 709Refer to
696.Xr ifconfig.if 5 710.Xr ifconfig.if 5
697for more details on 711for more details on
698.Pa /etc/ifconfig.xxN . 712.Pa /etc/ifconfig.xxN
 713files, and note that the information there also applies to
 714.Sy ifconfig_xxN
 715variables (after the variables are split into lines).
699.It Sy ntpdate 716.It Sy ntpdate
700.Sq YES 717.Sq YES
701or 718or
702.Sq NO . 719.Sq NO .
703Runs 720Runs
704.Xr ntpdate 8 721.Xr ntpdate 8
705to set the system time from one of the hosts in 722to set the system time from one of the hosts in
706.Sy ntpdate_hosts . 723.Sy ntpdate_hosts .
707If 724If
708.Sy ntpdate_hosts 725.Sy ntpdate_hosts
709is empty, it will attempt to find a list of hosts in 726is empty, it will attempt to find a list of hosts in
710.Pa /etc/ntp.conf . 727.Pa /etc/ntp.conf .
711Passes 728Passes