summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorrbalocca <rbalocca@vyatta.com>2008-03-22 18:01:28 -0700
committerrbalocca <rbalocca@vyatta.com>2008-03-22 18:01:28 -0700
commit445f5b6de86f271605d2b6f8e1e9671ff9444218 (patch)
tree342bfd8639ab965c9d9d25be7b8df420a0be5bfc /scripts
parent762951519256e8d85362b3aeb9012c534a644e3a (diff)
parent23104e6a58525f2dbd41152bf22615bb8d257278 (diff)
downloadvyatta-cfg-445f5b6de86f271605d2b6f8e1e9671ff9444218.tar.gz
vyatta-cfg-445f5b6de86f271605d2b6f8e1e9671ff9444218.zip
Merge branch 'glendale' into hollywood
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/VyattaTypeChecker.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/VyattaTypeChecker.pm b/scripts/VyattaTypeChecker.pm
index 2a7d0c9..f77664f 100755
--- a/scripts/VyattaTypeChecker.pm
+++ b/scripts/VyattaTypeChecker.pm
@@ -52,8 +52,11 @@ use strict;
my %type_handler = (
'ipv4' => \&validate_ipv4,
'ipv4net' => \&validate_ipv4net,
+ 'ipv4range' => \&validate_ipv4range,
'ipv4_negate' => \&validate_ipv4_negate,
'ipv4net_negate' => \&validate_ipv4net_negate,
+ 'ipv4range_negate' => \&validate_ipv4range_negate,
+ 'iptables4_addr' => \&validate_iptables4_addr,
'protocol' => \&validate_protocol,
'protocol_negate' => \&validate_protocol_negate,
'macaddr' => \&validate_macaddr,
@@ -75,6 +78,14 @@ sub validate_ipv4net {
return 1;
}
+sub validate_ipv4range {
+ $_ = shift;
+ return 0 if (!/^([^-]+)-([^-]+)$/);
+ my ($a1, $a2) = ($1, $2);
+ return 0 if (!validate_ipv4($a1) || !validate_ipv4($a2));
+ return 1;
+}
+
sub validate_ipv4_negate {
my $value = shift;
if ($value =~ m/^\!(.*)$/) {
@@ -91,6 +102,22 @@ sub validate_ipv4net_negate {
return validate_ipv4net($value);
}
+sub validate_ipv4range_negate {
+ my $value = shift;
+ if ($value =~ m/^\!(.*)$/) {
+ $value = $1;
+ }
+ return validate_ipv4range($value);
+}
+
+sub validate_iptables4_addr {
+ my $value = shift;
+ return 0 if (!validate_ipv4_negate($value)
+ && !validate_ipv4net_negate($value)
+ && !validate_ipv4range_negate($value));
+ return 1;
+}
+
sub validate_protocol {
my $value = shift;
$value = lc $value;