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