pve-manager/network-hooks/bridgevlan
Alexandre Derumier 311b67c75c ifupdown1: bridgevlan: add bridge-vids list support
like ifupdown2, support multiple values

iface vmbr0
   bridge-vids 2 4 5-10 70

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2020-01-11 17:22:46 +01:00

55 lines
966 B
Bash
Executable File

#!/bin/sh
if [ ! -x /sbin/bridge ] && [ ! -f /sys/class/net/$IFACE/bridge/vlan_filtering ]
then
exit 0
fi
# Enabling vlan filtering feature
if [ "$MODE" = "start" ] ; then
if [ -n "$IF_BRIDGE_VLAN_AWARE" ]
then
echo 1 > /sys/class/net/$IFACE/bridge/vlan_filtering
else
exit 0
fi
fi
. /lib/bridge-utils/bridge-utils.sh
case "$IF_BRIDGE_PORTS" in
"")
exit 0
;;
none)
INTERFACES=""
;;
*)
INTERFACES="$IF_BRIDGE_PORTS"
;;
esac
all_interfaces= &&
unset all_interfaces &&
bridge_parse_ports $INTERFACES | while read i
do
for port in $i
do
if [ "$MODE" = "start" ] && [ -d /sys/class/net/$IFACE/brif/$port ]; then
# we allow vlan to pass through attached interface
if [ -n "$IF_BRIDGE_VIDS" ]
then
for VID in $IF_BRIDGE_VIDS
do
bridge vlan add dev $port vid $VID
done
else
bridge vlan add dev $port vid 2-4094
fi
fi
done
done