From a5fee35267cf7527a96d8042b31d7f6adf4a5646 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 3 Jan 2012 11:00:39 -0800 Subject: Check for conflict between pseudo-ethernet and bonding,bridging Don't allow configuring bonding or bridging if pseudo-ethernet is in use. --- scripts/vyatta-bonding.pl | 8 ++++++++ scripts/vyatta-bridge.pl | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'scripts') diff --git a/scripts/vyatta-bonding.pl b/scripts/vyatta-bonding.pl index 71707126..aa733b61 100755 --- a/scripts/vyatta-bonding.pl +++ b/scripts/vyatta-bonding.pl @@ -225,6 +225,14 @@ sub commit_check { my @vrrp = $cfg->listNodes('vrrp vrrp-group'); die "Error: can not add interface $slave with VRRP to bond-group\n" if (@vrrp); + + $cfg->setLevel('interfaces pseudo-ethernet'); + foreach my $peth ($cfg->listNodes()) { + my $link = $cfg->returnValue("$peth link"); + + die "Error: can not add interface $slave to bond-group already used by pseudo-ethernet $peth\n" + if ($link eq $slave); + } } # bonding requires interface to be down before enslaving diff --git a/scripts/vyatta-bridge.pl b/scripts/vyatta-bridge.pl index bb0d41c3..68d3e107 100755 --- a/scripts/vyatta-bridge.pl +++ b/scripts/vyatta-bridge.pl @@ -68,6 +68,14 @@ if ( $action eq 'SET' ) { die "Error: Can not add interface $ifname with VRRP to bridge\n" if (@vrrp); + $cfg->setLevel('interfaces pseudo-ethernet'); + foreach my $peth ($cfg->listNodes()) { + my $link = $cfg->returnValue("$peth link"); + + die "Error: can not add interface $slave to bridge already used by pseudo-ethernet $peth\n" + if ($link eq $slave); + } + print "Adding interface $ifname to bridge $newbridge\n"; add_bridge_port($newbridge, $ifname, $cost, $priority); -- cgit v1.2.3