]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: add a BUG_ON() on mproxy_li in _send_status
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 5 Mar 2026 14:54:13 +0000 (15:54 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 9 Mar 2026 15:51:56 +0000 (16:51 +0100)
mproxy_li is supposed to be used in _send_status to stop the sockpair FD
between the master and the new worker, being a listener.

This can only work if the listener has been stored in the fdtab owner,
and there's no reason it shouldn't be here.

src/cli.c

index 55a514d090fddaaaf5e35c87819352500c500100..ee53961f07ae28768ad53b5aa2859d7856954bc8 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2628,7 +2628,14 @@ static int _send_status(char **args, char *payload, struct appctx *appctx, void
                /* update status of the new worker */
                if (proc->pid == pid) {
                        proc->options &= ~PROC_O_INIT;
+                       /* the sockpair between the master and the worker is
+                        * used temporarly as a listener to receive
+                        * _send_status. Once it is received we don't want to
+                        * use this FD as a listener anymore, but only as a
+                        * server, to allow only connections from the master to
+                        * the worker for the master CLI */
                        mproxy_li = fdtab[proc->ipc_fd[0]].owner;
+                       BUG_ON(mproxy_li == NULL);
                        stop_listener(mproxy_li, 0, 0, 0);
                }
                /* send TERM to workers, which have exceeded max_reloads counter */