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}
87 # set hostname, turn on network
89 echo -n "Doing initial network setup:"
91 # Generate host.conf for compatibility
93 if [ -f "/etc/nsswitch.conf" ]; then
95 generate_host_conf /etc/nsswitch.conf /etc/host.conf
98 # Convert host.conf to nsswitch.conf if necessary
100 if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
102 echo 'Warning: /etc/host.conf is no longer used'
103 echo ' /etc/nsswitch.conf will be created for you'
104 convert_host_conf /etc/host.conf /etc/nsswitch.conf
107 # Set the host name if it is not already set
109 if [ -z "`hostname -s`" ]; then
114 # Set the domainname if we're using NIS
116 case ${nisdomainname} in
120 domainname ${nisdomainname}
127 # Attempt to create cloned interfaces.
128 for ifn in ${cloned_interfaces}; do
129 ifconfig ${ifn} create
135 # Set up all the network interfaces, calling startup scripts if needed
137 case ${network_interfaces} in
139 network_interfaces="`ifconfig -l`"
142 network_interfaces="${network_interfaces} ${cloned_interfaces}"
147 for ifn in ${network_interfaces}; do
148 if [ -r /etc/start_if.${ifn} ]; then
149 . /etc/start_if.${ifn}
153 # Do the primary ifconfig if specified
155 eval ifconfig_args=\$ifconfig_${ifn}
157 case ${ifconfig_args} in
161 # DHCP inits are done all in one go below
162 dhcp_interfaces="$dhcp_interfaces $ifn"
166 ifconfig ${ifn} ${ifconfig_args}
172 if [ ! -z "${dhcp_interfaces}" ]; then
173 ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces}
176 for ifn in ${network_interfaces}; do
177 # Check to see if aliases need to be added
181 eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
182 if [ -n "${ifconfig_args}" ]; then
183 ifconfig ${ifn} ${ifconfig_args} alias
185 alias=$((${alias} + 1))
191 # Do ipx address if specified
193 eval ifconfig_args=\$ifconfig_${ifn}_ipx
194 if [ -n "${ifconfig_args}" ]; then
195 ifconfig ${ifn} ${ifconfig_args}
200 # Display ifconfiged interfaces
201 for ifn in ${network_interfaces}; do
202 eval showstat=\$showstat_${ifn}
203 if [ ! -z ${showstat} ]; then
209 /etc/rc.d/ipfilter resync
214 echo -n "Stopping network:"
218 echo -n " flush routes"