From b4ef0a651227d7ec469539f22a14cac5514ee86e Mon Sep 17 00:00:00 2001 From: Preston Brown Date: Fri, 14 Sep 2001 19:07:31 +0000 Subject: remove remnants of LinuxConf. Don't use ifconfig, only /sbin/ip. Use check_device_down from network-functions instead of re-implementation. --- rc.d/init.d/network | 91 ++++++++++------------------------------------------- 1 file changed, 17 insertions(+), 74 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 009f9bc6..a185b934 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -24,7 +24,8 @@ fi # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 -[ -x /sbin/ifconfig ] || exit 0 +# if the ip configuration utility isn't around we can't function. +[ -x /sbin/ip ] || exit 1 # Even if IPX is configured, without the utilities we can't do much [ ! -x /sbin/ipx_internal_net -o ! -x /sbin/ipx_configure ] && IPX= @@ -62,7 +63,8 @@ case "$1" in action $"Setting network parameters: " sysctl -e -p /etc/sysctl.conf - action $"Bringing up interface lo: " ./ifup ifcfg-lo + # bring up loopback interface + action $"Bringing up loopback interface: " ./ifup ifcfg-lo case "$IPX" in yes|true) @@ -74,9 +76,11 @@ case "$1" in ;; esac - oldhotplug=`sysctl kernel.hotplug 2>/dev/null| awk '{ print $3 }' 2>/dev/null` + oldhotplug=`sysctl kernel.hotplug 2>/dev/null | \ + awk '{ print $3 }' 2>/dev/null` sysctl -w kernel.hotplug="/bin/true" > /dev/null 2>&1 + # bring up all other interfaces configured to come up at boot time for i in $interfaces; do if [ "${i##eth}" != "$i" ] && ! is_available $i ; then continue @@ -104,7 +108,7 @@ case "$1" in action $"Bringing up interface $i: " ./ifup $i boot done - # add cipe here. + # Bring up CIPE VPN interfaces cipeinterfaces=`ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|rpmsave|rpmorig|rpmnew)' | \ LANG=C egrep -v '(~|\.bak)$' | \ LANG=C egrep 'ifcfg-cipcb[0-9]+$' | \ @@ -169,8 +173,9 @@ case "$1" in fi fi + # shut down all interfaces (other than loopback) for i in $interfaces ; do - if LC_ALL= LANG= ifconfig $i 2>/dev/null | grep -q " UP " >/dev/null 2>&1 ; then + if ! check_device_down $i; then action $"Shutting down interface $i: " ./ifdown $i boot fi done @@ -181,7 +186,9 @@ case "$1" in fi ;; esac - ./ifdown ifcfg-lo + + action $"Shutting down loopback interface: " ./ifdown ifcfg-lo + 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 @@ -208,80 +215,16 @@ case "$1" in echo $"Configured devices:" echo lo $interfaces - if [ -x /sbin/linuxconf ] ; then - eval `/sbin/linuxconf --hint netdev` - echo $"Devices that are down:" - echo $DEV_UP - echo $"Devices with modified configuration:" - echo $DEV_RECONF - else - echo $"Currently active devices:" - echo `/sbin/ifconfig | grep ^[a-z] | awk '{print $1}'` - fi + echo $"Currently active devices:" + echo `/sbin/ip -o link show | awk -F ": " '{ print $2 }'` ;; - restart) + restart|reload) cd $CWD $0 stop $0 start ;; - reload) - if [ -x /sbin/linuxconf ] ; then - eval `/sbin/linuxconf --hint netdev` - for device in $DEV_UP ; do - action $"Bringing up device $device: " ./ifup $device - done - for device in $DEV_DOWN ; do - action $"Shutting down device $device: " ./ifdown $device - done - for device in $DEV_RECONF ; do - action $"Shutting down device $device: " ./ifdown $device - action $"Bringing up device $device: " ./ifup $device - done - for device in $DEV_RECONF_ALIASES ; do - action $"Bringing up alias $device: " /etc/sysconfig/network-scripts/ifup-aliases $device - done - for device in $DEV_RECONF_ROUTES ; do - action $"Bringing up route $device: " /etc/sysconfig/network-scripts/ifup-routes $device - done - case $IPX in yes|true) - case $IPXINTERNALNET in - reconf) - action $"Deleting internal IPX network: " /sbin/ipx_internal_net del - action $"Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM: " /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ - $IPXINTERNALNODENUM - ;; - add) - action $"Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM: " /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ - $IPXINTERNALNODENUM - ;; - del) - action $"Deleting internal IPX network: " /sbin/ipx_internal_net del - ;; - esac - ;; - esac - else - cd $CWD - $0 restart - fi - ;; - probe) - if [ -x /sbin/linuxconf ] ; then - eval `/sbin/linuxconf --hint netdev` - [ -n "$DEV_UP$DEV_DOWN$DEV_RECONF$DEV_RECONF_ALIASES" -o \ - -n "$DEV_RECONF_ROUTES$IPXINTERNALNET" ] && \ - echo reload - exit 0 - else - # if linuxconf isn't around to figure stuff out for us, - # we punt. Probably better than completely reloading - # networking if user isn't sure which to do. If user - # is sure, they would run restart or reload, not probe. - exit 0 - fi - ;; *) - echo $"Usage: $0 {start|stop|restart|reload|status|probe}" + echo $"Usage: $0 {start|stop|restart|reload|status}" exit 1 esac -- cgit v1.2.1