]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: proxy: add PR_CAP_LB for dynamically added backend
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 2 Oct 2026 07:25:13 +0000 (09:25 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 2 Oct 2026 07:34:33 +0000 (09:34 +0200)
When a new backend is added at runtime via the CLI, ensures its cap
contains PR_CAP_LB along with already set PR_CAP_BE.

The purpose of this cap is to flag a proxy with "load-balancing
capabilities". In fact this is a loose meaning which could be understand
in several manners. Currently, this cap is reserved for frontend,
backend and listen instances from the configuration file explicitely
created by users, by contrast to internal proxies. Thus, dynamically
added backends also enter in this definition.

The impact of this bug is limited as PR_CAP_LB usage is only used for
checking the compatibility of a server with the proxy mode. However,
this may change in the future so this change is mandatory.

This must be backported up to 3.4.

src/proxy.c

index d50da98fa276fa3c559d9940c6e2443dde37ff9e..37785a1c52640bf49797936b1d646464556fb809 100644 (file)
@@ -5052,7 +5052,7 @@ static int cli_parse_add_backend(char **args, char *payload, struct appctx *appc
                goto err;
        }
 
-       px = alloc_new_proxy(be_name, PR_CAP_BE, &msg);
+       px = alloc_new_proxy(be_name, PR_CAP_BE|PR_CAP_LB, &msg);
        if (!px)
                goto err;