Re: [MINOR][PATCH] Fix segfault when trying to use seemless reload with at least an interface bound

2018-03-19 Thread Willy Tarreau
On Thu, Mar 15, 2018 at 05:54:09PM +0100, Olivier Houchard wrote:
> 
> Hi,
> 
> Trying to do a seemless reload while at least one socket has been bound to
> a specifig interface will lead to a segfault, because the guy who wrote that
> code did it by copying/pasting, and forgot to change an instance of
> "namespace" to "iface".
> The attached patch should fix it.

Applied, thanks!

willy



[MINOR][PATCH] Fix segfault when trying to use seemless reload with at least an interface bound

2018-03-15 Thread Olivier Houchard

Hi,

Trying to do a seemless reload while at least one socket has been bound to
a specifig interface will lead to a segfault, because the guy who wrote that
code did it by copying/pasting, and forgot to change an instance of
"namespace" to "iface".
The attached patch should fix it.

Regards,

Olivier
>From b249119e571a1b5c597819701e5ec6f7d4525cf8 Mon Sep 17 00:00:00 2001
From: Olivier Houchard 
Date: Thu, 15 Mar 2018 17:48:49 +0100
Subject: [PATCH] MINOR: seemless reload: Fix crash when an interface is
 specified.

When doing a seemless reload, while receiving the sockets from the old process
the new process will die if the socket has been bound to a specific
interface.
This happens because the code that tries to parse the informations bogusly
try to set xfer_sock->namespace, while it should be setting wfer_sock->iface.

This should be backported to 1.8.
---
 src/haproxy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/haproxy.c b/src/haproxy.c
index 4b740e135..e3e89c031 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1180,7 +1180,7 @@ static int get_old_sockets(const char *unixsocket)
goto out;
}
memcpy(xfer_sock->iface, &tmpbuf[curoff], len);
-   xfer_sock->namespace[len] = 0;
+   xfer_sock->iface[len] = 0;
curoff += len;
}
if (curoff + sizeof(int) > maxoff) {
-- 
2.14.3