packages/net/tunneldigger-broker/files/hook-setup
Perry Melange 49cdf15da4 tunneldigger-broker: add option to isolate bridge ports
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>
2023-08-20 02:25:27 +02:00

26 lines
763 B
Bash
Executable file

#!/bin/sh
. /lib/functions/tunneldigger.sh
TUNNEL_ID="$1"
INTERFACE="$3"
MTU="$4"
# Get the bridge interface name for this MTU.
tunneldigger_get_bridge bridge "${MTU}"
if [ -z "$bridge" ]; then
echo "Unable to determine which bridge to use for MTU ${MTU}."
exit 1
fi
# Get the isolation option for this bridge
tunneldigger_get_bridge_isolate isolate "${MTU}"
# Disable IPv6 on this interface as it will be bridged.
echo 1 > /proc/sys/net/ipv6/conf/${INTERFACE}/disable_ipv6
# Add the interface to the proper bridge and bring it up.
ip link set dev ${INTERFACE} master ${bridge} mtu ${MTU} up
# Isolate the bridge port, if so configured
echo $isolate > /sys/class/net/${INTERFACE}/brport/isolated
# Ensure bridge MTU.
ip link set dev ${bridge} mtu ${MTU}