summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--templates/interfaces/ethernet/node.tag/vif-s/node.def24
1 files changed, 14 insertions, 10 deletions
diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.def
index 963dbb18..53f2c76c 100644
--- a/templates/interfaces/ethernet/node.tag/vif-s/node.def
+++ b/templates/interfaces/ethernet/node.tag/vif-s/node.def
@@ -5,22 +5,26 @@ help: QinQ TAG-S 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: ETHERTYPE=`echo "$VAR(ethertype/@)"`
+create:
+ ETHERTYPE=`echo "$VAR(ethertype/@)"`
if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi
- if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi
+ if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1q; fi
- if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@)
- then echo "Error creating VLAN device $VAR(../@).$VAR(@)"
+ if [ ! -d /sys/class/net/$VAR(../@).$VAR(@) ]; then
+ if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@); then
+ echo "Error creating VLAN device $VAR(../@).$VAR(@)"
exit 1
+ fi
fi
+
# if parent is up, then bring VLAN up
- if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ]
- then sudo ip link set "$VAR(../@).$VAR(@)" up
+ if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ]; then
+ sudo ip link set "$VAR(../@).$VAR(@)" up
fi
/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
delete: ETHERTYPE=`echo "$VAR(ethertype/@)"`
- if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi
- if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi
- [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0
- sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@)
+ if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi
+ if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi
+ [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0
+ sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@)