]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: haterm: cannot reset default "haterm" mode
authorFrederic Lecaille <flecaille@haproxy.com>
Mon, 23 Feb 2026 16:10:56 +0000 (17:10 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 23 Feb 2026 16:57:19 +0000 (17:57 +0100)
When "mode haterm" was set in a "defaults" section, it could not be
overridden in subsequent sections using the "mode" keyword. This is because
the proxy stream instantiation callback was not being reset to the
default stream_new() value.

This could break the stats URI with a configuration such as:

    defaults
        mode haterm
        # ...

    frontend stats
bind :8181
mode http
stats uri /

This patch ensures the ->stream_new_from_sc() proxy callback is reset
to stream_new() when the "mode" keyword is parsed for any mode other
than "haterm".

No need to backport.

src/cfgparse-listen.c

index 12d42782e83e45bdad17ba0485a4ed386024e0f4..a9e7c983e261e6710ac47ae1a7f3740bdcbb0193 100644 (file)
@@ -669,6 +669,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
+               else {
+                       /* valid mode, non "haterm" mode.
+                        * Possibly restore the ->stream_new_from_sc() callback
+                        * if set by default for "haterm" mode.
+                        */
+                       curproxy->stream_new_from_sc = stream_new;
+               }
 
                curproxy->mode = mode;
                if (curproxy->cap & PR_CAP_DEF)