bsbf-bonding: fix checking if interface is a bridge
authorChester A. Unal <redacted>
Tue, 5 May 2026 07:58:20 +0000 (08:58 +0100)
committerChester A. Unal <redacted>
Thu, 7 May 2026 04:53:10 +0000 (05:53 +0100)
The current check would match a uci device section that doesn't say if the
interface is a bridge. Check that the type option is bridge to address
this.

Signed-off-by: Chester A. Unal <redacted>
net/bsbf-openwrt-resources/files/etc/uci-defaults/99-bsbf-bonding

index 3bc706bef8c84ff9d07025a8cbe0b627ea8a40e9..8097b8b076b29b633efc4a6e8f65820769ccdb0b 100644 (file)
@@ -4,8 +4,10 @@
 # Get the interface of lan network.
 lan_network_interface="$(uci -q get network.lan.device)"
 
-# Check if lan is a bridge.
-[ -n "$lan_network_interface" ] && lan_section=$(uci show network | grep "name='$lan_network_interface'" | cut -d. -f2)
+# If the interface exists, check if it is a bridge.
+[ -n "$lan_network_interface" ] && for section in $(uci show network | grep "name='$lan_network_interface'" | cut -d. -f2); do
+       [ "$(uci -q get network.$section.type)" = bridge ] && lan_section="$section" && break
+done
 if [ -n "$lan_section" ]; then
        # Save all interfaces.
        lan_interfaces=$(uci get network.$lan_section.ports)
@@ -24,8 +26,10 @@ fi
 # Get the interface of wan network.
 wan_network_interface="$(uci -q get network.wan.device)"
 
-# Check if wan is a bridge.
-[ -n "$wan_network_interface" ] && wan_section=$(uci show network | grep "name='$wan_network_interface'" | cut -d. -f2)
+# If the interface exists, check if it is a bridge.
+[ -n "$wan_network_interface" ] && for section in $(uci show network | grep "name='$wan_network_interface'" | cut -d. -f2); do
+       [ "$(uci -q get network.$section.type)" = bridge ] && wan_section="$section" && break
+done
 if [ -n "$wan_section" ]; then
        # Save all interfaces.
        wan_network_interface="$(uci get network.$wan_section.ports)"
git clone https://git.99rst.org/PROJECT