[pve-devel] [PATCH pve-network] sdn: Avoid warning of uninitialized variable on VM start

Stefan Lendl s.lendl at proxmox.com
Thu Nov 23 14:21:16 CET 2023


Signed-off-by: Stefan Lendl <s.lendl at proxmox.com>
---
 src/PVE/Network/SDN/Vnets.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm
index 0dfdfd7..4f313e3 100644
--- a/src/PVE/Network/SDN/Vnets.pm
+++ b/src/PVE/Network/SDN/Vnets.pm
@@ -200,6 +200,8 @@ sub add_dhcp_mapping {
 	print "No IP found for MAC: $mac for VMID:$vmid\n";
 	add_next_free_cidr($vnetid, $name, $mac, "$vmid", undef, 1);
 	($ip4, $ip6) = PVE::Network::SDN::Vnets::get_ips_from_mac($vnetid, $mac);
+	$ip4 //= '';
+	$ip6 //= '';
 	print "got new IP from IPAM: $ip4 $ip6\n";
     }
     PVE::Network::SDN::Dhcp::add_mapping($vnetid, $mac, $ip4, $ip6) if $ip4 || $ip6;
-- 
2.42.0






More information about the pve-devel mailing list