History log of /netbsd-current/etc/rc.d/network
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.85 16-Oct-2020 kim

network: Update rtsol options

- Use "-6" instead of "--noipv4" as it seems more appropriate based on
the dhcpcd(8) manual page.
- Remove "-f /dev/null" as it seems unnecessary with "-6".
- Remove "--persistent" as it is in the default /etc/dhcpcd.conf,
and this way the user can change it, if they would like to (either
through dhcpcd_flags or by editing /etc/dhcpcd.conf).

The "-b" (or "--background") option is needed to avoid a timeout error
message (and a delay in booting), so it is still left in place.


# 1.84 15-Oct-2020 kim

Update "rtsol" keyword: leave IPv6 autoconf on

There is no need to turn off ipv6_autoconf or dhcp6 in dhcpcd to match
the previous behaviour with in-kernel RA processing.


# 1.83 11-Oct-2020 kim

Make "rtsol" functional again.


# 1.82 08-Sep-2020 martin

Rename MOUNTCRITLOCAL to CRITLOCALMOUNTED to avoid a name collision
on case insensitive file systems


# 1.81 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


# 1.80 04-Jul-2020 skrll

Trailing whitespace


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.83 11-Oct-2020 kim

Make "rtsol" functional again.


# 1.82 08-Sep-2020 martin

Rename MOUNTCRITLOCAL to CRITLOCALMOUNTED to avoid a name collision
on case insensitive file systems


# 1.81 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


# 1.80 04-Jul-2020 skrll

Trailing whitespace


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.82 08-Sep-2020 martin

Rename MOUNTCRITLOCAL to CRITLOCALMOUNTED to avoid a name collision
on case insensitive file systems


# 1.81 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


# 1.80 04-Jul-2020 skrll

Trailing whitespace


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.81 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


# 1.80 04-Jul-2020 skrll

Trailing whitespace


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.80 04-Jul-2020 skrll

Trailing whitespace


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.79 12-Jun-2020 roy

Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).


Revision tags: phil-wifi-20200421
# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

branches: 1.76.2;
only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

branches: 1.71.8;
use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.78 15-Apr-2020 kim

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


Revision tags: phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.77 22-Feb-2020 roy

rc.d/network: improve wording of waiting for DAD to finish


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4; 1.73.6;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.76 23-Oct-2018 mrg

only flush routes in stop routine if flushroutes is true, same as
the start up.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.75 27-Jul-2018 roy

Allow rc.conf to setup resolv.conf via resolvconf(8).
This allows all static network config to be in rc.conf rather than
spread across files.


# 1.74 29-Jun-2018 roy

Remove dhclient from the base system.

Discussed here:
https://mail-index.netbsd.org/tech-userlevel/2018/06/21/msg011233.html


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.73 06-Jul-2017 kre

branches: 1.73.4;

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.73 06-Jul-2017 kre

Revert previous - not a typo, even though it looks like one


# 1.72 06-Jul-2017 kre

PR misc/52370

Correct typo.

XXX pullup 8, pullup 7


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 05-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 22-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 02-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 26-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 22-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 17-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 09-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 28-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 20-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 11-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 12-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.71 06-Mar-2016 christos

use kat, a version of cat that strips comments


# 1.70 07-Jan-2016 roy

Instead of waiting for a duration based in IPv6 DAD count sysctl,
wait for 15 seconds for tentative flags to clear allowing 5 seconds
for detached flags to clear as well from configured addresses.

This is now protocol independant and allows time for the interfaces to
work out if they have a carrier or not.


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7
# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


Revision tags: matt-premerge-20091211
# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


Revision tags: netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2
# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


Revision tags: mjf-devfs2-base
# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 19-Sep-2008 apb

* 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"


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base hpcarm-cleanup-base
# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 24-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


Revision tags: netbsd-3-base
# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


Revision tags: fvdl_fs64_base
# 1.39 04-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 28-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 24-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 21-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 01-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 11-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 03-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 25-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 21-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 16-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 08-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 20-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 27-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 19-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 10-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 17-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 11-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.69 14-Oct-2014 christos

fix syntax error


# 1.68 21-Sep-2014 roy

Use checkyesnox to test rtsol as it has been removed including its
default configuration which we should not warn about.


# 1.67 11-Sep-2014 roy

