[lxc-devel] [lxd/master] shared/cert: Replace default IPs with localhost addresses

stgraber on Github lxc-bot at linuxcontainers.org
Wed Jan 29 18:59:03 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200129/bf325623/attachment-0001.bin>
-------------- next part --------------
From 6fbaeee00292b14d3f23e2e2c2284762c543f5dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 29 Jan 2020 13:44:03 -0500
Subject: [PATCH 1/2] shared/cert: Replace default IPs with localhost
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6802

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/cert.go | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/shared/cert.go b/shared/cert.go
index 47fd232ae7..9cc09c7ae7 100644
--- a/shared/cert.go
+++ b/shared/cert.go
@@ -185,28 +185,7 @@ func mynames() ([]string, error) {
 		return nil, err
 	}
 
-	ret := []string{h}
-
-	ifs, err := net.Interfaces()
-	if err != nil {
-		return nil, err
-	}
-
-	for _, iface := range ifs {
-		if IsLoopback(&iface) {
-			continue
-		}
-
-		addrs, err := iface.Addrs()
-		if err != nil {
-			return nil, err
-		}
-
-		for _, addr := range addrs {
-			ret = append(ret, addr.String())
-		}
-	}
-
+	ret := []string{h, "127.0.0.1/8", "::1/128"}
 	return ret, nil
 }
 

From 798aea3e912fbccbe0d414e0cd4437d2e74339b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 29 Jan 2020 13:58:25 -0500
Subject: [PATCH 2/2] shared/subprocess: Improve error in test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/subprocess/bgpm_test.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/subprocess/bgpm_test.go b/shared/subprocess/bgpm_test.go
index fddd5db008..7d4654b5c1 100644
--- a/shared/subprocess/bgpm_test.go
+++ b/shared/subprocess/bgpm_test.go
@@ -120,7 +120,7 @@ func TestStopRestart(t *testing.T) {
 	if err != nil {
 		t.Error("Could not wait for process: ", err)
 	} else if exitcode != 0 {
-		t.Error("Exit code expected to be 0")
+		t.Errorf("Exit code expected to be 0 but got %d", exitCode)
 	}
 
 	err = os.Remove("testscript/test2.yaml")


More information about the lxc-devel mailing list