diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-07-30 00:31:40 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 00:31:40 +0700 |
commit | 4766e09407ac5d8831ab7c2ec06a74cfe3fed633 (patch) | |
tree | 68cd03d2d0248e913937cbcd9d8c125f3543751a /templates/interfaces | |
parent | 54cd6841293b4f69a32719e23a1858ead6bfde91 (diff) | |
parent | 6b7fe85ac5a6c6ba44e08e6d36b76be1cfeb1774 (diff) | |
download | vyatta-cfg-system-4766e09407ac5d8831ab7c2ec06a74cfe3fed633.tar.gz vyatta-cfg-system-4766e09407ac5d8831ab7c2ec06a74cfe3fed633.zip |
Merge branch 'current' into current
Diffstat (limited to 'templates/interfaces')
-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 |