diff options
Diffstat (limited to 'templates/interfaces/bonding')
-rw-r--r-- | templates/interfaces/bonding/node.tag/vif-s/node.def | 16 | ||||
-rw-r--r-- | templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def | 21 |
2 files changed, 26 insertions, 11 deletions
diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.def index 5a2e8dee..dcec3900 100644 --- a/templates/interfaces/bonding/node.tag/vif-s/node.def +++ b/templates/interfaces/bonding/node.tag/vif-s/node.def @@ -5,14 +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: read -a SLAVES </sys/class/net/$VAR(../@)/bonding/slaves - if [ ${#SLAVES[*]} -eq 0 ]; then - echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" - exit 1 - fi - ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) || exit 1 - ip link set "$VAR(../@).$VAR(@)" up - /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/bonding/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def new file mode 100644 index 00000000..e8a1e810 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def @@ -0,0 +1,21 @@ +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 + read -a SLAVES </sys/class/net/$VAR(../../@)/bonding/slaves + if [ ${#SLAVES[*]} -eq 0 ]; then + echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" + exit 1 + fi + ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1 + ip link add link $VAR(../../@) name "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) || exit 1 + ip link set "$VAR(../../@).$VAR(../@)" up + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@)" on |