From: Michael Tremer Date: Tue, 23 Dec 2014 00:51:36 +0000 (+0000) Subject: Speed-up finding the device type if the device does not exist X-Git-Tag: 007~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9f27bafefdd906313c70335cfc198fe32b41189;p=network.git Speed-up finding the device type if the device does not exist --- diff --git a/src/functions/functions.device b/src/functions/functions.device index f5c150dd..97eb17f7 100644 --- a/src/functions/functions.device +++ b/src/functions/functions.device @@ -349,7 +349,12 @@ function device_is_ethernet() { function device_get_type() { local device=${1} - if device_is_vlan ${device}; then + # If the device does not exist (happens on udev remove events), + # we do not bother to run all checks. + if ! device_exists "${device}"; then + echo "unknown" + + elif device_is_vlan ${device}; then echo "vlan" elif device_is_bonding ${device}; then