forked from Mirror/pve-network
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>
This commit is contained in:
parent
00370995cb
commit
e06301af3a
|
@ -206,7 +206,7 @@ sub del_subnet {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_next_free_ip {
|
sub add_next_free_ip {
|
||||||
my ($zone, $subnetid, $subnet, $hostname, $mac, $vmid, $skipdns, $dhcprange) = @_;
|
my ($zone, $subnetid, $subnet, $hostname, $mac, $vmid, $skipdns, $dhcprange, $ipversion) = @_;
|
||||||
|
|
||||||
my $cidr = undef;
|
my $cidr = undef;
|
||||||
my $ip = undef;
|
my $ip = undef;
|
||||||
|
|
|
@ -95,7 +95,7 @@ sub get_subnet_from_vnet_ip {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_next_free_cidr {
|
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);
|
my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
|
||||||
return if !$vnet;
|
return if !$vnet;
|
||||||
|
@ -109,7 +109,7 @@ sub add_next_free_cidr {
|
||||||
|
|
||||||
my $ips = {};
|
my $ips = {};
|
||||||
|
|
||||||
my @ipversions = qw/ 4 6 /;
|
my @ipversions = defined($ipversion) ? ($ipversion) : qw/ 4 6 /;
|
||||||
for my $ipversion (@ipversions) {
|
for my $ipversion (@ipversions) {
|
||||||
my $ip = undef;
|
my $ip = undef;
|
||||||
my $subnetcount = 0;
|
my $subnetcount = 0;
|
||||||
|
|
Loading…
Reference in a new issue