diff options
author | Bill Nottingham <notting@redhat.com> | 2004-09-17 20:37:37 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2004-09-17 20:37:37 +0000 |
commit | 9b90e924b2c0d2c73b0d82a3a042a015347f87ca (patch) | |
tree | 03330269183c52e924d647fb2c1bd833addf515f /sysconfig | |
parent | 2d6c8a3ee15ae8b1c68fbc6e6e36d2d321ee95fe (diff) | |
download | initscripts-9b90e924b2c0d2c73b0d82a3a042a015347f87ca.tar initscripts-9b90e924b2c0d2c73b0d82a3a042a015347f87ca.tar.gz initscripts-9b90e924b2c0d2c73b0d82a3a042a015347f87ca.tar.bz2 initscripts-9b90e924b2c0d2c73b0d82a3a042a015347f87ca.tar.xz initscripts-9b90e924b2c0d2c73b0d82a3a042a015347f87ca.zip |
fix handling of nonexistent devices (#132839)
Diffstat (limited to 'sysconfig')
-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 |