From: Christopher Faulet Date: Mon, 30 Mar 2026 13:24:52 +0000 (+0200) Subject: BUG/MINOR: stconn: Always declare the SC created from healthchecks as a back SC X-Git-Tag: v3.4-dev8~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5280130343f893d890fff3ce210e1a26a7e5c440;p=thirdparty%2Fhaproxy.git BUG/MINOR: stconn: Always declare the SC created from healthchecks as a back SC 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. --- diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 8d4094c2b..68146b999 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -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); diff --git a/src/check.c b/src/check.c index e391e2e74..051d4ca40 100644 --- a/src/check.c +++ b/src/check.c @@ -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; diff --git a/src/stconn.c b/src/stconn.c index 9f5575d4f..e20c24529 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -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;