[pve-devel] [RFC manager] Remove IPv4 netmask check

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Jun 3 15:33:25 CEST 2016


---
This check makes it impossible to use /31 and /32 IPv4 addresses.
While this might seem like a reasonable thing to do due to the
lack of address space (eg. broadcast addresses), I'm not sure it
makes sense to really enforce this limit (anymore).

If a hosting provider assigns you a single IP with a separate gateway
for which you have to configure an extra route (via post-up), then
you simply don't have a broadcast address since you don't have a LAN
at all. We already lifted this restriction in our container network
configuration as there it is sometimes the recommended type of
configuration according to some hosters.

I'm not sure why/if there are hosting providers who'd use such
a configuration for their main nodes, but we've recently received
a complaint about this...

Comments?

 PVE/API2/Network.pm | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 186434a..9225686 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -254,18 +254,6 @@ my $check_duplicate_gateway6 = sub {
     return &$check_duplicate($config, $newiface, 'gateway6', 'Default ipv6 gateway');
 };
 
-my $check_ipv4_settings = sub {
-    my ($address, $netmask) = @_;
-
-    my $binip = Net::IP::ip_iptobin($address, 4);
-    my $binmask = Net::IP::ip_iptobin($netmask, 4);
-    my $broadcast = Net::IP::ip_iptobin('255.255.255.255', 4);
-    my $binhost = $binip | $binmask;
-
-    raise_param_exc({ address => "$address is not a valid host ip address." })
-        if ($binhost eq $binmask) || ($binhost eq $broadcast);
-};
-
 sub ipv6_tobin {
     return Net::IP::ip_iptobin(Net::IP::ip_expand_address(shift, 6), 6);
 }
@@ -324,8 +312,6 @@ __PACKAGE__->register_method({
 	    &$check_duplicate_gateway6($ifaces, $iface)
 		if $param->{gateway6};
 
-	    &$check_ipv4_settings($param->{address}, $param->{netmask})
-		if $param->{address};
 	    &$check_ipv6_settings($param->{address6}, int($param->{netmask6}))
 		if $param->{address6};
 
@@ -417,7 +403,6 @@ __PACKAGE__->register_method({
 		if $param->{gateway6};
 
 	    if ($param->{address}) {
-		&$check_ipv4_settings($param->{address}, $param->{netmask});
 		push @$families, 'inet' if !grep(/^inet$/, @$families);
 	    } else {
 		@$families = grep(!/^inet$/, @$families);
-- 
2.1.4





More information about the pve-devel mailing list