MINOR/BUG: mworker/cli: do not use the unix_bind prefix for the master CLI socket
If the configuration file contains a 'unix-bind prefix' directive, and
if we use the -S option and specify a UNIX socket path, the path of the
socket will be prepended with the value of the unix-bind prefix.
For instance, if we have 'unix-bind prefix /tmp/sockets/' and we use
'-S /tmp/master-socket' on the command line, we will get this error:
Starting proxy MASTER:
cannot bind UNIX socket (No such file or directory) [/tmp/sockets/tmp/master-socket]
So this patch adds an exception, and will ignore the unix-bind prefix
for the master CLI socket.
This patch can be backported as far as 1.9.
(cherry picked from commit 1b8dacc858d7cb43488fb2ffca053274c571da1d)
[wt: cli_fe was called stats_fe in 2.3 and older]
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/cfgparse.c b/src/cfgparse.c
index dce65f8..64af041 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -87,6 +87,8 @@
struct list postparsers = LIST_HEAD_INIT(postparsers);
+extern struct proxy *mworker_proxy;
+
char *cursection = NULL;
struct proxy defproxy = { }; /* fake proxy used to assign default values on all instances */
int cfg_maxpconn = 0; /* # of simultaneous connections per proxy (-N) */
@@ -128,7 +130,7 @@
}
ss2 = str2sa_range(str, NULL, &port, &end, &fd, &proto, err,
- curproxy == global.stats_fe ? NULL : global.unix_bind.prefix,
+ (curproxy == global.stats_fe || curproxy == mworker_proxy) ? NULL : global.unix_bind.prefix,
NULL, PA_O_RESOLVE | PA_O_PORT_OK | PA_O_PORT_MAND | PA_O_PORT_RANGE |
PA_O_SOCKET_FD | PA_O_STREAM | PA_O_XPRT);
if (!ss2)