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:
parent
67270a2d64
commit
435a32684f
|
@ -34,7 +34,7 @@ module VagrantPlugins
|
||||||
# @return [Array<Socket::Ifaddr>] interface list
|
# @return [Array<Socket::Ifaddr>] interface list
|
||||||
def list_interfaces
|
def list_interfaces
|
||||||
Socket.getifaddrs.find_all do |i|
|
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?
|
!i.addr.ipv6_loopback? && !i.addr.ipv6_linklocal?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue