aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-xsysconfig/network-scripts/ifdown5
-rwxr-xr-xsysconfig/network-scripts/ifup3
-rw-r--r--sysconfig/network-scripts/network-functions25
3 files changed, 27 insertions, 6 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 4e490f68..65ef52e1 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -50,10 +50,9 @@ fi
check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "bootp" ] && [ -n "$VLAN" -a "$VLAN" != "yes" ] && exit 0
if [ -n "${HWADDR}" ]; then
- FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
- sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
+ FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
- NEWCONFIG=`fgrep -l "HWADDR=${HWADDR}" /etc/sysconfig/network-scripts/ifcfg-*`
+ NEWCONFIG=`fgrep -il "HWADDR=${HWADDR}" /etc/sysconfig/network-scripts/ifcfg-*`
if [ -n "${NEWCONFIG}" -a "${NEWCONFIG}" != "${CONFIG}" ]; then
exec /sbin/ifdown ${NEWCONFIG}
else
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index ba649c12..13232704 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -141,8 +141,7 @@ is_available ${REALDEVICE}
# remap, if the device is bound with a MAC address and not the right device num
# bail out, if the MAC does not fit
if [ -n "${HWADDR}" ]; then
- FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} 2>/dev/null| \
- sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
+ FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
/sbin/nameif "${REALDEVICE}" "${HWADDR}" || {
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index eb2d0efc..be94e045 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -7,10 +7,27 @@
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
export PATH
+get_hwaddr ()
+{
+ LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
+ sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/' | \
+ awk '{ print toupper($0) }'
+}
+
need_config ()
{
CONFIG="ifcfg-${1}"
- [ -f "${CONFIG}" ] && return || CONFIG="${1}"
+ [ -f "${CONFIG}" ] && return
+ CONFIG="${1}"
+ [ -f "${CONFIG}" ] && return
+ local addr=`get_hwaddr ${1}`
+ if [ -n "$addr" ]; then
+ local nconfig=`fgrep -il "HWADDR=$addr" /etc/sysconfig/network-scripts/ifcfg-*`
+ if [ -n "$nconfig" ] ; then
+ CONFIG=$nconfig
+ [ -f "${CONFIG}" ] && return
+ fi
+ fi
}
source_config ()
@@ -61,6 +78,12 @@ source_config ()
else
ISALIAS=no
fi
+ if [ -n "$HWADDR" ]; then
+ HWADDR=`echo $HWADDR | awk '{ print toupper($0) }'`
+ fi
+ if [ -n "$MACADDR" ]; then
+ MACADDR=`echo $MACADDR | awk '{ print toupper($0) }'`
+ fi
}