blob: b9925177eb74a5182274312214034b3e1539a89c (
plain)
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
|
tag:
priority: 319
type: u32
help: Virtual Local Area Network (VLAN) ID
syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094"
val_help: u32:0-4094; VLAN ID
create: if [ -n "$VAR(./egress-qos)" ]; then
opt_e=" egress-qos-map $VAR(./egress-qos/@) "
fi
if [ -n "$VAR(./ingress-qos)" ]; then
opt_in=" ingress-qos-map $VAR(./ingress-qos/@) "
fi
if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) ${opt_e} ${opt_in}
then echo "Error creating VLAN device $VAR(../@).$VAR(@)"
exit 1
fi
# if parent is up, then bring VLAN up
if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ]
then ip link set "$VAR(../@).$VAR(@)" up
fi
/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0
ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
|