diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-07-28 09:46:36 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-07-28 09:46:36 +0200 |
commit | 6b7fe85ac5a6c6ba44e08e6d36b76be1cfeb1774 (patch) | |
tree | 5e90372886fdc002ac4395373bf564690bdcf84e /templates | |
parent | 8ffce9689550bffa2a967321368fde963731a4e4 (diff) | |
download | vyatta-cfg-system-6b7fe85ac5a6c6ba44e08e6d36b76be1cfeb1774.tar.gz vyatta-cfg-system-6b7fe85ac5a6c6ba44e08e6d36b76be1cfeb1774.zip |
T755: use ethertype for QinQ service VLAN creation.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/bonding/node.tag/vif-s/node.def | 14 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif-s/node.def | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.def index dcec3900..fd490689 100644 --- a/templates/interfaces/bonding/node.tag/vif-s/node.def +++ b/templates/interfaces/bonding/node.tag/vif-s/node.def @@ -5,6 +5,20 @@ 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/@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + + 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 + delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.def index c6483ac0..204b68c7 100644 --- a/templates/interfaces/ethernet/node.tag/vif-s/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.def @@ -5,6 +5,20 @@ 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/@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + + 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 + delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi |