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.
This commit is contained in:
Christopher Faulet 2024-07-05 15:27:23 +02:00
parent 706a57d55a
commit 3a7879a652

View File

@ -3009,6 +3009,37 @@ static int smp_fetch_spoe_engine_id(const struct arg *args, struct sample *smp,
return 1; 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 */ /* Declare the filter parser for "spoe" keyword */
static struct flt_kw_list flt_kws = { "SPOE", { }, { static struct flt_kw_list flt_kws = { "SPOE", { }, {
{ "spoe", parse_spoe_flt, NULL }, { "spoe", parse_spoe_flt, NULL },