From: Christopher Faulet Date: Fri, 5 Jul 2024 13:27:23 +0000 (+0200) Subject: MEDIUM: spoe: Set a specific name for the connection pool of SPOP servers X-Git-Tag: v3.1-dev4~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a7879a6525c866b1641050e28191dbcb87cc164;p=thirdparty%2Fhaproxy.git MEDIUM: spoe: Set a specific name for the connection pool of SPOP servers With this patch, we force the connection pool name of SPOP server to the SPOE engine identifier. This way, SPOP idle connections cannot be shared between diffrente engines. The related issue is #2502. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index c31bfb1924..d91002730f 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -3009,6 +3009,37 @@ static int smp_fetch_spoe_engine_id(const struct arg *args, struct sample *smp, return 1; } +static int spoe_postcheck_spop_proxy(struct proxy *px) +{ + struct server *srv; + int err_code = ERR_NONE; + + if (!(px->cap & PR_CAP_BE) || px->mode != PR_MODE_SPOP) + goto out; + + for (srv = px->srv; srv; srv = srv->next) { + if (srv->pool_conn_name) { + ha_free(&srv->pool_conn_name); + release_sample_expr(srv->pool_conn_name_expr); + } + srv->pool_conn_name = strdup("spoe.engine-id"); + if (!srv->pool_conn_name) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + srv->pool_conn_name_expr = _parse_srv_expr(srv->pool_conn_name, &px->conf.args, NULL, 0, NULL); + if (!srv->pool_conn_name_expr) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + } + + out: + return err_code; +} + +REGISTER_POST_PROXY_CHECK(spoe_postcheck_spop_proxy); + /* Declare the filter parser for "spoe" keyword */ static struct flt_kw_list flt_kws = { "SPOE", { }, { { "spoe", parse_spoe_flt, NULL },