]> git.proxmox.com Git - pve-common.git/commitdiff
network: cope with non-existing interfaces config
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 26 Jun 2023 12:15:37 +0000 (14:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 26 Jun 2023 12:15:37 +0000 (14:15 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Network.pm

index 22ca5b3cc120d700a66640778f9565fabadbbfca..a4f5ba969fe18c6fe0dfe5a77b904860277d0d00 100644 (file)
@@ -740,8 +740,8 @@ sub get_local_ip {
 
     my $all = { v4 => {}, v6 => {} }; # hash to avoid duplicates and group by type
 
-    my $ifaces = PVE::INotify::read_file('interfaces', 1)->{data}->{ifaces};
-    for my $if (values $ifaces->%*) {
+    my $interaces_cfg = PVE::INotify::read_file('interfaces', 1) || {};
+    for my $if (values $interaces_cfg->{data}->{ifaces}->%*) {
        next if $if->{type} eq 'loopback' || (!defined($if->{address}) && !defined($if->{address6}));
        my ($v4, $v6) = ($if->{address}, $if->{address6});