diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-18 13:08:58 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-11-18 13:08:58 -0800 |
commit | 408b00b6b3caf284592f561fbf6bc5a04a163187 (patch) | |
tree | 802296110b251b54bb8e7fbc7c33eed7ab71bb30 | |
parent | 6ec63ce719500b97423975e2488c605f44d8b644 (diff) | |
download | vyatta-cfg-system-408b00b6b3caf284592f561fbf6bc5a04a163187.tar.gz vyatta-cfg-system-408b00b6b3caf284592f561fbf6bc5a04a163187.zip |
Add more checks for bridge/bond conflicts
Don't allow putting bridge port into bond-group (and vice-versa).
-rwxr-xr-x | scripts/vyatta-bonding.pl | 3 | ||||
-rw-r--r-- | scripts/vyatta-bridge.pl | 15 |
2 files changed, 12 insertions, 6 deletions
diff --git a/scripts/vyatta-bonding.pl b/scripts/vyatta-bonding.pl index be09e754..fe07b1a2 100755 --- a/scripts/vyatta-bonding.pl +++ b/scripts/vyatta-bonding.pl @@ -196,6 +196,9 @@ sub commit_check { die "Error: can not add disabled interface $slave to bond-group $intf\n" if $cfg->exists('disable'); + die "Error: can not add interface $slave that is part of bridge to bond-group\n" + if defined($cfg->returnValue("bridge-group bridge")); + my @addr = $cfg->returnValues('address'); die "Error: can not add interface $slave with addresses to bond-group\n" if (@addr); diff --git a/scripts/vyatta-bridge.pl b/scripts/vyatta-bridge.pl index 356361a2..fd5fad8a 100644 --- a/scripts/vyatta-bridge.pl +++ b/scripts/vyatta-bridge.pl @@ -55,23 +55,26 @@ my $cost = $cfg->returnValue('bridge-group cost'); my $priority = $cfg->returnValue('bridge-group priority'); if ( $action eq 'SET' ) { - die "Error: $ifname: not in a bridge-group.\n" unless $newbridge; + die "Error: $ifname: not in a bridge-group\n" unless $newbridge; + + die "Error: can not add interface $ifname that is part of bond-group to bridge\n" + if defined($cfg->returnValue('bond-group')); my @address = $cfg->returnValues('address'); - die "Error: Can not add interface $ifname with addresses to bridge.\n" + die "Error: Can not add interface $ifname with addresses to bridge\n" if (@address); - print "Adding interface $ifname to bridge $newbridge.\n"; + print "Adding interface $ifname to bridge $newbridge\n"; add_bridge_port($newbridge, $ifname, $cost, $priority); } elsif ( $action eq 'DELETE' ) { - die "Error: $ifname: not in a bridge-group.\n" unless $oldbridge; + die "Error: $ifname: not in a bridge-group\n" unless $oldbridge; - print "Removing interface $ifname from bridge $oldbridge.\n"; + print "Removing interface $ifname from bridge $oldbridge\n"; remove_bridge_port($oldbridge, $ifname); } elsif ($oldbridge ne $newbridge) { - print "Moving interface $ifname from $oldbridge to $newbridge.\n"; + print "Moving interface $ifname from $oldbridge to $newbridge\n"; remove_bridge_port($oldbridge, $ifname); add_bridge_port($newbridge, $ifname, $cost, $priority); } |