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:
parent
c4534006af
commit
ab08ec798d
@ -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>)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user