7 # REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
13 start_cmd="network_start"
14 stop_cmd="network_stop"
19 nsswitch_conf=$1; shift;
21 /^[:blank:]*#/ { next } \
22 /(hosts|local|file)/ { nsswitch[c] = "files"; c++; next } \
23 /(dns|bind)/ { nsswitch[c] = "dns"; c++; next } \
24 /nis/ { nsswitch[c] = "nis"; c++; next } \
25 { printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \
28 for (i in nsswitch) printf "%s ", nsswitch[i]; \
30 }' < $host_conf > $nsswitch_conf
35 nsswitch_conf=$1; shift;
40 xlat["files"] = "hosts";
45 sub(/^[\t ]*hosts:/, "") || cont {
54 print "# Auto-generated from nsswitch.conf, do not edit"
56 for (n = 1; n <= ns; ++n) {
61 ' <$nsswitch_conf >$host_conf
65 case ${gif_interfaces} in
69 for i in ${gif_interfaces}; do
70 eval peers=\$gifconfig_$i
76 ifconfig $i create >/dev/null 2>&1
77 ifconfig $i tunnel ${peers}
88 # set hostname, turn on network
90 echo -n "Doing initial network setup:"
92 # Generate host.conf for compatibility
94 if [ -f "/etc/nsswitch.conf" ]; then
96 generate_host_conf /etc/nsswitch.conf /etc/host.conf
99 # Convert host.conf to nsswitch.conf if necessary
101 if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
103 echo 'Warning: /etc/host.conf is no longer used'
104 echo ' /etc/nsswitch.conf will be created for you'
105 convert_host_conf /etc/host.conf /etc/nsswitch.conf
108 # Set the host name if it is not already set
110 if [ -z "`hostname -s`" ]; then
115 # Set the domainname if we're using NIS
117 case ${nisdomainname} in
121 domainname ${nisdomainname}
128 # Attempt to create cloned interfaces.
129 for ifn in ${cloned_interfaces}; do
130 ifconfig ${ifn} create
136 # Set up all the network interfaces, calling startup scripts if needed
138 case ${network_interfaces} in
140 network_interfaces="`ifconfig -l`"
143 network_interfaces="${network_interfaces} ${cloned_interfaces}"
148 for ifn in ${network_interfaces}; do
149 if [ -r /etc/start_if.${ifn} ]; then
150 . /etc/start_if.${ifn}
154 # Do the primary ifconfig if specified
156 eval ifconfig_args=\$ifconfig_${ifn}
158 case ${ifconfig_args} in
162 # DHCP inits are done all in one go below
163 dhcp_interfaces="$dhcp_interfaces $ifn"
167 ifconfig ${ifn} ${ifconfig_args}
173 if [ ! -z "${dhcp_interfaces}" ]; then
174 ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces}
177 for ifn in ${network_interfaces}; do
178 # Check to see if aliases need to be added
182 eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
183 if [ -n "${ifconfig_args}" ]; then
184 ifconfig ${ifn} ${ifconfig_args} alias
186 alias=$((${alias} + 1))
192 # Do ipx address if specified
194 eval ifconfig_args=\$ifconfig_${ifn}_ipx
195 if [ -n "${ifconfig_args}" ]; then
196 ifconfig ${ifn} ${ifconfig_args}
201 # Display ifconfiged interfaces
202 for ifn in ${network_interfaces}; do
203 eval showstat=\$showstat_${ifn}
204 if [ ! -z ${showstat} ]; then
210 /etc/rc.d/ipfilter resync
215 echo -n "Stopping network:"
219 echo -n " flush routes"