From 7b192cf470a477d8fa1af7d21c0243e49f958d80 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 6 Sep 2014 13:15:59 +0200 Subject: [PATCH] device: Rewrite batman-adv-port detection When the batman-adv module is loaded, the batman_adv subdirectory can be found in the sys tree of every network device, so this check returned positive for every device. The function has been rewritten to read the content of the status file which will return the correct result. --- src/functions/functions.device | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/functions/functions.device b/src/functions/functions.device index 71265c40..5890ff9a 100644 --- a/src/functions/functions.device +++ b/src/functions/functions.device @@ -153,7 +153,22 @@ function device_is_batman_adv() { # Check if the device is a batman-adv bridge port function device_is_batman_adv_port() { - [ -d "${SYS_CLASS_NET}/${1}/batman_adv" ] + local device="${1}" + + if [ -d "${SYS_CLASS_NET}/${device}/batman_adv" ]; then + local status="$(<${SYS_CLASS_NET}/${device}/batman_adv/iface_status)" + + case "${status}" in + "active") + return ${EXIT_TRUE} + ;; + *) + return ${EXIT_FALSE} + ;; + esac + fi + + return ${EXIT_FALSE} } # Check if the device is a bonding device -- 2.39.2