]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/network
Fixes an den Netzwerkscripts und der Netzwerkroutine im Setup.
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / network
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/network
4 #
5 # Description : Network Control Script
6 #
7 # Authors : Michael Tremer - mitch@ipfire.org
8 #
9 # Version : 01.00
10 #
11 # Notes : Written for IPFire by its team
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
18
19 init_networking() {
20
21 boot_mesg "Loading firewall modules into the kernel"
22 modprobe iptable_nat || failed=1
23 for i in $(find /lib/modules/$(uname -r) -name ip_conntrack*); do
24 modprobe $i || failed=1
25 done
26 for i in $(find /lib/modules/$(uname -r) -name ip_nat*); do
27 modprobe $i || failed=1
28 done
29 (exit ${failed})
30 evaluate_retval
31
32 boot_mesg "Setting up firewall"
33 /etc/rc.d/init.d/firewall start; evaluate_retval
34
35 boot_mesg "Setting up traffic accounting"
36 /etc/rc.d/helper/writeipac.pl || failed=1
37 /usr/sbin/fetchipac -S || failed=1
38 (exit ${failed})
39 evaluate_retval
40
41 boot_mesg "Setting up DMZ pinholes"
42 /usr/local/bin/setdmzholes; evaluate_retval
43
44 if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
45 boot_mesg "Setting up wireless firewall rules"
46 /usr/local/bin/restartwireless; evaluate_retval
47 fi
48
49 /etc/rc.d/init.d/dnsmasq start
50 }
51
52 DO="${1}"
53 shift
54
55 if [ -n "${1}" ]; then
56 ALL=0
57 for i in green red blue orange; do
58 eval "${i}=0"
59 done
60 else
61 ALL=1
62 for i in green red blue orange; do
63 eval "${i}=1"
64 done
65 fi
66
67 while [ ! $# = 0 ]; do
68 for i in green red blue orange; do
69 if [ "${i}" == "${1}" ]; then
70 eval "${i}=1"
71 shift
72 fi
73 done
74 done
75
76 case "${DO}" in
77 start)
78 [ "${ALL}" == "1" ] && init_networking
79
80 # Starting interfaces...
81 # GREEN
82 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start
83
84 # BLUE
85 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
86 /etc/rc.d/init.d/networking/blue start
87
88 # ORANGE
89 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
90 /etc/rc.d/init.d/networking/orange start
91
92 # RED
93 if [ "$red" == "1" ]; then
94 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
95 # Remove possible leftover files
96 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
97 [ "$AUTOCONNECT" == "off" ] || /etc/rc.d/init.d/networking/red start
98 fi
99 fi
100 ;;
101
102 stop)
103 # Stopping interfaces...
104 # GREEN
105 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop
106
107 # BLUE
108 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
109 /etc/rc.d/init.d/networking/blue stop
110
111 # ORANGE
112 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
113 /etc/rc.d/init.d/networking/orange stop
114
115 # RED
116 if [ "$red" == "1" ]; then
117 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
118 /etc/rc.d/init.d/networking/red stop
119 fi
120 fi
121 ;;
122
123 restart)
124 for i in green red blue orange; do
125 if [ "${!i}" == "1" ]; then
126 ARGS+=" ${i}"
127 fi
128 done
129 ${0} stop ${ARGS}
130 sleep 1
131 ${0} start ${ARGS}
132 ;;
133
134 *)
135 echo "Usage: ${0} {start|stop|restart} [device(s)]"
136 exit 1
137 ;;
138 esac
139
140 # End /etc/rc.d/init.d/network