summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@uffda.(none)>2007-11-06 13:47:45 -0800
committerStig Thormodsrud <stig@uffda.(none)>2007-11-06 13:47:45 -0800
commit206873af79606eb170fbff26137634bab475fec0 (patch)
tree981c57f04fce6d9f83e0eb94c6a8e319eb3d8b36
parent657890aac205c39b63a462cb5b84ac5d47faf379 (diff)
downloadvyatta-cfg-quagga-206873af79606eb170fbff26137634bab475fec0.tar.gz
vyatta-cfg-quagga-206873af79606eb170fbff26137634bab475fec0.zip
Fix ospf area validation and move error message to template file.
-rw-r--r--scripts/vyatta_quagga_utils.pl16
-rw-r--r--templates/protocols/ospf/area/node.def2
2 files changed, 11 insertions, 7 deletions
diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl
index d64be3a9..e2e871f8 100644
--- a/scripts/vyatta_quagga_utils.pl
+++ b/scripts/vyatta_quagga_utils.pl
@@ -56,17 +56,21 @@ sub check_not_exists() {
sub check_ospf_area() {
my $area = shift;
-
+
+ #
+ # allow both decimal or dotted decimal
+ #
if ($area =~ m/^\d+$/) {
if ($area >= 0 && $area <= 4294967295) {
- return 0;
+ exit 0;
}
}
-
- if (isIpAddress($area)) {
- return 0;
+ if ($area =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
+ foreach $octet ($1, $2, $3, $4) {
+ if (($octet < 0) || ($octet > 255)) { exit 1; }
+ }
+ exit 0
}
- print "invalid ospf area\n";
exit 1;
}
diff --git a/templates/protocols/ospf/area/node.def b/templates/protocols/ospf/area/node.def
index 22cb1ca0..d733005c 100644
--- a/templates/protocols/ospf/area/node.def
+++ b/templates/protocols/ospf/area/node.def
@@ -1,5 +1,5 @@
tag:
type: txt
-syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-ospf-area $(@)"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-ospf-area $(@)"; "Invalid OSFP area \"$(@)\" "
help: "Area"