aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-x[-rw-r--r--]rc.d/init.d/functions186
-rw-r--r--rc.d/init.d/netconsole23
-rwxr-xr-xrc.d/init.d/network94
3 files changed, 230 insertions, 73 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 0f1d0420..00a4984c 100644..100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -5,6 +5,13 @@
#
TEXTDOMAIN=initscripts
+TEXTDOMAINDIR=/etc/locale
+LOCPATH=/etc/locale
+export TEXTDOMAINDIR LOCPATH
+
+TMP=/tmp
+TMPDIR=/tmp
+export TMP TMPDIR
# Make sure umask is sane
umask 022
@@ -44,7 +51,10 @@ systemctl_redirect () {
esac
if [ -n "$SYSTEMCTL_IGNORE_DEPENDENCIES" ] ; then
- options="--ignore-dependencies"
+ options="$options --ignore-dependencies"
+ fi
+ if [ -n "$SYSTEMCTL_NO_BLOCK" ] ; then
+ options="$options --no-block"
fi
if ! systemctl show "$prog.service" > /dev/null 2>&1 || \
@@ -55,8 +65,6 @@ systemctl_redirect () {
action "$s" /bin/systemctl $options $command "$prog.service"
}
-# Get a sane screen width
-[ -z "${COLUMNS:-}" ] && COLUMNS=80
if [ -z "${CONSOLETYPE:-}" ]; then
if [ -c "/dev/stderr" -a -r "/dev/stderr" ]; then
@@ -66,11 +74,39 @@ if [ -z "${CONSOLETYPE:-}" ]; then
fi
fi
-if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then
- . /etc/profile.d/lang.sh 2>/dev/null
- # avoid propagating LANGSH_SOURCED any further
- unset LANGSH_SOURCED
-fi
+# Get a sane screen width, and default to 80 when exact info not available
+[ -z "${COLUMNS:-}" ] && COLUMNS=`stty -a 2>/dev/null | sed -n 's/.*columns \([0-9]*\);.*/\1/p'`
+[ -z "${COLUMNS:-}" ] && COLUMNS=80
+
+function load_i18_settings() {
+ if [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ]; then
+ if [ -z "$NOLOCALE" ]; then
+ if [ -f /etc/locale.conf ]; then
+ . /etc/locale.conf
+ else
+ . /etc/sysconfig/i18n
+ fi
+ if [ "$CONSOLETYPE" != "pty" ]; then
+ [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANG=C
+ [ "$CONSOLE_NOT_LOCALIZED" = "yes" ] && GP_LANGUAGE=C
+ fi
+ if [ -z "$GP_LANG" ]; then
+ [ -n "$LC_CTYPE" ] && GP_LANG=$LC_CTYPE || GP_LANG=$LC_MESSAGES
+ fi
+ if [ -z "$GP_LANGUAGE" ]; then
+ [ -n "$LANGUAGE" ] && GP_LANGUAGE=$LANGUAGE || GP_LANGUAGE=$GP_LANG
+ fi
+ fi
+ fi
+}
+
+function reset_i18_settings() {
+ local CONSOLE_NOT_LOCALIZED=yes
+ LC_ALL=C
+ load_i18_settings
+}
+
+load_i18_settings
# Read in our configuration
if [ -z "${BOOTUP:-}" ]; then
@@ -80,7 +116,7 @@ if [ -z "${BOOTUP:-}" ]; then
# This all seem confusing? Look in /etc/sysconfig/init,
# or in /usr/share/doc/initscripts-*/sysconfig.txt
BOOTUP=color
- RES_COL=60
+ RES_COL=$((COLUMNS - 15))
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
@@ -98,6 +134,60 @@ if [ -z "${BOOTUP:-}" ]; then
fi
fi
+gprintf() {
+ if [ -x /bin/gettext -a -n "$1" ]; then
+ if [ -n "$GP_LANG" ]; then
+ local TEXT=`LC_ALL=$GP_LANG LANGUAGE=$GP_LANGUAGE gettext -e --domain=$TEXTDOMAIN -- "$1"`
+ else
+ local TEXT=`gettext -e --domain=$TEXTDOMAIN -- "$1"`
+ fi
+ else
+ local TEXT=$1
+ fi
+ [ "${1#*\\n}" ] || TEXT="$TEXT\n"
+
+ shift
+ printf -- "$TEXT" "$@"
+}
+
+# Frontend to gprintf (support up to 4 %s in format string)
+# returns the message transleted in GPRINTF_MSG and
+# the resting parms in GPRINTF_REST
+# This simplifies a lot the call of functions like action,
+# now with i18n support
+gprintf_msg_rest() {
+case "$1" in
+ *%s*%s*%s*%s*)
+ GPRINTF_MSG=$(gprintf "$1" "$2" "$3" "$4" "$5")
+ shift 5;;
+ *%s*%s*%s*)
+ GPRINTF_MSG=$(gprintf "$1" "$2" "$3" "$4")
+ shift 4;;
+ *%s*%s*)
+ GPRINTF_MSG=$(gprintf "$1" "$2" "$3")
+ shift 3;;
+ *%s*)
+ GPRINTF_MSG=$(gprintf "$1" "$2")
+ shift 2;;
+ *)
+ GPRINTF_MSG=$(gprintf "$1")
+ shift;;
+esac
+GPRINTF_REST="$@"
+}
+
+# Check if $pid (could be plural) are running with
+# the same root as this script
+inmyroot() {
+ local i r
+
+ for i in $* ; do
+ [ "/proc/$i/root" -ef "/proc/$$/root" ] && r="$r $i"
+ done
+ echo "$r"
+}
+
+
# Check if any of $pid (could be plural) are running
checkpid() {
local i
@@ -297,10 +387,11 @@ daemon() {
if [ -z "$user" ]; then
$cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*"
else
- $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*"
+ $cgroup $nice su -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $*"
fi
-
- [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
+ rc=$?
+ [ $rc = 0 ] && success "%s startup" $base || failure "%s startup" $base
+ return $rc
}
# A function to stop a program.
@@ -310,7 +401,7 @@ killproc() {
RC=0; delay=3; try=0
# Test syntax.
if [ "$#" -eq 0 ]; then
- echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
+ gprintf "Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
return 1
fi
if [ "$1" = "-p" ]; then
@@ -344,19 +435,23 @@ killproc() {
fi
fi
+ # Avoid killing processes not running in the same root
+ [ -n "$pid" ] && pid="`inmyroot $pid`"
+
# Kill it.
if [ -n "$pid" ] ; then
[ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base "
if [ -z "$killlevel" ] ; then
__kill_pids_term_kill -d $delay $pid
RC=$?
- [ "$RC" -eq 0 ] && success $"$base shutdown" || failure $"$base shutdown"
+ [ "$RC" -eq 0 ] && failure "%s shutdown" $base || success "%s shutdown" $base
+ RC=$((! $RC))
# use specified level only
else
if checkpid $pid; then
kill $killlevel $pid >/dev/null 2>&1
RC=$?
- [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel"
+ [ "$RC" -eq 0 ] && success "%s %s" $base $killlevel || failure "%s %s" $base $killlevel
elif [ -n "${LSB:-}" ]; then
RC=7 # Program is not running
fi
@@ -365,7 +460,7 @@ killproc() {
if [ -n "${LSB:-}" -a -n "$killlevel" ]; then
RC=7 # Program is not running
else
- failure $"$base shutdown"
+ failure "%s shutdown" $base
RC=0
fi
fi
@@ -382,8 +477,8 @@ pidfileofproc() {
local pid
# Test syntax.
- if [ "$#" = 0 ] ; then
- echo $"Usage: pidfileofproc {program}"
+ if [ "$#" -eq 0 ] ; then
+ gprintf "Usage: pidfileofproc {program}\n"
return 1
fi
@@ -398,7 +493,7 @@ pidofproc() {
# Test syntax.
if [ "$#" = 0 ]; then
- echo $"Usage: pidofproc [-p pidfile] {program}"
+ gprintf "Usage: pidofproc [-p pidfile] {program}\n"
return 1
fi
if [ "$1" = "-p" ]; then
@@ -424,7 +519,7 @@ status() {
# Test syntax.
if [ "$#" = 0 ] ; then
- echo $"Usage: status [-p pidfile] {program}"
+ gprintf "Usage: status [-p pidfile] {program}\n"
return 1
fi
if [ "$1" = "-p" ]; then
@@ -456,21 +551,21 @@ status() {
pid="$(__pids_pidof "$1")"
fi
if [ -n "$pid" ]; then
- echo $"${base} (pid $pid) is running..."
+ gprintf "%s (pid %s) is running...\n" ${base} "$pid"
return 0
fi
case "$RC" in
0)
- echo $"${base} (pid $pid) is running..."
+ gprintf "%s (pid %s) is running...\n" ${base} "$pid"
return 0
;;
1)
- echo $"${base} dead but pid file exists"
+ gprintf "%s dead but pid file exists\n" ${base}
return 1
;;
4)
- echo $"${base} status unknown due to insufficient privileges."
+ gprintf "%s status unknown due to insufficient privileges." ${base}
return 4
;;
esac
@@ -479,10 +574,10 @@ status() {
fi
# See if /var/lock/subsys/${lock_file} exists
if [ -f /var/lock/subsys/${lock_file} ]; then
- echo $"${base} dead but subsys locked"
+ gprintf "%s dead but subsys locked\n" ${base}
return 2
fi
- echo $"${base} is stopped"
+ gprintf "%s is stopped\n" ${base}
return 3
}
@@ -490,7 +585,7 @@ echo_success() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
- echo -n $" OK "
+ gprintf " OK "
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
@@ -501,7 +596,7 @@ echo_failure() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
- echo -n $"FAILED"
+ gprintf "FAILED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
@@ -512,7 +607,7 @@ echo_passed() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
- echo -n $"PASSED"
+ gprintf "PASSED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
@@ -523,7 +618,7 @@ echo_warning() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
- echo -n $"WARNING"
+ gprintf "WARNING"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
@@ -532,14 +627,15 @@ echo_warning() {
# Inform the graphical boot of our current state
update_boot_stage() {
- if [ -x /bin/plymouth ]; then
- /bin/plymouth --update="$1"
- fi
- return 0
+ rc_splash "$1"
}
# Log that something succeeded
success() {
+ gprintf_msg_rest "$@"
+ #if [ -z "${IN_INITLOG:-}" ]; then
+ # initlog $INITLOG_ARGS -n $0 -s "$GPRINTF_MSG" -e 1
+ #fi
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
return 0
}
@@ -547,14 +643,21 @@ success() {
# Log that something failed
failure() {
local rc=$?
+ gprintf_msg_rest "$@"
+ #if [ -z "${IN_INITLOG:-}" ]; then
+ # initlog $INITLOG_ARGS -n $0 -s "$GPRINTF_MSG" -e 2
+ #fi
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure
- [ -x /bin/plymouth ] && /bin/plymouth --details
return $rc
}
# Log that something passed, but may have had errors. Useful for fsck
passed() {
local rc=$?
+ gprintf_msg_rest "$@"
+ #if [ -z "${IN_INITLOG:-}" ]; then
+ # initlog $INITLOG_ARGS -n $0 -s "$GPRINTF_MSG" -e 1
+ #fi
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed
return $rc
}
@@ -562,18 +665,21 @@ passed() {
# Log a warning
warning() {
local rc=$?
+ gprintf_msg_rest "$@"
+ #if [ -z "${IN_INITLOG:-}" ]; then
+ # initlog $INITLOG_ARGS -n $0 -s "$1" -e 1
+ #fi
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning
return $rc
}
# Run some action. Log its output.
action() {
- local STRING rc
+ local rc
+ gprintf_msg_rest "$@"
+ echo -n "$GPRINTF_MSG "
- STRING=$1
- echo -n "$STRING "
- shift
- "$@" && success $"$STRING" || failure $"$STRING"
+ $GPRINTF_REST && success "$GPRINTF_MSG" || failure "$GPRINTF_MSG"
rc=$?
echo
return $rc
diff --git a/rc.d/init.d/netconsole b/rc.d/init.d/netconsole
index 1b10af2d..63e23897 100644
--- a/rc.d/init.d/netconsole
+++ b/rc.d/init.d/netconsole
@@ -6,6 +6,15 @@
# description: Initializes network console logging
# config: /etc/sysconfig/netconsole
#
+### BEGIN INIT INFO
+# Provides: netconsole
+# Required-Start: $network
+# Required-Stop: $network
+# Short-Description: Initializes network console logging
+# Description: By starting this service you allow a remote syslog daemon
+# to record console output from this system.
+### END INIT INFO
+
# Copyright 2002 Red Hat, Inc.
#
# Based in part on a shell script by
@@ -33,7 +42,7 @@ kernel=$(uname -r | cut -d. -f1-2)
usage ()
{
- echo $"Usage: $0 {start|stop|status|restart|condrestart}" 1>&2
+ gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" $0 1>&2
RETVAL=2
}
@@ -73,13 +82,13 @@ start ()
fi
fi
if [ -z "$SYSLOGADDR" ] ; then
- echo $"Server address not specified in /etc/sysconfig/netconsole" 1>&2
+ gprintf "Server address not specified in /etc/sysconfig/netconsole\n" 1>&2
exit 6
fi
eval $(print_address_info $SYSLOGADDR)
if [ -z "$SYSLOGMACADDR" ]; then
- echo $"netconsole: can't resolve MAC address of $SYSLOGADDR" 1>&2
+ gprintf "netconsole: can't resolve MAC address of %s\n" $SYSLOGADDR 1>&2
exit 1
fi
@@ -88,7 +97,7 @@ start ()
/usr/bin/logger -p daemon.info -t netconsole: inserting netconsole module with arguments \
$SYSLOGOPTS
if [ -n "$SYSLOGOPTS" ]; then
- action $"Initializing netconsole" modprobe netconsole \
+ action "Initializing netconsole" modprobe netconsole \
$SYSLOGOPTS
[ "$?" != "0" ] && RETVAL=1
fi
@@ -98,7 +107,7 @@ start ()
stop ()
{
if /sbin/lsmod | grep netconsole >/dev/null 2>&1 ; then
- action $"Disabling netconsole" rmmod netconsole;
+ action "Disabling netconsole" rmmod netconsole;
[ "$?" != "0" ] && RETVAL=1
fi
@@ -108,10 +117,10 @@ stop ()
status ()
{
if /sbin/lsmod | grep netconsole >/dev/null 2>&1 ; then
- echo $"netconsole module loaded"
+ gprintf "netconsole module loaded\n"
RETVAL=0
else
- echo $"netconsole module not loaded"
+ gprintf "netconsole module not loaded\n"
RETVAL=3
fi
}
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 24306888..6f6d4d8d 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -5,18 +5,23 @@
# chkconfig: - 10 90
# description: Activates/Deactivates all network interfaces configured to \
# start at boot time.
+# probe: false
#
### BEGIN INIT INFO
-# Provides: $network
-# Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager $network-pre
+# Provides: network
+# Should-Start: irda resolvconf iptables ip6tables NetworkManager-wait-online NetworkManager
+# Should-Stop: irda resolvconf
+# Default-Start: 2 3 4 5
# Short-Description: Bring up/down networking
-# Description: Bring up/down networking
+# Description: Activates/Deactivates all network interfaces configured to
+# start at boot time.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ ! -f /etc/sysconfig/network ]; then
+ echo "NETWORKING=no" > /etc/sysconfig/network
exit 6
fi
@@ -41,18 +46,20 @@ cd /etc/sysconfig/network-scripts
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
-interfaces=$(ls ifcfg-* | \
+interfaces=$(/bin/ls ifcfg* | \
LC_ALL=C sed -e "$__sed_discard_ignored_files" \
-e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
- -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \
+ -e '/ifcfg-[ A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
+ LC_ALL=C grep -v '^ifcfg-' | \
LC_ALL=C sort -k 1,1 -k 2n | \
- LC_ALL=C sed 's/ //')
+ LC_ALL=C sed -e 's/ \([0-9]\)/\1/')
rc=0
# See how we were called.
case "$1" in
start)
[ "$EUID" != "0" ] && exit 4
+
rc=0
# IPv6 hook (pre IPv4 start)
if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
@@ -67,12 +74,18 @@ case "$1" in
fi
# bring up loopback interface
- action $"Bringing up loopback interface: " ./ifup ifcfg-lo
+ action "Bringing up loopback interface: " ./ifup ifcfg-lo
+
+ # 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
- net_log $"No 802.1Q VLAN support available in kernel."
+ gprintf "No 802.1Q VLAN support available in kernel.\n"
fi
;;
esac
@@ -82,6 +95,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
@@ -92,7 +113,10 @@ case "$1" in
if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
- if [ "$SLAVE" = "yes" ] && ( ! is_nm_running || is_false $NM_CONTROLLED ) ; then
+ if [ "$SLAVE" = "yes" ] && ( ! is_nm_running || is_false $NM_CONTROLLED ) ; then
+ continue
+ fi
+ if [ "$TYPE" = "Wireless" ]; then
continue
fi
@@ -100,7 +124,7 @@ case "$1" in
vpninterfaces="$vpninterfaces $i"
continue
fi
- if [ "$TYPE" = "xDSL" -o "$TYPE" = "Modem" ]; then
+ if [ "$TYPE" = "xDSL" -o "$TYPE" = "ADSL" -o "$TYPE" = "Modem" ]; then
xdslinterfaces="$xdslinterfaces $i"
continue
fi
@@ -119,19 +143,19 @@ case "$1" in
continue
fi
- if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then
+ if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i" > /dev/null ; then
# this loads the module, to preserve ordering
is_available $i
continue
fi
- action $"Bringing up interface $i: " ./ifup $i boot
+ action "Bringing up interface %s: " $i ./ifup $DEVICE boot
[ $? -ne 0 ] && rc=1
done
# Bring up xDSL and VPN interfaces
for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do
- if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then
- action $"Bringing up interface $i: " ./ifup $i boot
+ if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" "ifcfg-$i" >/dev/null 2>&1 ; then
+ action "Bringing up interface %s: " $i ./ifup $i boot
[ $? -ne 0 ] && rc=1
fi
done
@@ -155,8 +179,6 @@ case "$1" in
apply_sysctl
touch /var/lock/subsys/network
-
- [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY}
;;
stop)
[ "$EUID" != "0" ] && exit 4
@@ -180,11 +202,15 @@ case "$1" in
# get list of bonding, vpn, and xdsl interfaces
for i in $interfaces; do
unset DEVICE TYPE
- eval $(LANG=C grep -F "DEVICE=" ifcfg-$i)
- eval $(LANG=C grep -F "TYPE=" ifcfg-$i)
+ eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i")
+ eval $(LANG=C grep -F "TYPE=" "ifcfg-$i")
if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
+ if [ "$TYPE" = "Wireless" ]; then
+ continue
+ fi
+
if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then
vpninterfaces="$vpninterfaces $i"
continue
@@ -197,7 +223,7 @@ case "$1" in
bridgeinterfaces="$bridgeinterfaces $i"
continue
fi
- if [ "$TYPE" = "xDSL" -o "$TYPE" = "Modem" ]; then
+ if [ "$TYPE" = "xDSL" -o "$TYPE" = "ADSL" -o "$TYPE" = "Modem" ]; then
xdslinterfaces="$xdslinterfaces $i"
continue
fi
@@ -211,19 +237,35 @@ case "$1" in
for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do
unset DEVICE TYPE
- (. ./ifcfg-$i
+ (. "./ifcfg-$i"
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
)
done
- 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
@@ -233,10 +275,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)
@@ -246,7 +288,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