aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael K. Johnson <johnsonm@redhat.com>1997-11-06 21:44:49 +0000
committerMichael K. Johnson <johnsonm@redhat.com>1997-11-06 21:44:49 +0000
commitaf7db8bfe1b2bdbaba40e5deb5ff8967fba54a63 (patch)
tree33f6b36df8202f89d56a26f2b5c2a2bcf2f2c29b
parent9567a9b499876a30b0f7884a0b30847b61dc85c7 (diff)
downloadinitscripts-af7db8bfe1b2bdbaba40e5deb5ff8967fba54a63.tar
initscripts-af7db8bfe1b2bdbaba40e5deb5ff8967fba54a63.tar.gz
initscripts-af7db8bfe1b2bdbaba40e5deb5ff8967fba54a63.tar.bz2
initscripts-af7db8bfe1b2bdbaba40e5deb5ff8967fba54a63.tar.xz
initscripts-af7db8bfe1b2bdbaba40e5deb5ff8967fba54a63.zip
only enable/disable forwarding on start, always disable on stop.r3-24
-rwxr-xr-xrc.d/init.d/network48
1 files changed, 27 insertions, 21 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 45346aba..8d90bad8 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -19,27 +19,6 @@ if [ -f /etc/sysconfig/pcmcia ]; then
. /etc/sysconfig/pcmcia
fi
-# Turn IP forwarding on or off. We do this before bringing up the interfaces
-# to make sure we don't forward when we shouldn't, and we do it even if
-# networking isn't configured (why not?).
-if [ -d /proc/sys/net/ipv4 ]; then
- # people could have left this out of their kernel, which isn't
- # exactly an error
- if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
- echo "/proc/sys/net/ipv4/ip_forward is missing --" \
- "cannot control IP forwarding" >&2
- else
- if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
- value=0
- echo "Disabling IPv4 packet forwarding."
- else
- value=1
- echo "Enabling IPv4 packet forwarding."
- fi
-
- echo "$value" > /proc/sys/net/ipv4/ip_forward
- fi
-fi
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
@@ -55,6 +34,31 @@ interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$'`
# See how we were called.
case "$1" in
start)
+ # Turn IP forwarding on or off. We do this before bringing up the
+ # interfaces to make sure we don't forward when we shouldn't, and
+ # we do it even if networking isn't configured (why not?).
+ if [ -d /proc/sys/net/ipv4 ]; then
+ # people could have left this out of their kernel, which isn't
+ # exactly an error
+ if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
+ echo "/proc/sys/net/ipv4/ip_forward is missing --" \
+ "cannot control IP forwarding" >&2
+ else
+ if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
+ value=0
+ message="Disabling IPv4 packet forwarding."
+ else
+ value=1
+ message="Enabling IPv4 packet forwarding."
+ fi
+
+ if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ];
+ echo $message
+ echo "$value" > /proc/sys/net/ipv4/ip_forward
+ fi
+ fi
+ fi
+
./ifup ifcfg-lo
for i in $interfaces; do
./ifup $i boot
@@ -67,6 +71,8 @@ case "$1" in
./ifdown $i boot
done
./ifdown ifcfg-lo
+ echo "Disabling IPv4 packet forwarding."
+ echo 0 > /proc/sys/net/ipv4/ip_forward
rm -f /var/lock/subsys/network
;;
status)