SVN: rc-scripts/trunk/sysconfig/network-scripts/functions.network

glen glen at pld-linux.org
Wed Oct 18 14:22:30 CEST 2006


Author: glen
Date: Wed Oct 18 14:22:28 2006
New Revision: 7868

Modified:
   rc-scripts/trunk/sysconfig/network-scripts/functions.network
Log:
Avoid bringing down eth0 in case of bad config.

Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network	Wed Oct 18 14:22:28 2006
@@ -16,6 +16,15 @@
 	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


More information about the pld-cvs-commit mailing list