summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-22 15:24:23 +1100
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-22 15:24:23 +1100
commit69e604a82027bb6461204106edd11be61767aa2a (patch)
tree489e440c62e4dcaa0b74eaa007dc09f327fd1098 /templates
parentae04e4d9496498723417cbfe5bf251b760590857 (diff)
downloadvyatta-cfg-quagga-69e604a82027bb6461204106edd11be61767aa2a.tar.gz
vyatta-cfg-quagga-69e604a82027bb6461204106edd11be61767aa2a.zip
Fix delete of bonding interface
Don't allow removal of a bonded device that still has slaves. Bug 4045
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/bonding/node.def8
1 files changed, 7 insertions, 1 deletions
diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def
index a0a56a8d..ece131b4 100644
--- a/templates/interfaces/bonding/node.def
+++ b/templates/interfaces/bonding/node.def
@@ -4,6 +4,12 @@ help: Set bonding interface
syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \
; "bonding must be (bond0-bond99)"
create: ${vyatta_sbindir}/vyatta-bonding.pl --create $VAR(@)
-delete: ${vyatta_sbindir}/vyatta-bonding.pl --delete $VAR(@)
+delete: SLAVES=`cat /sys/class/net/$VAR(@)/bonding/slaves`;
+ if [ -z $SLAVES ]
+ then ${vyatta_sbindir}/vyatta-bonding.pl --delete $VAR(@)
+ else
+ echo "bonded interface $VAR(@) still has slaves: $SLAVES"
+ exit 1;
+ fi
end: ${vyatta_sbindir}/vyatta-bonding.pl --mode-change $VAR(@)
comp_help: Enter bond interface name (bond0 - bond99)