]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR/BUG: mworker/cli: do not use the unix_bind prefix for the master CLI socket
authorEric Salama <esalama@haproxy.com>
Tue, 16 Mar 2021 14:12:17 +0000 (15:12 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 18 Mar 2021 08:08:19 +0000 (09:08 +0100)
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.

src/cfgparse.c
src/cli.c

index 8a0e9e7dff4ef70299a2006d4c96a66d32617694..1ec327b7eb1e481ded1695b1a6ee12edfe820b53 100644 (file)
@@ -88,6 +88,8 @@ struct list sections = LIST_HEAD_INIT(sections);
 
 struct list postparsers = LIST_HEAD_INIT(postparsers);
 
+extern struct proxy *mworker_proxy;
+
 char *cursection = NULL;
 int cfg_maxpconn = 0;                   /* # of simultaneous connections per proxy (-N) */
 int cfg_maxconn = 0;                   /* # of simultaneous connections, (-n) */
@@ -145,7 +147,7 @@ int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf,
                }
 
                ss2 = str2sa_range(str, NULL, &port, &end, &fd, &proto, err,
-                                  curproxy == global.cli_fe ? NULL : global.unix_bind.prefix,
+                                  (curproxy == global.cli_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)
index c2874443337582d6a470d23975722b60b957c30a..9aede130998defac94e920304c96c8ae354a36a0 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -82,7 +82,7 @@ static struct cli_kw_list cli_keywords = {
 
 extern const char *stat_status_codes[];
 
-static struct proxy *mworker_proxy; /* CLI proxy of the master */
+struct proxy *mworker_proxy; /* CLI proxy of the master */
 
 /* This will show the help message and list the commands supported at the
  * current level that match all of the first words of <args> if args is not