]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/network
Move enabling nf_conntrack_acct where it should be.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / network
CommitLineData
3fd5feeb
MT
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/network
4#
5# Description : Network Control Script
6#
d1e90efc 7# Authors : Michael Tremer - mitch@ipfire.org
3fd5feeb 8#
9c16cd92 9# Version : 01.00
3fd5feeb
MT
10#
11# Notes : Written for IPFire by its team
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
bf7c473f 17eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
bf7c473f 18
6fc15159 19init_networking() {
6fc15159
MT
20 boot_mesg "Loading firewall modules into the kernel"
21 modprobe iptable_nat || failed=1
5e0f55e7 22 for i in $(find /lib/modules/$(uname -r) -name nf_conntrack*); do
50418f38 23 modprobe $(basename $i | cut -d. -f1) || failed=1
6fc15159 24 done
5e0f55e7 25 for i in $(find /lib/modules/$(uname -r) -name nf_nat*); do
50418f38 26 modprobe $(basename $i | cut -d. -f1) || failed=1
6fc15159
MT
27 done
28 (exit ${failed})
29 evaluate_retval
3a90a80c
AF
30
31 if [ -e /var/ipfire/main/disable_nf_sip ]; then
32 rmmod nf_nat_sip
33 rmmod nf_conntrack_sip
adc91020
MT
34 rmmod nf_nat_h323
35 rmmod nf_conntrack_h323
3a90a80c
AF
36 fi
37
6fc15159 38 /etc/rc.d/init.d/dnsmasq start
b5c30aea 39 /etc/rc.d/init.d/static-routes start
6fc15159
MT
40}
41
37263bc1
MT
42DO="${1}"
43shift
069680ac 44
37263bc1 45if [ -n "${1}" ]; then
d1e90efc
MT
46 ALL=0
47 for i in green red blue orange; do
48 eval "${i}=0"
49 done
37263bc1 50else
d1e90efc
MT
51 ALL=1
52 for i in green red blue orange; do
53 eval "${i}=1"
54 done
37263bc1 55fi
069680ac 56
37263bc1 57while [ ! $# = 0 ]; do
d1e90efc
MT
58 for i in green red blue orange; do
59 if [ "${i}" == "${1}" ]; then
60 eval "${i}=1"
61 shift
62 fi
63 done
37263bc1 64done
3fd5feeb 65
37263bc1 66case "${DO}" in
d1e90efc
MT
67 start)
68 [ "${ALL}" == "1" ] && init_networking
69
70 # Starting interfaces...
71 # GREEN
72 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start
73
74 # BLUE
75 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
76 /etc/rc.d/init.d/networking/blue start
77
78 # ORANGE
79 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
80 /etc/rc.d/init.d/networking/orange start
81
82 # RED
83 if [ "$red" == "1" ]; then
84 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
85 # Remove possible leftover files
86 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
87 [ "$AUTOCONNECT" == "off" ] || /etc/rc.d/init.d/networking/red start
88 fi
89 fi
90 ;;
91
92 stop)
93 # Stopping interfaces...
94 # GREEN
95 [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop
96
97 # BLUE
98 [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \
99 /etc/rc.d/init.d/networking/blue stop
100
101 # ORANGE
102 [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \
103 /etc/rc.d/init.d/networking/orange stop
104
105 # RED
106 if [ "$red" == "1" ]; then
107 if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
108 /etc/rc.d/init.d/networking/red stop
109 fi
110 fi
7be0be70
AF
111
112 # Stopping dnsmasq if network all networks shutdown
113 [ "${ALL}" == "1" ] && /etc/rc.d/init.d/dnsmasq stop
a4109682
AF
114
115 exit 0
d1e90efc
MT
116 ;;
117
118 restart)
119 for i in green red blue orange; do
120 if [ "${!i}" == "1" ]; then
121 ARGS+=" ${i}"
122 fi
123 done
124 ${0} stop ${ARGS}
125 sleep 1
126 ${0} start ${ARGS}
127 ;;
128
129 *)
130 echo "Usage: ${0} {start|stop|restart} [device(s)]"
131 exit 1
132 ;;
3fd5feeb
MT
133esac
134
135# End /etc/rc.d/init.d/network