]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stconn: Always declare the SC created from healthchecks as a back SC
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Mar 2026 13:24:52 +0000 (15:24 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Mar 2026 13:47:36 +0000 (15:47 +0200)
The SC created from a healthcheck is always a back SC. But SC_FL_ISBACK
flags was missing. Instead of passing it when sc_new_from_check() is called,
the function was simplified to set SC_FL_ISBACK flag systematically when a
SC is created from a healthcheck.

This patch should be backported as far as 2.6.

include/haproxy/stconn.h
src/check.c
src/stconn.c

index 8d4094c2bcd159475b14695eccad5a45d665feb0..68146b9992c18e64fc36825406ff015eaa326aa9 100644 (file)
@@ -45,7 +45,7 @@ void se_shutdown(struct sedesc *sedesc, enum se_shut_mode mode);
 
 struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
 struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags);
-struct stconn *sc_new_from_check(struct check *check, unsigned int flags);
+struct stconn *sc_new_from_check(struct check *check);
 void sc_free(struct stconn *sc);
 
 int sc_attach_mux(struct stconn *sc, void *target, void *ctx);
index e391e2e74a5241e2190a498c7bf4d0c1b3a6e13b..051d4ca40a9a54877075c7412fec7b9bb4f0ff74 100644 (file)
@@ -1317,7 +1317,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
 
                check->current_step = NULL;
 
-               check->sc = sc_new_from_check(check, SC_FL_NONE);
+               check->sc = sc_new_from_check(check);
                if (!check->sc) {
                        set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL);
                        goto end;
index 9f5575d4f577540b1ac77f02f0981ee78342168e..e20c24529b3da27da0efff11c5b855a4b3dda187 100644 (file)
@@ -219,14 +219,14 @@ struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags)
  * thus it will be created by sc_new(). So the SE_FL_DETACHED flag is set. It
  * returns NULL on error. On success, the new stream connector is returned.
  */
-struct stconn *sc_new_from_check(struct check *check, unsigned int flags)
+struct stconn *sc_new_from_check(struct check *check)
 {
        struct stconn *sc;
 
        sc = sc_new(NULL);
        if (unlikely(!sc))
                return NULL;
-       sc->flags |= flags;
+       sc->flags = SC_FL_ISBACK;
        sc_ep_set(sc, SE_FL_DETACHED);
        sc->app = &check->obj_type;
        return sc;