diff options
author | Stig Thormodsrud <stig@uffda.(none)> | 2007-11-06 13:47:45 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@uffda.(none)> | 2007-11-06 13:47:45 -0800 |
commit | 206873af79606eb170fbff26137634bab475fec0 (patch) | |
tree | 981c57f04fce6d9f83e0eb94c6a8e319eb3d8b36 /scripts/vyatta_quagga_utils.pl | |
parent | 657890aac205c39b63a462cb5b84ac5d47faf379 (diff) | |
download | vyatta-cfg-quagga-206873af79606eb170fbff26137634bab475fec0.tar.gz vyatta-cfg-quagga-206873af79606eb170fbff26137634bab475fec0.zip |
Fix ospf area validation and move error message to template file.
Diffstat (limited to 'scripts/vyatta_quagga_utils.pl')
-rw-r--r-- | scripts/vyatta_quagga_utils.pl | 16 |
1 files changed, 10 insertions, 6 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; } |