Remove rtsol(8) and rtsold(8) as their functionality is in dhcpcd(8).
Remove rtsol(8) from rc.d/network.
Add -w seconds command to ifconfig to wait for N seconds for until DAD
has finished on all addresses.
Use ifconfig -w in rc.d/network instead of a forced sleep.

As discussed on tech-net@


# 1.66 29-Apr-2014 uebayasi

Indent.


# 1.65 29-Apr-2014 uebayasi

Refactor a little to remove huge indents.


# 1.64 29-Apr-2014 uebayasi

Split huge monolithic functions for readability.


# 1.63 20-Apr-2013 christos

branches: 1.63.6;
don't attempt to create interfaces that exist and don't hide errors.


# 1.62 02-Nov-2012 yamt

print something before sleeping so that a user like me can see
what the mysterious pause is.


# 1.61 26-Sep-2010 apb

branches: 1.61.6; 1.61.12;
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


# 1.60 11-Sep-2009 cegger

backout rev. 1.59. Will be re-done differently.


# 1.59 08-Sep-2009 cegger

Do not flush routes if root file system is nfs mounted.
Fixes boot problem when the nfs server is in a different subnet.


# 1.58 14-May-2009 roy

Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.

Fixes PR bin/40320


# 1.57 11-Oct-2008 christos

branches: 1.57.2; 1.57.8;
eval arguments one more time so that quoting works.


# 1.56 26-Sep-2008 apb

Move default route configuration after interface alias address
configuration, in case people have default routes over aliased
addresses.


# 1.55 20-Sep-2008 apb

remove an unecessary "eval"


# 1.54 20-Sep-2008 apb

* 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"


# 1.53 24-Jul-2008 reed

Use absolute path for various /sbin tools.
This is consistent with several other rc.d scripts
and fixes problem with /sbin not in PATH.

(Tested several times for over three weeks, but not all
parts of this code were used by me.)


# 1.52 29-May-2008 joerg

Allow per-interface DHCP configuration using dhcpcd via
ifconfig_xxN=dhcp or a dhcp line in /etc/ifconfig.xxN.


# 1.51 10-Feb-2007 reed

branches: 1.51.12; 1.51.14; 1.51.16;
Fix typo/mispelling in comment.


# 1.50 23-Nov-2005 rpaulo

RFC 3879 deprecated the IPv6 site-local prefix (fec0::/10):
* remove all references to $ip6sitelocal and output a warning
message if the variable is defined.
* introduce $ip6uniquelocal (defaults to 'NO') that will control the
behaviour of the system when $ip6mode is ``router'' (i.e. fc00::/7
will not be routed if the variable is ``NO'') as per RFC 4193.

Thanks to Jonathan A. Kollasch for pointing this out in PR 32152.


# 1.49 28-Jun-2005 symka

PR/29317: ifconfig.if does not allow parameters with spaces

OKeyd by christos@


# 1.48 26-Apr-2005 cjs

Make ifaliases_lo0 in rc.conf work just like other interfaces (instead of
being ignored). Also, when configuring aliases set as ifaliases_xxN,
print out the interface name and the alias address.


# 1.47 12-Oct-2004 lukem

branches: 1.47.2;
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20768 from Pavel Cahyna.


# 1.46 11-Oct-2004 christos

Use new style command substitution.


# 1.45 13-Aug-2004 mycroft

Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this
for a speedup by doing:
$_rc_subr_loaded . /etc/rc.subr


# 1.44 12-Oct-2003 jdc

branches: 1.44.4;
Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.
Approved by itojun@.


# 1.43 09-Jan-2003 christos

revert previous; luke and matt want this as a separate script.


# 1.42 09-Jan-2003 christos

Add /etc/route.conf processing to add static routes. Removes one more
reason for netstart.local.


# 1.41 07-Jan-2003 tron

Revert last change for now. It causes hangs during system shutdown when
NFS filesystems are mounted.


# 1.40 06-Jan-2003 tron

Add keyword "shutdown" so that this script is really executed on system
shutdown to delete clone interfaces.


# 1.39 04-Oct-2002 tron

Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


# 1.38 04-May-2002 tron

branches: 1.38.2;
Sync ipf(4) after starting or stopping. This is necesarry to make filter
rules for dynamically created interfaces like pppoe(4) effective.


# 1.37 29-Apr-2002 lukem

don't bother warning or supporting obsolete $ip6forwarding;
postinstall now checks for this


# 1.36 27-Mar-2002 lukem

