forked from Blub/pve-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bridgevlan
executable file
·51 lines (43 loc) · 902 Bytes
/
bridgevlan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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
bridge vlan add dev $port vid $IF_BRIDGE_VIDS
else
bridge vlan add dev $port vid 2-4094
fi
fi
done
done