]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
network-hotplug-bridges: Fix warning when address doesn't exist
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 2 Dec 2021 12:37:44 +0000 (12:37 +0000)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sun, 16 Jan 2022 15:17:50 +0000 (15:17 +0000)
Some devices do not have an address, which prints an error when reading
it.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/udev/network-hotplug-bridges

index bacf722ef96d62523ea0b5d2963e103c9d705c68..4b8764598d1d55e6339cf52836483b1f1b1fccb1 100644 (file)
@@ -41,9 +41,8 @@ detect_zone() {
                # Try to find out if this INTERFACE is a slave of a zone
                local slave
                for slave in $(get_value "${zone}_SLAVES"); do
-
-                       #Compare if the mac address matches or if the name matches
-                       if ([ "$(</sys/class/net/${INTERFACE}/address)" = "${slave}" ] || [ "${INTERFACE}" = "${slave}" ]); then
+                       # Compare if the mac address matches or if the name matches
+                       if [ -r "/sys/class/net/${INTERFACE}/address" -a "$(</sys/class/net/${INTERFACE}/address)" = "${slave}" ] || [ "${INTERFACE}" = "${slave}" ]; then
                                echo "${zone}"
                                return 0
                        fi