diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 21:34:45 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-03-11 21:34:45 -0700 |
commit | 8d636c5db6e1395c01f4be01796c8dbed3a9777e (patch) | |
tree | d46923ba9ea9b98708f5fb312f279457a2bfcc24 | |
parent | d00425316748ce1bac4c855c79848c28a60a6208 (diff) | |
download | vyatta-cfg-system-8d636c5db6e1395c01f4be01796c8dbed3a9777e.tar.gz vyatta-cfg-system-8d636c5db6e1395c01f4be01796c8dbed3a9777e.zip |
Don't allow vif on disabled bonding interface
-rw-r--r-- | templates/interfaces/bonding/node.tag/disable/node.def | 7 | ||||
-rw-r--r-- | templates/interfaces/bonding/node.tag/vif/node.def | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/templates/interfaces/bonding/node.tag/disable/node.def b/templates/interfaces/bonding/node.tag/disable/node.def index 90dd5825..3d3ffef9 100644 --- a/templates/interfaces/bonding/node.tag/disable/node.def +++ b/templates/interfaces/bonding/node.tag/disable/node.def @@ -1,5 +1,10 @@ help: Set interface disabled -update: /etc/netplug/linkdown.d/dhclient $VAR(../@) +create: vif=`/opt/vyatta/sbin/vyatta-interfaces.pl --vif=$VAR(../@) --show=all` + if [ ! -z "$vif" ]; then + echo "Can not disable interface " $VAR(../@) " with vif:" $vif + exit 1 + fi + /etc/netplug/linkdown.d/dhclient $VAR(../@) if ! sudo ip link set $VAR(../@) down 2>/dev/null; then echo "Error disabling dev $VAR(../@)" /etc/netplug/linkup.d/dhclient $VAR(../@) diff --git a/templates/interfaces/bonding/node.tag/vif/node.def b/templates/interfaces/bonding/node.tag/vif/node.def index f85c400d..c3087022 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.def @@ -2,7 +2,13 @@ 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(@) +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 delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@) comp_help: possible completions: |