diff options
-rw-r--r-- | scripts/vyatta_quagga_utils.pl | 16 | ||||
-rw-r--r-- | templates/protocols/ospf/area/node.def | 2 |
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" |