diff options
-rwxr-xr-x | sysconfig/network-scripts/ifup | 2 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 8e1026a7..df17512d 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -144,7 +144,7 @@ if [ -n "${HWADDR}" ]; then FOUNDMACADDR=`get_hwaddr ${REALDEVICE}` if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then curdev=`ip -o link | awk -F ':' -vIGNORECASE=1 '/$HWADDR/ { print $2 }'` - rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || { + [ -n "$curdev" ] && rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || { echo $"Device ${DEVICE} has different MAC address than expected, ignoring." exit 1 } diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 1f68ebc5..9162e9f7 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -184,6 +184,9 @@ is_available () modprobe $1 > /dev/null 2>&1 || return 1 if [ -n "$HWADDR" ]; then local curdev=`ip -o link | awk -F ':' -vIGNORECASE=1 '/$HWADDR/ { print $2 }'` + if [ -z "$curdev" ]; then + return 1 + fi rename_device "$1" "$HWADDR" "$curdev" fi LC_ALL= LANG= ip -o link | grep -q $1 |