summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-03-20 13:08:04 -0700
committerStig Thormodsrud <stig@vyatta.com>2010-03-20 13:08:04 -0700
commit442fd359980919f018107849240b63ce73bcffc3 (patch)
tree97624a57cd4208651e25c1b75f9f3a087b723068 /scripts
parent369b7c567639d7230c945045c855c678fadfb887 (diff)
downloadvyatta-cfg-quagga-442fd359980919f018107849240b63ce73bcffc3.tar.gz
vyatta-cfg-quagga-442fd359980919f018107849240b63ce73bcffc3.zip
Fix 4161: Bad config handling of "protocols ospf passive-interface"
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta_quagga_utils.pl29
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl
index 0b9fb2ae..df263a08 100755
--- a/scripts/vyatta_quagga_utils.pl
+++ b/scripts/vyatta_quagga_utils.pl
@@ -6,7 +6,7 @@ use Vyatta::Misc;
use NetAddr::IP;
use Getopt::Long;
-my ( $prefix, $exists, $not_exists, $area, $community );
+my ( $prefix, $exists, $not_exists, $area, $community, $passive );
# Allowed well-know community values (see set commuinity)
my %communities = (
@@ -24,6 +24,7 @@ GetOptions(
"exists=s" => \$exists,
"check-ospf-area=s" => \$area,
"check-community" => \$community,
+ "check-ospf-passive=s" => \$passive,
);
check_community(@ARGV) if ($community);
@@ -31,6 +32,7 @@ check_prefix_boundry($prefix) if ($prefix);
check_not_exists($not_exists) if ($not_exists);
check_exists($exists) if ($exists);
check_ospf_area($area) if ($area);
+check_ospf_passive($passive) if ($passive);
exit 0;
@@ -94,3 +96,28 @@ sub check_community {
die "$arg unknown community value\n"
}
}
+
+sub check_ospf_passive {
+ my $passive = shift;
+
+ my $config = new Vyatta::Config;
+ $config->setLevel('protocols ospf passive-interface');
+ my @nodesO = $config->returnOrigValues();
+ my @nodes = $config->returnValues();
+
+ my %nO_hash = map { $_ => 1 } @nodesO;
+ my %n_hash = map { $_ => 1 } @nodes;
+
+ if ($nO_hash{'default'}) {
+ exit 0 if ! $n_hash{'default'};
+ print "Error: can't add interface when using 'default'\n";
+ exit 1;
+ } else {
+ if (scalar(@nodes) > 1 and $n_hash{'default'}) {
+ print "Error: delete other interfaces before using 'default'\n";
+ exit 1;
+ }
+ }
+
+ exit 0;
+}