diff options
| author | Stefan Lendl <s.lendl@proxmox.com> | 2024-04-05 15:17:54 +0200 | 
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2024-04-08 17:57:18 +0200 | 
| commit | e06301af3a6566fae5be3ecf7bf07ce5680876a6 (patch) | |
| tree | 24ffef3221a29f979d884eb2792cc68657a48ab4 /src/PVE/Network/SDN/Vnets.pm | |
| parent | 00370995cb3ae3e7af7904e4bf647b60928fc36b (diff) | |
sdn: dhcp: get next free ip for a specific IP version
Specify the IP version (4|6) for which an IP shall be requested from the IPAM.
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Diffstat (limited to 'src/PVE/Network/SDN/Vnets.pm')
| -rw-r--r-- | src/PVE/Network/SDN/Vnets.pm | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm index 0dfdfd7..03609b7 100644 --- a/src/PVE/Network/SDN/Vnets.pm +++ b/src/PVE/Network/SDN/Vnets.pm @@ -95,7 +95,7 @@ sub get_subnet_from_vnet_ip {  }  sub add_next_free_cidr { -    my ($vnetid, $hostname, $mac, $vmid, $skipdns, $dhcprange) = @_; +    my ($vnetid, $hostname, $mac, $vmid, $skipdns, $dhcprange, $ipversion) = @_;      my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);      return if !$vnet; @@ -109,7 +109,7 @@ sub add_next_free_cidr {      my $ips = {}; -    my @ipversions = qw/ 4 6 /; +    my @ipversions = defined($ipversion) ? ($ipversion) : qw/ 4 6 /;      for my $ipversion (@ipversions) {  	my $ip = undef;  	my $subnetcount = 0; @@ -125,7 +125,7 @@ sub add_next_free_cidr {  	    };  	    die $@ if $@; -            if ($ip) { +	    if ($ip) {  		$ips->{$ipversion} = $ip;  		last;  	    }  | 
