From 112158ad4b7e3a9c2a7060ca6d21e3fc519b53c6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 17 Nov 2010 15:11:10 -0800 Subject: Add check for interface address before putting it in bonded device Bug 4745 Don't allow interface with address to be added to bond --- scripts/vyatta-bonding.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-bonding.pl b/scripts/vyatta-bonding.pl index ced916d6..3737cebb 100755 --- a/scripts/vyatta-bonding.pl +++ b/scripts/vyatta-bonding.pl @@ -186,15 +186,20 @@ sub change_hash { sub add_port { my ( $intf, $slave ) = @_; my $slaveif = new Vyatta::Interface($slave); + my $cfg = new Vyatta::Config; + $cfg->setLevel($slaveif->path()); + + my @addr = $cfg->returnValues('address'); + die "Error: can not add interface $slave with addresses to bond-group\n" + if (@addr); if ($slaveif->up()) { if_down($slave); } else { - my $cfg = new Vyatta::Config; - $cfg->setLevel($slaveif->path()); - die "Can not add disabled interface $slave to bond-group $intf\n" + die "Error: can not add disabled interface $slave to bond-group $intf\n" if $cfg->exists('disable'); } + add_slave ($intf, $slave); } -- cgit v1.2.3