BUG/MINOR: sink: detect and warn when using "send-proxy" options with ring servers

using "send-proxy" or "send-proxy-v2" option on a ring server is not
relevant nor supported. Worse, on 2.4 it causes haproxy process to
crash as reported in GH #2965.

Let's be more explicit about the fact that this keyword is not supported
under "ring" context by ignoring the option and emitting a warning message
to inform the user about that.

Ideally, we should do the same for peers and log servers. The proper way
would be to check servers options during postparsing but we currently lack
proper cross-type server postparsing hooks. This will come later and thus
will give us a chance to perform the compatibilty checks for server
options depending on proxy type. But for now let's simply fix the "ring"
case since it is the only one that's known to cause a crash.

It may be backported to all stable versions.
This commit is contained in:
Aurelien DARRAGON 2025-05-15 15:54:13 +02:00
parent 824bb93e18
commit 098a5e5c0b

View File

@ -1088,6 +1088,19 @@ int cfg_parse_ring(const char *file, int linenum, char **args, int kwm)
err_code |= parse_server(file, linenum, args, cfg_sink->forward_px, NULL,
SRV_PARSE_PARSE_ADDR|SRV_PARSE_INITIAL_RESOLVE);
if (err_code & ERR_CODE)
goto err;
/* FIXME: ideally this check should be performed during server postparsing
* for all proxies where this option is unsupported, but for now we lack
* server postparsing rules for sinks so let's put that here
*/
if (cfg_sink->forward_px->srv && cfg_sink->forward_px->srv->pp_opts) {
cfg_sink->forward_px->srv->pp_opts = 0;
ha_warning("parsing [%s:%d] : 'send-proxy*' server option is unsupported there, ignoring it\n", file, linenum);
err_code |= ERR_WARN;
}
}
else if (strcmp(args[0],"timeout") == 0) {
if (!cfg_sink || !cfg_sink->forward_px) {