mirror of
https://github.com/openwrt/packages.git
synced 2025-07-17 05:14:46 +00:00
Add new option to a config bridge section to indicate if a bridge port added to the bridge should be isolated or not. The default is 0 (no isolation). example config bridge option interface 'br-mybridge1446' option mtu '1446' option isolate '1' # default '0' Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
71 lines
1.4 KiB
Bash
71 lines
1.4 KiB
Bash
. /lib/functions.sh
|
|
. /lib/functions/network.sh
|
|
|
|
tunneldigger_get_bridge() {
|
|
local variable="$1"
|
|
local mtu="$2"
|
|
|
|
# Overwrite the destination variable.
|
|
unset $variable
|
|
|
|
# Discover the configured bridge.
|
|
unset _td_bridge
|
|
_td_bridge=""
|
|
handle_bridge() {
|
|
local cfg="$1"
|
|
|
|
config_get cfg_mtu "$cfg" mtu
|
|
config_get interface "$cfg" interface
|
|
|
|
if [ "$cfg_mtu" != "$mtu" ]; then
|
|
return
|
|
fi
|
|
|
|
_td_bridge="$interface"
|
|
}
|
|
|
|
config_load tunneldigger-broker
|
|
config_foreach handle_bridge bridge $mtu
|
|
if [ -z "$_td_bridge" ]; then
|
|
return
|
|
fi
|
|
|
|
variable="$_td_bridge"
|
|
export ${NO_EXPORT:+-n} "$1=$variable"
|
|
}
|
|
|
|
# Get the isolation option for this bridge
|
|
tunneldigger_get_bridge_isolate() {
|
|
local variable="$1"
|
|
local mtr="$2"
|
|
|
|
# Overwrite the destination variable.
|
|
unset $variable
|
|
|
|
# Discover the configured bridge.
|
|
unset _isolate_bridge
|
|
_isolate_bridge=""
|
|
handle_bridge() {
|
|
local cfg="$1"
|
|
|
|
config_get cfg_mtu "$cfg" mtu
|
|
config_get isolate "$cfg" isolate 0
|
|
|
|
if [ "$cfg_mtu" != "$mtu" ]; then
|
|
return
|
|
fi
|
|
|
|
_isolate_bridge="$isolate"
|
|
}
|
|
|
|
config_load tunneldigger-broker
|
|
config_foreach handle_bridge bridge $mtu
|
|
if [ -z "$_isolate_bridge" ]; then
|
|
return
|
|
fi
|
|
|
|
variable="$_isolate_bridge"
|
|
export ${NO_EXPORT:+-n} "$1=$variable"
|
|
|
|
}
|