[pve-devel] [PATCH manager] fix #2267: delete address(6) and netmas(6) with cidr(6)

Dominik Csapak d.csapak at proxmox.com
Mon Jul 8 16:29:18 CEST 2019


otherwise a user cannot delete an ip from an interface

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Network.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 00337fe2..5e2abda1 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -435,6 +435,13 @@ __PACKAGE__->register_method({
 		delete $ifaces->{$iface}->{$k};
 		@$families = grep(!/^inet$/, @$families) if $k eq 'address';
 		@$families = grep(!/^inet6$/, @$families) if $k eq 'address6';
+		if ($k eq 'cidr') {
+		    delete $ifaces->{$iface}->{netmask};
+		    delete $ifaces->{$iface}->{address};
+		} elsif ($k eq 'cidr6') {
+		    delete $ifaces->{$iface}->{netmask6};
+		    delete $ifaces->{$iface}->{address6};
+		}
 	    }
 
 	    $map_cidr_to_address_netmask->($param);
-- 
2.20.1





More information about the pve-devel mailing list