From b9f27bafefdd906313c70335cfc198fe32b41189 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 23 Dec 2014 00:51:36 +0000 Subject: [PATCH] Speed-up finding the device type if the device does not exist --- src/functions/functions.device | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.39.2