Only return interfaces where addr is not nil

tunnel interfaces on Linux have addr set to nil which makes the function
list_interfaces fail with a backtrace.
This commit is contained in:
Dan Čermák 2019-07-26 15:47:29 +02:00 committed by Brian Cain
parent 67270a2d64
commit 435a32684f
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ module VagrantPlugins
# @return [Array<Socket::Ifaddr>] interface list
def list_interfaces
Socket.getifaddrs.find_all do |i|
i.addr.ip? && !i.addr.ipv4_loopback? &&
!i.addr.nil? && i.addr.ip? && !i.addr.ipv4_loopback? &&
!i.addr.ipv6_loopback? && !i.addr.ipv6_linklocal?
end
end