summaryrefslogtreecommitdiff
path: root/scripts/vyatta_quagga_utils.pl
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-11-25 21:11:28 +0100
committerDaniil Baturin <daniil@baturin.org>2018-11-25 21:11:28 +0100
commitb044a897acb35c31df7756e3d6d0c70bb2aab9da (patch)
treebaa8fa82d8d2c6807692646f781ddd112574ace7 /scripts/vyatta_quagga_utils.pl
parent7d8ac201a990be7664ec79d27c85076fdd079f85 (diff)
downloadvyatta-cfg-quagga-b044a897acb35c31df7756e3d6d0c70bb2aab9da.tar.gz
vyatta-cfg-quagga-b044a897acb35c31df7756e3d6d0c70bb2aab9da.zip
T981: disallow decimal area notation in OSPFv3 since neither FRR no Quagga support it.
Diffstat (limited to 'scripts/vyatta_quagga_utils.pl')
-rwxr-xr-xscripts/vyatta_quagga_utils.pl17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl
index df263a08..ffeeaa04 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, $passive );
+my ( $prefix, $exists, $not_exists, $area, $area6, $community, $passive );
# Allowed well-know community values (see set commuinity)
my %communities = (
@@ -23,6 +23,7 @@ GetOptions(
"not-exists=s" => \$not_exists,
"exists=s" => \$exists,
"check-ospf-area=s" => \$area,
+ "check-ospfv3-area=s" => \$area6,
"check-community" => \$community,
"check-ospf-passive=s" => \$passive,
);
@@ -31,6 +32,7 @@ check_community(@ARGV) if ($community);
check_prefix_boundry($prefix) if ($prefix);
check_not_exists($not_exists) if ($not_exists);
check_exists($exists) if ($exists);
+check_ospfv3_area($area6) if ($area6);
check_ospf_area($area) if ($area);
check_ospf_passive($passive) if ($passive);
@@ -88,6 +90,19 @@ sub check_ospf_area {
die "Invalid OSPF area: $area\n";
}
+sub check_ospfv3_area {
+ my $area = shift;
+
+ if ( $area =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) {
+ foreach my $octet ( $1, $2, $3, $4 ) {
+ if ( ( $octet < 0 ) || ( $octet > 255 ) ) { exit 1; }
+ }
+ exit 0;
+ }
+
+ die "Invalid OSPF area: $area. Only dotted decimal notation is allowed.\n";
+}
+
sub check_community {
foreach my $arg (@_) {
next if ($arg =~ /\d+:\d+/);