SHA256
1
0
forked from pool/vagrant
vagrant/0013-Only-return-interfaces-where-addr-is-not-nil.patch

28 lines
1.1 KiB
Diff
Raw Normal View History

From 991218e9c3b632d15a1246961df825cb615d900e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Fri, 26 Jul 2019 15:47:29 +0200
Subject: [PATCH 13/15] 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.
---
plugins/providers/docker/action/prepare_networks.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/providers/docker/action/prepare_networks.rb b/plugins/providers/docker/action/prepare_networks.rb
index 4d1904e85..34a357bee 100644
--- a/plugins/providers/docker/action/prepare_networks.rb
+++ b/plugins/providers/docker/action/prepare_networks.rb
@@ -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
--
2.22.1