summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-11 21:34:45 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-11 21:34:45 -0700
commit8d636c5db6e1395c01f4be01796c8dbed3a9777e (patch)
treed46923ba9ea9b98708f5fb312f279457a2bfcc24 /templates
parentd00425316748ce1bac4c855c79848c28a60a6208 (diff)
downloadvyatta-cfg-system-8d636c5db6e1395c01f4be01796c8dbed3a9777e.tar.gz
vyatta-cfg-system-8d636c5db6e1395c01f4be01796c8dbed3a9777e.zip
Don't allow vif on disabled bonding interface
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/bonding/node.tag/disable/node.def7
-rw-r--r--templates/interfaces/bonding/node.tag/vif/node.def8
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: