5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-01-24 14:03:35 +03:00

net: don't die in get_active_interfaces() and try both address families

This commit is contained in:
Wolfgang Bumiller 2016-03-10 15:28:34 +01:00 committed by Dietmar Maurer
parent c4534006af
commit ab08ec798d

View File

@ -532,8 +532,10 @@ sub get_active_interfaces {
open my $fh, '<', '/proc/net/dev'
or die "failed to open /proc/net/dev: $!\n";
# And filter by IFF_UP flag fetched via a PF_INET6 socket ioctl:
socket my $sock, PF_INET6, SOCK_DGRAM, &IPPROTO_IP
or die "failed to open socket\n";
my $sock;
socket($sock, PF_INET6, SOCK_DGRAM, &IPPROTO_IP)
or socket($sock, PF_INET, SOCK_DGRAM, &IPPROTO_IP)
or return [];
my $ifaces = [];
while(defined(my $line = <$fh>)) {