diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-16 16:16:03 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-16 16:16:03 -0800 |
commit | 9f7a2a47e9d193592bc5fdf223db9517debd459e (patch) | |
tree | bfe6a79f750f5a6adda236485cfe87e75754505d /templates/interfaces | |
parent | fac58bc39855de08335a8d7ef479b2a7be8404c0 (diff) | |
download | vyatta-cfg-quagga-9f7a2a47e9d193592bc5fdf223db9517debd459e.tar.gz vyatta-cfg-quagga-9f7a2a47e9d193592bc5fdf223db9517debd459e.zip |
Check current status (not configured value) when enabling vlan device
Diffstat (limited to 'templates/interfaces')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.def | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def index 9bf8d47a..b6b8abc7 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -2,15 +2,19 @@ tag: priority: 319 type: u32 help: Set Virtual Local Area Network (VLAN) ID + syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" + create: if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) then echo "Error creating VLAN device $VAR(../@).$VAR(@)" exit 1 fi - if [ -z "$VAR(../@/disable)" ]; then + # 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 fi /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on + delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0 sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: |