diff options
-rw-r--r-- | initscripts.spec | 7 | ||||
-rwxr-xr-x | rc.d/init.d/network | 22 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-aliases | 40 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-post | 6 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-routes | 22 |
5 files changed, 79 insertions, 18 deletions
diff --git a/initscripts.spec b/initscripts.spec index 580edf13..b1e46026 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: inittab and /etc/rc.d scripts Name: initscripts -%define version 3.55 +%define version 3.56 Version: %{version} Copyright: GPL Group: Base @@ -17,6 +17,11 @@ that activate and deactivate most network interfaces. %changelog +* Sat May 02 1998 Michael K. Johnson <johnsonm@redhat.com> + +- Added lots of linuxconf support. Should still work on systems that + do not have linuxconf installed, but linuxconf gives enhanced support. + * Fri May 01 1998 Erik Troan <ewt@redhat.com> - rc.sysinit uses preferred directory diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 30dea69a..dcf70b91 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -33,10 +33,8 @@ cd /etc/sysconfig/network-scripts interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$' | \ sed 's/^ifcfg-//g'` - -# See how we were called. -case "$1" in - start) +ipv4_forward_set () +{ # 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?). @@ -61,6 +59,13 @@ case "$1" in fi fi fi +} + + +# See how we were called. +case "$1" in + start) + ipv4_forward_set ./ifup ifcfg-lo for i in $interfaces; do @@ -100,6 +105,9 @@ case "$1" in reload) if [ -x /bin/linuxconf ] ; then eval `/bin/linuxconf --hint netdev` + if [ "$RECONF_IPV4ROUTING" = "yes" ] ; then + ipv4_forward_set + fi for device in $DEV_UP ; do ./ifup $device done @@ -123,10 +131,14 @@ case "$1" in probe) if [ -x /bin/linuxconf ] ; then eval `/bin/linuxconf --hint netdev` - [ -n "$DEV_UP$DEV_DOWN$DEV_RECONF$DEV_RECONF_ALIASES$DEV_RECONF_ROUTES" ] && \ + [ -n "$DEV_UP$DEV_DOWN$DEV_RECONF$DEV_RECONF_ALIASES" -o \ + -n "$DEV_RECONF_ROUTES" -o \ + "$RECONF_IPV4ROUTING" = yes ] && \ echo reload exit 0 else + # if linuxconf isn't around to figure stuff out for us, + # we punt. exit 0 fi ;; diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases new file mode 100755 index 00000000..39233819 --- /dev/null +++ b/sysconfig/network-scripts/ifup-aliases @@ -0,0 +1,40 @@ +#!/bin/sh + +# adds aliases of device $1 + +if [ "$1" = "" ]; then + echo "usage: $0 <net-device>" + exit 1 +fi + +if [ -x /bin/linuxconf ] ; then + # ask linuxconf for lines like: + # add <device> <ip> + # del <device> + # reload <number_of_aliases> + linuxconf --hint ipalias $1 | while read verb arg1 arg2 ; do + case $verb in + add) + /sbin/ifconfig $arg1 $arg2 + /sbin/route add $arg2 $arg1 + ;; + del) + # the <device>- 0.0.0.0 tells the kernel to remove the device + # it is necessary to remove it in order for reload to work. + /sbin/ifconfig ${arg1}- 0.0.0.0 + ;; + reload) + echo $arg1 > /proc/sys/net/core/net_alias_max + ;; + esac + done + +else + # we don't have linuxconf to fall back on, so presumably we do + # not have to parse linuxconf ipalias ranges, either. + allow_null_glob_expansion=foo + for alias in /etc/sysconfig/network-scripts/ifcfg-$1:* ; do + /etc/sysconfig/network-scripts/ifup $alias + done + unset allow_null_glob_expansion +fi diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post index 6dee839a..414bae6a 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -19,11 +19,7 @@ fi /etc/sysconfig/network-scripts/ifup-routes ${DEVICE} if [ "$ISALIAS" = no ] ; then - allow_null_glob_expansion=foo - for alias in /etc/sysconfig/network-scripts/ifcfg-${DEVICE}:* ; do - /etc/sysconfig/network-scripts/ifup $alias - done - unset allow_null_glob_expansion + /etc/sysconfig/network-scripts/ifup-aliases ${DEVICE} fi if [ -n "$NEEDHOSTNAME" -a ${DEVICE} != lo ]; then diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes index f8006b8b..6cae8d4c 100755 --- a/sysconfig/network-scripts/ifup-routes +++ b/sysconfig/network-scripts/ifup-routes @@ -7,11 +7,19 @@ if [ "$1" = "" ]; then exit 1 fi -if [ ! -f /etc/sysconfig/static-routes ]; then - exit 0 -fi +if [ -x /bin/linuxconf ] ; then + rm -f /var/run/routes.current + linuxconf --hint routing "$1" | while read args; do + /sbin/route $args + echo $args >> /var/run/routes.current + done +else + if [ ! -f /etc/sysconfig/static-routes ]; then + exit 0 + fi -#note the trailing space in the grep gets rid of aliases -grep "^$1 " /etc/sysconfig/static-routes | while read device args; do - /sbin/route add -$args $device -done + #note the trailing space in the grep gets rid of aliases + grep "^$1 " /etc/sysconfig/static-routes | while read device args; do + /sbin/route add -$args $device + done +fi |