summaryrefslogtreecommitdiff
path: root/templates/interfaces/ethernet
diff options
context:
space:
mode:
authorKim Hagen <khagen@multi-development.com>2015-02-05 15:47:47 +0100
committerKim Hagen <khagen@multi-development.com>2015-02-05 15:47:47 +0100
commitd77880937b43a323a53a23c5306e88d3cfc214cb (patch)
tree03dee5023b4ad497bba581b86958047b63b6a58f /templates/interfaces/ethernet
parent6ab6520391b685319f8a644aa70a03ae5902309c (diff)
downloadvyatta-cfg-system-d77880937b43a323a53a23c5306e88d3cfc214cb.tar.gz
vyatta-cfg-system-d77880937b43a323a53a23c5306e88d3cfc214cb.zip
Bug #352 - QinQ - changing the ethertype value of vif-s
Diffstat (limited to 'templates/interfaces/ethernet')
-rw-r--r--templates/interfaces/ethernet/node.tag/vif-s/node.def17
-rw-r--r--templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def22
2 files changed, 27 insertions, 12 deletions
diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.def
index 0a4ed145..c6483ac0 100644
--- a/templates/interfaces/ethernet/node.tag/vif-s/node.def
+++ b/templates/interfaces/ethernet/node.tag/vif-s/node.def
@@ -5,15 +5,8 @@ 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: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@)
- 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 proto 802.1ad id $VAR(@)
+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
+ ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@)
diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def
new file mode 100644
index 00000000..9a3615be
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def
@@ -0,0 +1,22 @@
+type: txt
+help: Set Ethertype
+syntax:expression: $VAR(@) in "0x88A8", "0x8100";"Must be (0x88A8 0x8100)\n"
+default: "0x88A8"
+
+comp_help: possible completions:
+ 0x88A8 802.1AD
+ 0x8100 802.1Q
+
+update: ETHERTYPE=`echo "$VAR(@)"`
+ if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi
+ if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi
+ ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1
+ if ! 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
+ # 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