aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/network
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-21 01:28:48 +0100
committerColin Guthrie <colin@mageia.org>2011-10-21 10:10:39 +0100
commitbe75c98a06d569fbaa2d86f92676af961795d094 (patch)
treee2ce8ce7ffb97af34164634a3fbd8630dc7463e8 /rc.d/init.d/network
parent4688ea25c9a5a87e48f89fc91a3c93a7c8c95b4a (diff)
downloadinitscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.gz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.bz2
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.xz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.zip
Add the mdkconf patch
Diffstat (limited to 'rc.d/init.d/network')
-rwxr-xr-xrc.d/init.d/network90
1 files changed, 70 insertions, 20 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index b31060b0..c10f5504 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -5,9 +5,16 @@
# chkconfig: - 10 90
# description: Activates/Deactivates all network interfaces configured to \
# start at boot time.
+# probe: false
#
### BEGIN INIT INFO
-# Provides: $network
+# Provides: network
+# Should-Start: harddrake irda resolvconf slmodemd
+# Should-Stop: irda resolvconf slmodemd
+# Default-Start: 2 3 4 5
+# Short-Description: Bring up/down networking
+# Description: Activates/Deactivates all network interfaces configured to
+# start at boot time.
# Should-Start: iptables ip6tables
# Short-Description: Bring up/down networking
# Description: Bring up/down networking
@@ -17,6 +24,7 @@
. /etc/init.d/functions
if [ ! -f /etc/sysconfig/network ]; then
+ echo "NETWORKING=no" > /etc/sysconfig/network
exit 6
fi
@@ -63,8 +71,12 @@ case "$1" in
sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
+ if [ -r /etc/ethers -a -x /sbin/arp ]; then
+ action "Storing ARP mapping" /sbin/arp -f /etc/ethers
+ fi
+
# bring up loopback interface
- action $"Bringing up loopback interface: " ./ifup ifcfg-lo
+ action "Bringing up loopback interface: " ./ifup ifcfg-lo
case "$IPX" in
yes|true)
@@ -75,11 +87,16 @@ case "$1" in
fi
;;
esac
+ # depreciated but we still use it.
+ if [ -f /proc/sys/net/ipv4/ip_forward ] && [[ "$FORWARD_IPV4" = "yes" || "$FORWARD_IPV4" = "true" ]];
+ then
+ action "Enabling IPv4 packet forwarding" sysctl -w net.ipv4.ip_forward=1
+ fi
case "$VLAN" in
yes)
if [ ! -d /proc/net/vlan ] && ! modprobe 8021q >/dev/null 2>&1 ; then
- echo $"No 802.1Q VLAN support available in kernel."
+ gprintf "No 802.1Q VLAN support available in kernel.\n"
fi
;;
esac
@@ -89,6 +106,14 @@ case "$1" in
xdslinterfaces=""
bridgeinterfaces=""
+ # do we have wireless cards?
+ iwconfig 2>/dev/null | grep IEEE > /dev/null
+ has_wifi=$?
+ # configure CRDA domain
+ if [ -n "${CRDA_DOMAIN}" -a -x /sbin/iw -a "$has_wifi" == 0 ]; then
+ action "Configuring wireless regulatory domain " /sbin/iw reg set ${CRDA_DOMAIN}
+ fi
+
# bring up all other interfaces configured to come up at boot time
for i in $interfaces; do
unset DEVICE TYPE SLAVE
@@ -102,7 +127,7 @@ case "$1" in
vpninterfaces="$vpninterfaces $i"
continue
fi
- if [ "$TYPE" = "xDSL" ]; then
+ if [ "$TYPE" = "xDSL" -o "$TYPE" = "ADSL" ]; then
xdslinterfaces="$xdslinterfaces $i"
continue
fi
@@ -131,11 +156,22 @@ case "$1" in
continue
fi
# If we're in confirmation mode, get user confirmation.
- if [ -f /var/run/confirm ]; then
- confirm $i
- test $? = 1 && continue
- fi
- action $"Bringing up interface $i: " ./ifup $i boot
+ [ -f /var/run/confirm ] &&
+ {
+ confirm $i
+ case $? in
+ 0)
+ :
+ ;;
+ 2)
+ CONFIRM=
+ ;;
+ *)
+ continue
+ ;;
+ esac
+ }
+ action "Bringing up interface %s: " $i ./ifup $DEVICE boot
[ $? -ne 0 ] && rc=1
done
@@ -147,7 +183,7 @@ case "$1" in
confirm $i
test $? = 1 && continue
fi
- action $"Bringing up interface $i: " ./ifup $i boot
+ action "Bringing up interface %s: " $i ./ifup $i boot
[ $? -ne 0 ] && rc=1
fi
done
@@ -165,10 +201,8 @@ case "$1" in
fi
# Run this again to catch any interface-specific actions
sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
-
- touch /var/lock/subsys/network
- [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY}
+ touch /var/lock/subsys/network
;;
stop)
[ "$EUID" != "0" ] && exit 4
@@ -219,7 +253,7 @@ case "$1" in
bridgeinterfaces="$bridgeinterfaces $i"
continue
fi
- if [ "$TYPE" = "xDSL" ]; then
+ if [ "$TYPE" = "xDSL" -o "$TYPE" = "ADSL" ]; then
xdslinterfaces="$xdslinterfaces $i"
continue
fi
@@ -236,7 +270,7 @@ case "$1" in
if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
if ! check_device_down $DEVICE; then
- action $"Shutting down interface $i: " ./ifdown $i boot
+ action "Shutting down interface %s: " $i ./ifdown $i boot
[ $? -ne 0 ] && rc=1
fi
)
@@ -250,9 +284,25 @@ case "$1" in
;;
esac
- action $"Shutting down loopback interface: " ./ifdown ifcfg-lo
+ action "Shutting down loopback interface: " ./ifdown ifcfg-lo
- sysctl -w net.ipv4.ip_forward=0 > /dev/null 2>&1
+ if [ -d /proc/sys/net/ipv4 ]; then
+ if [ -f /proc/sys/net/ipv4/ip_forward ]; then
+ if [ $(cat /proc/sys/net/ipv4/ip_forward) != 0 ]; then
+ action "Disabling IPv4 packet forwarding: " sysctl -w net.ipv4.ip_forward=0
+ fi
+ fi
+ if [ -f /proc/sys/net/ipv4/ip_always_defrag ]; then
+ if [ $(cat /proc/sys/net/ipv4/ip_always_defrag) != 0 ]; then
+ action "Disabling IPv4 automatic defragmentation: " sysctl -w net.ipv4.ip_always_defrag=0
+ fi
+ fi
+ fi
+ if [ -f /proc/sys/net/ipv4/tcp_syncookies ];then
+ if [ `cat /proc/sys/net/ipv4/tcp_syncookies` != 0 ]; then
+ sysctl -w net.ipv4.tcp_syncookies=0
+ fi
+ fi
# IPv6 hook (post IPv4 stop)
if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
@@ -262,10 +312,10 @@ case "$1" in
rm -f /var/lock/subsys/network
;;
status)
- echo $"Configured devices:"
+ gprintf "Configured devices:\n"
echo lo $interfaces
- echo $"Currently active devices:"
+ gprintf "Currently active devices:\n"
echo $(/sbin/ip -o link show up | awk -F ": " '{ print $2 }')
;;
restart|reload|force-reload)
@@ -275,7 +325,7 @@ case "$1" in
rc=$?
;;
*)
- echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
+ gprintf "Usage: %s\n" "$(basename $0) {start|stop|restart|reload|status}"
exit 2
esac