clean up warning


# 1.35 23-Mar-2002 sommerfeld

Improve information density of output -- add the dozen -reject routes
with "route -q" since they are always the same and convey no useful
information.

While we're here, use sysctl -qw instead of sysctl -w >/dev/null


# 1.34 21-Mar-2002 thorpej

Correct the "direction" of the barrier dependencies (DAEMON, LOGIN,
NETWORKING, and SERVERS) by specifying that certain things should
come BEFORE a given barrier, rather than having the barrier REQUIRE
a service. This allows scripts to be removed without having to
edit the barrier dependencies.

As discussed on tech-userlevel, and approved by Luke.


# 1.33 22-Jul-2001 wiz

seperate -> separate


# 1.32 08-Jul-2001 lukem

After itojun's recent RTF_CLONED and other changes, it's not necessary to
add a route from an alias address to 127.0.0.1, so remove that code.
It's still necessary to configure lo0 -> 127.0.0.1 though, so emphasize that.


# 1.31 01-Mar-2001 itojun

comment correction: 127/8 must not leave the node (RFC1122)


# 1.30 13-Jan-2001 itojun

move IPv6 mode/route configuration upwards, so that !rtsol in
/etc/ifconfig.* is meaningful.


# 1.29 10-Jan-2001 itojun

extend /etc/ifconfig.xxN, for comment lines (#) and shell script
fragment (!). inspired by openbsd /etc/hostname.xxN.


# 1.28 02-Jan-2001 itojun

add $ip6sitelocal, to control installation of reject route for fec0::/10.


# 1.27 25-Nov-2000 nisimura

More cautious about undefined hostname check in terms of what hostname(1)
returns.


# 1.26 21-Nov-2000 nisimura

I believe in that the facy nested quotes was intended to skip blank
lines, but am not sure it is allowed as a standard practice of the
/etc/ifconfig.xxN file.


# 1.25 21-Nov-2000 wiz

un-break.


# 1.24 21-Nov-2000 lukem

minor typo in previous


# 1.23 21-Nov-2000 nisimura

Shell programming police for sophistication; take #2. Handle the
case when the filename expansion results in no match more gracefully.
Far less costy than invoking a new process.


# 1.22 21-Nov-2000 nisimura

Shell programming police for sophistication. It's not necessary
to enclose `prog` backquote command substitution with double quotes
as it produces a quoted string. Other changes are pending this time.


# 1.21 16-Nov-2000 lukem

- replace `IFS='.'; set -- $int; echo $2` with ${int##*.}
- can't use $configured_interfaces in network_stop(), so use `ifconfig -lu`
instead


# 1.20 08-Oct-2000 nisimura

- avoid -a or -o logical operator of test command as possible. They would
introduce syntaxical ambiguousity, and having concatenation with && or
|| costs nothing because our sh(1) has test(1) builtin.
- use elif construct to avoid dungling else-ifs.
- while-read construct does not need enclosed by a sub-shell.
- variable detection could be done in eval args=\$ifconfig_$int
- smart variable substitution occationally saves lines and extra command
invocations.


# 1.19 21-Aug-2000 lukem

REQUIRE ipfilter and ipsec


# 1.18 02-Aug-2000 itojun

fix comment on DAD wait


# 1.17 01-Aug-2000 itojun

we need to sleep for IPv6 DAD period, before and after rtsol.
(they are for stability in boot-time configuration)
comment from perry.


# 1.16 25-Jul-2000 jdolecek

the format without netmask is supported for compatibility only and not
specifying it is discouradged, actually
also add comments about this fact to etc/rc.d/network, for people who
don't read manpages :)


# 1.15 20-Jul-2000 thorpej

Build a list of cloning network interfaces to configure, as well
as normal interfaces.


# 1.14 17-Jul-2000 lukem

reenable stop_cmd now that network doesn't get run at shutdown


# 1.13 19-Jun-2000 itojun

remove ip6defaultif configuration. because:
- ndp is in /usr/sbin, chokes on NFS-mounted /usr installation
- the option is just for IPv6 specification geek, not for normal users


# 1.12 20-Jun-2000 enami

Don't warn that $hostname isn't set if the hostname is already set.


# 1.11 13-May-2000 lukem

branches: 1.11.4;
Use load_rc_config() (from rc.subr) instead of sourcing /etc/rc.conf.
This allows us or a user to change the configuration file method in
one place - rc.subr - without having to edit all of the rc.d/* files.


# 1.10 09-May-2000 itojun

do not let 127.0.0.0/8 leave the node. based on RFC1122.


# 1.9 29-Apr-2000 veego

Fix the last change so it doesn't fail due too a missing '; then'.


# 1.8 27-Apr-2000 thorpej

Don't warn about $hostname not being set if $dhclient == YES; it's quite
likely that we'll be getting the hostname via DHCP when it runs.


# 1.7 19-Apr-2000 itojun

rtsol is not a daemon. rtsol.d should have been killed by rc.d/rtsold.
(correct me if i'm wrong)


# 1.6 10-Apr-2000 lukem

make `stop' a no-op, so that the network doesn't disappear at an
inconvenient time during boot.

this may be fixed a different way in the long term... (not that the old
rc.shutdown supported stopping the network, or could i really see a
practical use for allowing it at this stage, but in the future someone
might want the functionality i've just disabled).


# 1.5 08-Apr-2000 tsarna

The file /etc/sysctl.conf is now run with sysctl -f at boot time.
This replaces the previous /etc/rc.d/sysctl. Also, the variables are now
set earlier, between ipf/ipnat and the network coming up.

The rc.conf defcorename and securelevel variables are no more. You can
set them directly in sysctl.conf now.


# 1.4 16-Mar-2000 itojun

correct reject route installations for IPv6. improve comments.


# 1.3 11-Mar-2000 itojun

disallow packets to malicious 6to4 prefix, based on
http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt


# 1.2 11-Mar-2000 veego

Fix the network_stop function so it doesn't fails due to missing ]['s.


# 1.1 10-Mar-2000 lukem

branches: 1.1.1;
Initial revision


# 1.1.1.1 10-Mar-2000 lukem

rc.d scripts derived from /etc/rc


# 1.11.4.7 02-May-2001 he

Pull up revisions 1.29-1.30 (via patch, requested by itojun):
Add support for "!" and "#" syntax in /etc/ifconfig.*.


# 1.11.4.6 20-Mar-2001 he

Pull up revision 1.15 (requested by bouyer):
Add support for cloning network devices (e.g. vlan). Fixes
PR#12398.


# 1.11.4.5 23-Aug-2000 lukem

pull up rev 1.19:
REQUIRE ipfilter and ipsec

approved: thorpej


# 1.11.4.4 09-Aug-2000 lukem

pull up the following
approved by: thorpej

etc/rc.d/DAEMON 1.3
etc/rc.d/LOGIN 1.3
etc/rc.d/NETWORK 1.1
etc/rc.d/SERVERS 1.2
etc/rc.d/cron 1.4
etc/rc.d/dhclient 1.6
etc/rc.d/dmesg 1.4
etc/rc.d/inetd 1.5
etc/rc.d/lkm1 1.3
etc/rc.d/lkm2 1.3
etc/rc.d/lkm3 1.4
etc/rc.d/motd 1.3
etc/rc.d/mountcritlocal 1.3-1.4
etc/rc.d/mountcritremote 1.3
etc/rc.d/mountd 1.7
etc/rc.d/network 1.12 1.14
etc/rc.d/ntpdate 1.4
etc/rc.d/ppp 1.3-1.4
etc/rc.d/pwcheck 1.3
etc/rc.d/rpcbind 1.4
etc/rc.d/sshd 1.3-1.5
etc/rc.d/swap1 1.5
etc/rc.d/swap2 1.4
etc/rc.d/sysdb 1.3-1.4
etc/rc.d/syslogd 1.5-1.6
etc/rc.d/systemfs REMOVE
etc/rc.d/virecover 1.3
etc/rc.d/wscons 1.4
etc/rc.d/xdm 1.5

summary:

* reword descriptions
* add '# KEYWORD: shutdown' to some of these scripts so that only they get run
at shutdown time. now, only scripts with the keyword `shutdown' will be
run by /etc/rc.shutdown, which speeds up shutdown and makes it more robust
* add new dummy dependancy `NETWORK' to be REQUIREd by services which need
networking to be operational before starting, and use as appropriate.
NETWORK depends upon network and dhclient.
* move the guts of systemfs into mountcritlocal
* replace the dependancy on systemfs with mountcritremote, and remove the
former.
* SERVERS now also depends upon ppp
* move recreating /var/run/utmp from mountcritlocal (where /var/run is
purged but /usr/bin/install is not available) to sysdb.
problem noted by Matthias Drochner.
* share the same load_rc_config between the lkm* scripts
* network: Don't warn that $hostname isn't set if the hostname is already set.
* network: reenable stop_cmd now that network doesn't get run at shutdown
* add sshd startup script
* use "load_rc_config swap" for swap1 and swap2
* syslog requires databases from sysdb which creates /var/run/utmp.

Should fix PRs:
[install/9853] [bin/10002] [misc/10349] [port-i386/10633] [misc/10641]


# 1.11.4.3 03-Aug-2000 itojun

pullup 1.16 -> 1.18 (approved by releng-1-5)

> we need to sleep for IPv6 DAD period, before and after rtsol.
> (they are for stability in boot-time configuration)
> comment from perry.


# 1.11.4.2 25-Jul-2000 jdolecek

pullup rev. 1.16 from trunk (approved by thorpej):
for ifaliases, add some comments about format without netmask beeing supported
for compatibility only


# 1.11.4.1 20-Jun-2000 itojun

remove ip6defaultif configuration, which is not for common installation.
approved by: releng-1-5


# 1.38.2.2 04-Jun-2004 jmc

Pullup rev 1.44 (requested by itojun in ticket #1704)

Allow an IPv6 default route to be set from /etc/mygate6 or $defaultroute6.


# 1.38.2.1 23-Oct-2002 lukem

Pull up revision 1.39 (requested by tron in ticket #901):
Automatically create and destroy cloning interfaces and sync IP Filter
immediately afterwards before bringing the interface up. This avoids
a small security gap existing in the previous scheme where IP Filter
was synced after all cloning interfaces were created and brought up.


# 1.44.4.2 05-Jul-2005 riz

Pull up revision 1.49 (requested by symka in ticket #2038):
PR/29317: ifconfig.if does not allow parameters with spaces
OKeyd by christos@


# 1.44.4.1 09-May-2005 riz

Pull up revision 1.47 (requested by lukem in ticket #1269):
Use 'load_rc_config_var CMD VAR' to set VAR for "foreign" rc.conf(5)
variables that may be set in /etc/rc.conf.d/CMD instead of /etc/rc.conf.
Fixes PR 20786 from Pavel Cahyna.


# 1.47.2.1 02-Jul-2005 tron

Pull up revision 1.49 (requested by symka in ticket #511):
PR/29317: ifconfig.if does not allow parameters with spaces
OKeyd by christos@


# 1.51.16.2 17-Sep-2008 wrstuden

Sync with wrstuden-revivesa-base-2.


# 1.51.16.1 22-Jun-2008 wrstuden

Sync w/ -current. 34 merge conflicts to follow.


# 1.51.14.1 03-Jun-2008 yamt

sync with head


# 1.51.12.3 17-Jan-2009 mjf

Sync with HEAD.


# 1.51.12.2 05-Oct-2008 mjf

Sync with HEAD.


# 1.51.12.1 02-Jun-2008 mjf

Sync with HEAD.


# 1.57.8.1 20-Apr-2010 matt

sync to netbsd-5


# 1.57.2.2 06-Jan-2011 riz

Pull up following revision(s) (requested by enami in ticket #1504):
share/man/man8/rc.subr.8: revision 1.27
etc/rc.subr: revision 1.86
share/man/man5/ifconfig.if.5: revision 1.14
etc/rc.d/network: revision 1.61
Add a collapse_backslash_newline function to rc.subr.
Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read
by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was
also reported independently by Jeremy C. Reed.


# 1.57.2.1 18-May-2009 bouyer

Pull up following revision(s) (requested by roy in ticket #757):
etc/rc.d/network: revision 1.58
Only start dhcpcd per interface if not running the full dhcpcd daemon.
Only stop dhcpcd pre interface if it's running for the interface.
Fixes PR bin/40320


# 1.61.12.3 19-Aug-2014 tls

Rebase to HEAD as of a few days ago.


# 1.61.12.2 23-Jun-2013 tls

resync from head


# 1.61.12.1 19-Nov-2012 tls

Resync to 2012-11-19 00:00:00 UTC


# 1.61.6.2 22-May-2014 yamt

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")


# 1.61.6.1 15-Jan-2013 yamt

sync with (a bit old) head


# 1.63.6.1 10-Aug-2014 tls

Rebase.