diff options
Diffstat (limited to 'rc.d')
-rw-r--r-- | rc.d/init.d/functions | 189 | ||||
-rw-r--r-- | rc.d/init.d/netconsole | 23 | ||||
-rwxr-xr-x | rc.d/init.d/network | 101 |
3 files changed, 236 insertions, 77 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 8c4d2573..33f9eb20 100644 --- 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,14 +51,15 @@ 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 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 @@ -61,11 +69,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 @@ -75,7 +111,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" @@ -93,6 +129,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 @@ -148,7 +238,7 @@ daemon() { nicelevel=0 while [ "$1" != "${1##[-+]}" ]; do case $1 in - '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" + '') gprintf "%s: Usage: daemon [+/-nicelevel] {program}\n" $0 return 1;; --check) base=$2 @@ -184,7 +274,7 @@ daemon() { nice="nice -n $1" shift ;; - *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" + *) gprintf "%s: Usage: daemon [+/-nicelevel] {program}\n" $0 return 1;; esac done @@ -223,10 +313,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. @@ -236,7 +327,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 @@ -270,6 +361,9 @@ 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 " @@ -293,14 +387,14 @@ killproc() { fi checkpid $pid RC=$? - [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$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 @@ -309,7 +403,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 @@ -326,8 +420,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 @@ -342,7 +436,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 @@ -368,7 +462,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 @@ -393,21 +487,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 @@ -416,10 +510,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 } @@ -427,7 +521,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" @@ -438,7 +532,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" @@ -449,7 +543,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" @@ -460,7 +554,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" @@ -469,14 +563,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 } @@ -484,14 +579,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 } @@ -499,18 +601,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 a314d9d2..afac33d3 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 +# Provides: network +# Should-Start: irda resolvconf iptables ip6tables 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 @@ -43,18 +48,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 @@ -63,8 +70,12 @@ case "$1" in apply_sysctl + 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 +86,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 - net_log $"No 802.1Q VLAN support available in kernel." + gprintf "No 802.1Q VLAN support available in kernel.\n" fi ;; esac @@ -89,24 +105,35 @@ 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 - eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) - eval $(LANG=C grep -F "TYPE=" ifcfg-$i) - eval $(LANG=C grep -F "SLAVE=" ifcfg-$i) + eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i") + eval $(LANG=C grep -F "TYPE=" "ifcfg-$i") + eval $(LANG=C grep -F "SLAVE=" "ifcfg-$i") if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi if [ "$SLAVE" = "yes" ]; then continue fi + if [ "$TYPE" = "Wireless" ]; then + continue + fi if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then vpninterfaces="$vpninterfaces $i" continue fi - if [ "$TYPE" = "xDSL" ]; then + if [ "$TYPE" = "xDSL" -o "$TYPE" = "ADSL" ]; then xdslinterfaces="$xdslinterfaces $i" continue fi @@ -125,19 +152,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 @@ -161,8 +188,6 @@ case "$1" in apply_sysctl touch /var/lock/subsys/network - - [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY} ;; stop) [ "$EUID" != "0" ] && exit 4 @@ -185,11 +210,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 @@ -202,7 +231,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 @@ -216,11 +245,11 @@ 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 ) @@ -234,9 +263,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 @@ -246,10 +291,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) @@ -259,7 +304,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 |