bsbf-bonding: fix checking if interface is a bridge

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 <chester.a.unal@arinc9.com>
This commit is contained in:
Chester A. Unal committed 2026-05-07 05:53:10 +01:00
1 parent 97b710a5b3
commit ba55fc5cae
1 file changed
+8 -4
@@ -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)"