rc.network revision 75900
1#!/bin/sh -
2# $FreeBSD: head/release/picobsd/mfs_tree/etc/rc.network 75900 2001-04-24 07:46:35Z joe $
3network_pass1() {
4    echo -n 'Doing initial network setup:'
5    # Set the host name if it is not already set
6    if [ -z "`hostname -s`" ] ; then
7	    hostname $hostname
8	    echo ' hostname'
9    fi
10    # Set up all the network interfaces, calling startup scripts if needed
11    for ifn in ${network_interfaces}; do
12	    if [ -e /etc/start_if.${ifn} ]; then
13		    . /etc/start_if.${ifn}
14	    fi
15	    # Do the primary ifconfig if specified
16	    eval ifconfig_args=\$ifconfig_${ifn}
17	    if [ -n "${ifconfig_args}" ] ; then
18		    ifconfig ${ifn} ${ifconfig_args}
19	    fi
20	    # Check to see if aliases need to be added
21	    alias=0
22	    while :
23	    do
24		    eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
25		    if [ -n "${ifconfig_args}" ]; then
26			    ifconfig ${ifn} ${ifconfig_args} alias
27			    alias=`expr ${alias} + 1`
28		    else
29			    break;
30		    fi
31	    done
32	    ifconfig ${ifn}
33    done
34    # Load the filters if required
35    if [ -n "$firewall_enable" -a -f /etc/rc.firewall -a \
36    	"x$firewall_enable" = "xYES" ] ; then
37    		. /etc/rc.firewall
38    		echo "Firewall rules loaded."
39    else
40	    echo "Warning: kernel has firewall functionality, but firewall rules weren't loaded."
41	    echo "         All ip services are ENABLED by default."
42    fi
43    # Configure routing
44    if [ "x$defaultrouter" != "xNO" ] ; then
45	    static_routes="default ${static_routes}"
46	    route_default="default ${defaultrouter}"
47    fi
48    # Set up any static routes.  This should be done before router discovery.
49    if [ "x${static_routes}" != "x" ]; then
50	    for i in ${static_routes}; do
51		    eval route_args=\$route_${i}
52		    route add ${route_args}
53	    done
54    fi
55    echo -n 'Additional routing options:'
56    if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then
57	    echo -n ' tcp_extensions=NO'
58	    sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1
59	    sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1
60    fi
61    if [ "X$gateway_enable" = X"YES" ]; then
62	    echo -n ' IP_gateway=YES'
63	    sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1
64    fi
65    if [ "X$arpproxy_all" = X"YES" ]; then
66	    echo -n ' turning on ARP_PROXY_ALL: '
67	    sysctl -w net.link.ether.inet.proxyall=1 2>&1
68    fi
69    echo '.'
70    network_pass1_done=YES	# Let future generations know we made it.
71}
72
73network_pass2() {
74    network_pass2_done=YES
75}
76
77network_pass3() {
78    network_pass3_done=YES
79}
80