summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-09-09 09:27:45 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-09-09 09:27:45 -0700
commit27d542ae3c6ff507509c502fc96b8e1245040de1 (patch)
treea801f37a7d4dc7e1131be34e2b498e73588345ec /lib/Vyatta
parentf50e8a9c76156a003d07fbca48f35abd24a434d0 (diff)
downloadvyatta-cfg-27d542ae3c6ff507509c502fc96b8e1245040de1.tar.gz
vyatta-cfg-27d542ae3c6ff507509c502fc96b8e1245040de1.zip
fix for bug 4697. Added range value check that start must be less than or equal to stop address
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/TypeChecker.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index 27d9e03..c13ef4b 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -91,6 +91,12 @@ sub validate_ipv4range {
return 0 if (!/^([^-]+)-([^-]+)$/);
my ($a1, $a2) = ($1, $2);
return 0 if (!validate_ipv4($a1) || !validate_ipv4($a2));
+ #need to check that range is in ascending order
+ $a1 =~ m/^(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)/;
+ my $v1 = $1*256*256*256+$2*256*256+$3*256+$4;
+ $a2 =~ m/^(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)/;
+ my $v2 = $1*256*256*256+$2*256*256+$3*256+$4;
+ return 0 if ($v1 > $v2);
return 1;
}