From ba499ce66072b2ab21aaf9ffef9370e1df29044d Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 17 Sep 2004 20:37:59 +0000 Subject: fix handling of nonexistent devices (#132839) --- sysconfig/network-scripts/ifup | 2 +- sysconfig/network-scripts/network-functions | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index b4a42aeb..49c82c06 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -148,7 +148,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 a424a73c..570e9ced 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -191,6 +191,9 @@ is_available () configure_ccwgroup_device 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 -- cgit v1.2.1