[lxc-devel] [lxd/master] shared/network: Don't crash on VPN devices

stgraber on Github lxc-bot at linuxcontainers.org
Thu Sep 27 08:00:13 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180927/5f36b9c1/attachment.bin>
-------------- next part --------------
From eb37e56027029f4c0591d60d40e79282ae48e2cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 27 Sep 2018 09:59:30 +0200
Subject: [PATCH] shared/network: Don't crash on VPN devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5076

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/network_linux.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/shared/network_linux.go b/shared/network_linux.go
index 07cfbad64b..52ab52d85a 100644
--- a/shared/network_linux.go
+++ b/shared/network_linux.go
@@ -65,6 +65,10 @@ func NetnsGetifaddrs(initPID int32) (map[string]api.ContainerStateNetwork, error
 			}
 		}
 
+		if addr.ifa_addr == nil {
+			continue
+		}
+
 		if addr.ifa_addr.sa_family == C.AF_INET || addr.ifa_addr.sa_family == C.AF_INET6 {
 			netState := "down"
 			netType := "unknown"


More information about the lxc-devel mailing list