[pve-devel] r6012 - pve-common/trunk/data/PVE
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue May 24 07:38:03 CEST 2011
Author: dietmar
Date: 2011-05-24 07:38:03 +0200 (Tue, 24 May 2011)
New Revision: 6012
Modified:
pve-common/trunk/data/PVE/JSONSchema.pm
pve-common/trunk/data/PVE/Tools.pm
Log:
new format for netmask
Modified: pve-common/trunk/data/PVE/JSONSchema.pm
===================================================================
--- pve-common/trunk/data/PVE/JSONSchema.pm 2011-05-23 11:40:42 UTC (rev 6011)
+++ pve-common/trunk/data/PVE/JSONSchema.pm 2011-05-24 05:38:03 UTC (rev 6012)
@@ -125,7 +125,18 @@
}
return $ipv4;
}
+register_format('ipv4mask', \&pve_verify_ipv4mask);
+sub pve_verify_ipv4mask {
+ my ($mask, $noerr) = @_;
+ if ($mask !~ m/^255\.255\.(\d{1,3})\.(\d{1,3})$/ ||
+ !(($1 <= 255) && ($2 <= 255))) {
+ return undef if $noerr;
+ die "value does not look like a valid IP netmask\n";
+ }
+ return $mask;
+}
+
register_format('email', \&pve_verify_email);
sub pve_verify_email {
my ($email, $noerr) = @_;
@@ -143,7 +154,7 @@
sub pve_verify_iface {
my ($id, $noerr) = @_;
- if ($id !~ m/^[a-z][a-z0-9_]{1,20}$/i) {
+ if ($id !~ m/^[a-z][a-z0-9_]{1,20}([:\.]\d+)?$/i) {
return undef if $noerr;
die "invalid network interface name '$id'\n";
}
Modified: pve-common/trunk/data/PVE/Tools.pm
===================================================================
--- pve-common/trunk/data/PVE/Tools.pm 2011-05-23 11:40:42 UTC (rev 6011)
+++ pve-common/trunk/data/PVE/Tools.pm 2011-05-24 05:38:03 UTC (rev 6012)
@@ -333,7 +333,7 @@
sub split_list {
my $listtxt = shift || '';
- $listtxt =~ s/[,;]/ /g;
+ $listtxt =~ s/[,;\0]/ /g;
$listtxt =~ s/^\s+//;
my @data = split (/\s+/, $listtxt);
More information about the pve-devel
mailing list