]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tcpcheck: Use tcpcheck flags to know a healthcheck uses SSL connections
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 26 Mar 2026 21:54:12 +0000 (22:54 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Apr 2026 14:34:38 +0000 (16:34 +0200)
The proxy flag PR_O_TCPCHK_SSL is replaced by a flag on the tcpcheck
itself. When TCPCHK_FL_USE_SSL flag is set, it means the healthcheck will
use an SSL connection and the SSL xprt must be prepared for the server.

include/haproxy/proxy-t.h
include/haproxy/tcpcheck-t.h
src/proxy.c
src/server.c
src/tcpcheck.c

index 4ab6fccb07dfbb07b5ea589c5a9e14b218fb8d03..5e786da3ee94e3a488d2ad176d2935fed7622d5e 100644 (file)
@@ -117,7 +117,7 @@ enum PR_SRV_STATE_FILE {
 #define PR_O_HTTP_DROP_REQ_TRLS 0x04000000 /* Drop the request trailers when forwarding to the server */
 #define PR_O_HTTP_DROP_RES_TRLS 0x08000000 /* Drop response trailers when forwarding to the client */
 
-#define PR_O_TCPCHK_SSL 0x10000000      /* at least one TCPCHECK connect rule requires SSL */
+/* unused: 0x10000000 */
 #define PR_O_CONTSTATS  0x20000000      /* continuous counters */
 /* unused: 0x40000000..0x80000000 */
 
index a0879b65d7ca19bc0c1bdcef155902df019f0eaa..c3e87b6fedd0d2ceeb5bf69c51fa419c7862cb9d 100644 (file)
@@ -108,6 +108,7 @@ enum tcpcheck_rule_type {
 #define TCPCHK_FL_UNUSED_TCP_RS  0x00000001 /* An unused tcp-check ruleset exists for the current proxy */
 #define TCPCHK_FL_UNUSED_HTTP_RS 0x00000002 /* An unused http-check ruleset exists for the current proxy  */
 #define TCPCHK_FL_UNUSED_RS      0x00000003 /* Mask for unused ruleset */
+#define TCPCHK_FL_USE_SSL        0x00000004 /* tcp-check uses SSL connection */
 
 #define TCPCHK_RULES_NONE         0x00000000
 #define TCPCHK_RULES_DISABLE404   0x00000001 /* Disable a server on a 404 response wht HTTP health checks */
index 494f4f5d6f90fd1490bad2ed7ad45067c23123ab..c028e348c6f62f7f45383853025c354421b9f3fd 100644 (file)
@@ -2542,7 +2542,7 @@ int proxy_finalize(struct proxy *px, int *err_code)
                 * if default-server have use_ssl, prerare ssl init
                 * without activating it */
                if (newsrv->use_ssl == 1 || newsrv->check.use_ssl == 1 ||
-                   (newsrv->proxy->options & PR_O_TCPCHK_SSL) ||
+                   (newsrv->check.tcpcheck->flags & TCPCHK_FL_USE_SSL) ||
                    ((newsrv->flags & SRV_F_DEFSRV_USE_SSL) && newsrv->use_ssl != 1)) {
                        if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv)
                                cfgerr += xprt_get(XPRT_SSL)->prepare_srv(newsrv);
index 1dcf62841282baeec7b8d2e4ca29dcaf24910300..d6a41471064f10e337cbf716f57418eaf79779bb 100644 (file)
@@ -6262,7 +6262,7 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
        /* ensure minconn/maxconn consistency */
        srv_minmax_conn_apply(srv);
 
-       if (srv->use_ssl == 1 || (srv->proxy->options & PR_O_TCPCHK_SSL) ||
+       if (srv->use_ssl == 1 || (srv->check.tcpcheck->flags & TCPCHK_FL_USE_SSL) ||
            srv->check.use_ssl == 1) {
                if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv) {
                        if (xprt_get(XPRT_SSL)->prepare_srv(srv))
index 70861b6ef94545c5a6f99f7f64a8191d328f7db0..e476cbd886bfd7618751c957b7f0d2453e870afb 100644 (file)
@@ -2839,7 +2839,7 @@ struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, struct pr
                        conn_opts |= TCPCHK_OPT_LINGER;
 #ifdef USE_OPENSSL
                else if (strcmp(args[cur_arg], "ssl") == 0) {
-                       px->options |= PR_O_TCPCHK_SSL;
+                       px->tcpcheck.flags |= TCPCHK_FL_USE_SSL;
                        conn_opts |= TCPCHK_OPT_SSL;
                }
                else if (strcmp(args[cur_arg], "sni") == 0) {