]> git.proxmox.com Git - pve-container.git/commitdiff
allow /32 CIDRs and remove duplicated mask array
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 16 Oct 2015 07:29:48 +0000 (09:29 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Oct 2015 07:55:38 +0000 (09:55 +0200)
debian/changelog
src/PVE/LXC.pm

index 42408e56064cc2fd8c8ad3c9b8675f5c1dc31167..cc81a611fa92ba6cc48f2cba97bbfa3fc44f793b 100644 (file)
@@ -4,6 +4,8 @@ pve-container (1.0-11) unstable; urgency=medium
 
   * setup/debian: avoid extra newlines
 
+  * allow /32 CIDRs and remove duplicated mask array
+
  -- Proxmox Support Team <support@proxmox.com>  Fri, 16 Oct 2015 09:49:28 +0200
 
 pve-container (1.0-10) unstable; urgency=medium
index af0d5d4d547d96c26e8105dcb1d4d1557dcdbe79..79028b3b4095827c4a37d370cec802f947483dee 100644 (file)
@@ -948,49 +948,13 @@ sub find_lxc_pid {
     return $pid;
 }
 
-my $ipv4_reverse_mask = [
-    '0.0.0.0',
-    '128.0.0.0',
-    '192.0.0.0',
-    '224.0.0.0',
-    '240.0.0.0',
-    '248.0.0.0',
-    '252.0.0.0',
-    '254.0.0.0',
-    '255.0.0.0',
-    '255.128.0.0',
-    '255.192.0.0',
-    '255.224.0.0',
-    '255.240.0.0',
-    '255.248.0.0',
-    '255.252.0.0',
-    '255.254.0.0',
-    '255.255.0.0',
-    '255.255.128.0',
-    '255.255.192.0',
-    '255.255.224.0',
-    '255.255.240.0',
-    '255.255.248.0',
-    '255.255.252.0',
-    '255.255.254.0',
-    '255.255.255.0',
-    '255.255.255.128',
-    '255.255.255.192',
-    '255.255.255.224',
-    '255.255.255.240',
-    '255.255.255.248',
-    '255.255.255.252',
-    '255.255.255.254',
-    '255.255.255.255',
-];
-
 # Note: we cannot use Net:IP, because that only allows strict
 # CIDR networks
 sub parse_ipv4_cidr {
     my ($cidr, $noerr) = @_;
 
-    if ($cidr =~ m!^($IPV4RE)(?:/(\d+))$! && ($2 > 7) &&  ($2 < 32)) {
-       return { address => $1, netmask => $ipv4_reverse_mask->[$2] };
+    if ($cidr =~ m!^($IPV4RE)(?:/(\d+))$! && ($2 > 7) &&  ($2 <= 32)) {
+       return { address => $1, netmask => $PVE::Network::ipv4_reverse_mask->[$2] };
     }
 
     return undef if $noerr;