summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/Vyatta/TypeChecker.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index c13ef4b..d6c470d 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -69,7 +69,9 @@ my %type_handler = (
'hex32' => \&validate_hex_32_bits,
'ipv6_addr_param' => \&validate_ipv6_addr_param,
'restrictive_filename' => \&validate_restrictive_filename,
- 'no_bash_special' => \&validate_no_bash_special
+ 'no_bash_special' => \&validate_no_bash_special,
+ 'u32' => \&validate_u32,
+ 'bool' => \&validate_bool
);
sub validate_ipv4 {
@@ -79,6 +81,16 @@ sub validate_ipv4 {
return 1;
}
+sub validate_u32 {
+ my $val = shift;
+ return ($val =~ /^\d+$/ and $val < 2**32);
+}
+
+sub validate_bool {
+ my $val = shift;
+ return ($val eq 'true' or $val eq 'false');
+}
+
sub validate_ipv4net {
$_ = shift;
return 0 if (!/^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/);