aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown18
1 files changed, 18 insertions, 0 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 8a80161a..9ff1cfde 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -48,6 +48,24 @@ fi
# Check to make sure the device is actually up
check_device_down ${DEVICE} && exit 0
+if [ -n "${HWADDR}" ]; then
+ FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
+ sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
+ if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
+ NEWCONFIG=`fgrep -l "HWADDR=${HWADDR}" /etc/sysconfig/network-scripts/ifcfg-*`
+ if [ -n "${NEWCONFIG}" ]; then
+ exec /sbin/ifdown ${NEWCONFIG}
+ fi
+ NEWCONFIG=`fgrep -l "HWADDR=${HWADDR}" /etc/sysconfig/networking/default/ifcfg-*`
+ if [ -n "${NEWCONFIG}" ]; then
+ exec /sbin/ifdown ${NEWCONFIG}
+ else
+ echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
+ exit 1
+ fi
+ fi
+fi
+
if [ "${NETWORKING_IPV6}" = "yes" ]; then
/etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG}
fi