diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-17 15:11:10 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-17 20:17:20 -0800 |
commit | 112158ad4b7e3a9c2a7060ca6d21e3fc519b53c6 (patch) | |
tree | 1ecb53a3e77149eed2934dffb9c7e68e4fe3b410 /scripts/vyatta-bonding.pl | |
parent | b170409fc8117356dc8e53c6a28924a7d4c521ed (diff) | |
download | vyatta-cfg-system-112158ad4b7e3a9c2a7060ca6d21e3fc519b53c6.tar.gz vyatta-cfg-system-112158ad4b7e3a9c2a7060ca6d21e3fc519b53c6.zip |
Add check for interface address before putting it in bonded device
Bug 4745
Don't allow interface with address to be added to bond
Diffstat (limited to 'scripts/vyatta-bonding.pl')
-rwxr-xr-x | scripts/vyatta-bonding.pl | 11 |
1 files changed, 8 insertions, 3 deletions
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); } |