The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5020
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Closes #5009 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 5284cfbe7260816deadda03c1e6a6a790f038189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sun, 9 Sep 2018 20:45:11 -0700 Subject: [PATCH] lxd/proxy: Fix unix socket paths in snap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #5009 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/proxy_device_utils.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lxd/proxy_device_utils.go b/lxd/proxy_device_utils.go index 960ed07281..d6616bc9b8 100644 --- a/lxd/proxy_device_utils.go +++ b/lxd/proxy_device_utils.go @@ -34,14 +34,15 @@ func setupProxyProcInfo(c container, device map[string]string) (*proxyProcInfo, connectAddr := device["connect"] listenAddr := device["listen"] - connectionType := strings.SplitN(connectAddr, ":", 2)[0] - listenerType := strings.SplitN(listenAddr, ":", 2)[0] + connectionFields := strings.SplitN(connectAddr, ":", 2) + listenerFields := strings.SplitN(listenAddr, ":", 2) - if !shared.StringInSlice(connectionType, []string{"tcp", "udp", "unix"}) { - return nil, fmt.Errorf("Proxy device doesn't support the connection type: %s", connectionType) + if !shared.StringInSlice(connectionFields[0], []string{"tcp", "udp", "unix"}) { + return nil, fmt.Errorf("Proxy device doesn't support the connection type: %s", connectionFields[0]) } - if !shared.StringInSlice(listenerType, []string{"tcp", "udp", "unix"}) { - return nil, fmt.Errorf("Proxy device doesn't support the listener type: %s", listenerType) + + if !shared.StringInSlice(listenerFields[0], []string{"tcp", "udp", "unix"}) { + return nil, fmt.Errorf("Proxy device doesn't support the listener type: %s", listenerFields[0]) } listenPid := "-1" @@ -59,6 +60,14 @@ func setupProxyProcInfo(c container, device map[string]string) (*proxyProcInfo, return nil, fmt.Errorf("Invalid binding side given. Must be \"host\" or \"container\"") } + if connectionFields[0] == "unix" && !strings.HasPrefix(connectionFields[1], "@") && bindVal == "container" { + connectAddr = fmt.Sprintf("%s:%s", connectionFields[0], shared.HostPath(connectionFields[1])) + } + + if listenerFields[0] == "unix" && !strings.HasPrefix(connectionFields[1], "@") && bindVal == "host" { + listenAddr = fmt.Sprintf("%s:%s", listenerFields[0], shared.HostPath(listenerFields[1])) + } + p := &proxyProcInfo{ listenPid: listenPid, connectPid: connectPid,
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel