| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # | | 2 | # |
3 | # $NetBSD: network,v 1.76 2018/10/23 09:25:33 mrg Exp $ | | 3 | # $NetBSD: network,v 1.76.2.1 2020/04/22 17:55:16 martin 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 | |
12 | name="network" | | 12 | name="network" |
13 | start_cmd="network_start" | | 13 | start_cmd="network_start" |
14 | stop_cmd="network_stop" | | 14 | stop_cmd="network_stop" |
15 | | | 15 | |
16 | nl=' | | 16 | nl=' |
| @@ -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,34 @@ network_start_interfaces() | | | @@ -312,26 +313,34 @@ 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 | >/dev/null |
| | | 332 | fi |
| | | 333 | ;; |
325 | *) | | 334 | *) |
326 | # Pass args to ifconfig. Note | | 335 | # Pass args to ifconfig. Note |
327 | # that args may contain embedded | | 336 | # that args may contain embedded |
328 | # shell metacharacters, such as | | 337 | # shell metacharacters, such as |
329 | # "ssid 'foo;*>bar'". We eval | | 338 | # "ssid 'foo;*>bar'". We eval |
330 | # one more time so that things | | 339 | # one more time so that things |
331 | # like ssid "Columbia University" work. | | 340 | # like ssid "Columbia University" work. |
332 | ( | | 341 | ( |
333 | set -o noglob | | 342 | set -o noglob |
334 | eval set -- $args | | 343 | eval set -- $args |
335 | #echo >&2 "[$#] [$1] [$2] [$3]" | | 344 | #echo >&2 "[$#] [$1] [$2] [$3]" |
336 | /sbin/ifconfig $int "$@" | | 345 | /sbin/ifconfig $int "$@" |
337 | ) | | 346 | ) |