summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-26 13:12:01 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-26 13:12:01 -0800
commit1941ce858983749d737b609f918410c33fc98e9b (patch)
tree72d801e479f05d85c9fe291069b39fc214435f99
parent4bcfe92678e6a0f4d31ea198936a21638012158f (diff)
parentfb4995b1be4aefb7652b3e6a5834326c8922ac1b (diff)
downloadvyatta-cfg-1941ce858983749d737b609f918410c33fc98e9b.tar.gz
vyatta-cfg-1941ce858983749d737b609f918410c33fc98e9b.zip
Merge branch 'jenner' of suva.vyatta.com:/git/vyatta-cfg into jenner
-rw-r--r--debian/changelog12
-rwxr-xr-xlib/Vyatta/TypeChecker.pm44
2 files changed, 56 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 92becf8..3761f06 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+vyatta-cfg (0.14.4) unstable; urgency=low
+
+ [ Stephen Hemminger ]
+ * Fix regression in Vyatta::Misc
+ * Fix isIPinInterfaces
+ * update unit tests
+
+ [ Bob Gilligan ]
+ * Add more IPv6 address and prefix validation functions.
+
+ -- Bob Gilligan <gilligan@vyatta.com> Thu, 22 Jan 2009 13:35:03 -0800
+
vyatta-cfg (0.14.3) unstable; urgency=low
[ Stephen Hemminger ]
diff --git a/lib/Vyatta/TypeChecker.pm b/lib/Vyatta/TypeChecker.pm
index 45803ea..37f365d 100755
--- a/lib/Vyatta/TypeChecker.pm
+++ b/lib/Vyatta/TypeChecker.pm
@@ -64,6 +64,9 @@ my %type_handler = (
'macaddr' => \&validate_macaddr,
'macaddr_negate' => \&validate_macaddr_negate,
'ipv6' => \&validate_ipv6,
+ 'ipv6_negate' => \&validate_ipv6_negate,
+ 'ipv6net' => \&validate_ipv6net,
+ 'ipv6net_negate' => \&validate_ipv6net_negate,
);
sub validate_ipv4 {
@@ -184,6 +187,41 @@ sub validate_ipv6 {
return 1;
}
+sub validate_ipv6_negate {
+ my $value = shift;
+ if ($value =~ m/^\!(.*)$/) {
+ $value = $1;
+ }
+ return validate_ipv6($value);
+}
+
+sub validate_ipv6net {
+ my $value = shift;
+
+ if ($value =~ m/^(.*)\/(.*)$/) {
+ my $ipv6_addr = $1;
+ my $prefix_length = $2;
+ if ($prefix_length < 0 || $prefix_length > 128) {
+ print "Invalid prefix length: $prefix_length\n";
+ return 0;
+ }
+ return validate_ipv6($ipv6_addr);
+
+ } else {
+ print "\"$value\" is not a valid IPv6 prefix\n";
+ return 0;
+ }
+}
+
+sub validate_ipv6net_negate {
+ my $value = shift;
+
+ if ($value =~ m/^\!(.*)$/) {
+ $value = $1;
+ }
+ return validate_ipv6net($value);
+}
+
sub validateType {
my ($type, $value, $quiet) = @_;
if (!defined($type) || !defined($value)) {
@@ -218,3 +256,9 @@ sub findType {
}
1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 2
+# End: