]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: init bind_proc to 1 if it wasn't initialized
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 24 Mar 2020 15:02:48 +0000 (16:02 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 24 Mar 2020 15:18:15 +0000 (16:18 +0100)
Tim reported that in master-worker mode, if a stick-table is declared
but not used in the configuration, its associated peers listener won't
bind.

This problem is due the fact that the master-worker and the daemon mode,
depend on the bind_proc field of the peers proxy to disable the listener.
Unfortunately the bind_proc is left to 0 if no stick-table were used in
the configuration, stopping the listener on all processes.

This fixes sets the bind_proc to the first process if it wasn't
initialized.

Should fix bug #558. Should be backported as far as 1.8.

src/cfgparse.c

index 5424574c926ad36530734245b4956ae93e7f9985..85fc185fb6efc9ace029ec7339b8ba9039f4bc2d 100644 (file)
@@ -3907,6 +3907,19 @@ out_uri_auth_compat:
                struct peers *curpeers = cfg_peers, **last;
                struct peer *p, *pb;
 
+               /* In the case the peers frontend was not initialized by a
+                stick-table used in the configuration, set its bind_proc
+                by default to the first process. */
+               while (curpeers) {
+                       if (!curpeers->peers_fe)
+                               continue;
+                       if (curpeers->peers_fe->bind_proc == 0)
+                               curpeers->peers_fe->bind_proc = 1;
+
+                       curpeers = curpeers->next;
+               }
+
+               curpeers = cfg_peers;
                /* Remove all peers sections which don't have a valid listener,
                 * which are not used by any table, or which are bound to more
                 * than one process.