]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Avoid bringing down eth0 in case of bad config.
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 18 Oct 2006 12:22:28 +0000 (12:22 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 18 Oct 2006 12:22:28 +0000 (12:22 +0000)
svn-id: @7868

sysconfig/network-scripts/functions.network

index 14f08a80e1f9a3eee05c731130fa8fff871c8a4a..acef8ef4a131705ddc2a59d16970326cb0170631 100644 (file)
@@ -16,6 +16,15 @@ source_config ()
        elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ] ; then
                . "/etc/sysconfig/interfaces/$CONFIG"
        fi
+
+       # This is sanity check so that if you've copied ifcfg-eth0 to ifcfg-eth1
+       # and forgot to alter DEVICE= line you won't accidentally bring down eth0
+       # while executing ifdown eth1.
+       if [ -n "$DEVICE" -a  "$DEVNAME" != "$DEVICE" ]; then
+               echo >&2 "$0: DEVICE specified in $CONFIG does not match filename. Aborting!"
+               exit 1
+       fi
+
        if [ -n "${PREFIX}" ] && ! $(echo $IPADDR | grep "/" 2>&1 >/dev/null) ; then
                IPADDR="$IPADDR/$PREFIX"
        fi
This page took 0.045915 seconds and 4 git commands to generate.