diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 08:21:42 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 08:21:42 -0700 |
commit | 1af622ab0332f583c842cad1dd9ff9f9c5dcc42d (patch) | |
tree | 433c6e11445581017082c3ebff5a379accdbd9cf /templates | |
parent | f51be17447504aed009f3b31fd6868f02019445d (diff) | |
download | vyatta-cfg-1af622ab0332f583c842cad1dd9ff9f9c5dcc42d.tar.gz vyatta-cfg-1af622ab0332f583c842cad1dd9ff9f9c5dcc42d.zip |
Disable creating vlan on disabled interface
Print message and fail commit if interface is disabled.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/vif/node.def | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def index e496a7c..e8554fa 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.def @@ -2,8 +2,14 @@ tag: 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: sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) - sudo ip link set "$VAR(../@).$VAR(@)" up +create: read flags < /sys/class/net/$VAR(../@)/flags + if [ $(( flags & 1 )) -eq 0 ] + then + echo "Can not create VLAN on disabled interface: " $VAR(../@) + exit 1 + fi + sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1 + sudo ip link set "$VAR(../@).$VAR(@)" up /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on delete: sudo ip link delete "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: |