Skip to content

Commit 098a5e5

Browse files
committed
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.
1 parent 824bb93 commit 098a5e5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/sink.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,19 @@ int cfg_parse_ring(const char *file, int linenum, char **args, int kwm)
10881088

10891089
err_code |= parse_server(file, linenum, args, cfg_sink->forward_px, NULL,
10901090
SRV_PARSE_PARSE_ADDR|SRV_PARSE_INITIAL_RESOLVE);
1091+
1092+
if (err_code & ERR_CODE)
1093+
goto err;
1094+
1095+
/* FIXME: ideally this check should be performed during server postparsing
1096+
* for all proxies where this option is unsupported, but for now we lack
1097+
* server postparsing rules for sinks so let's put that here
1098+
*/
1099+
if (cfg_sink->forward_px->srv && cfg_sink->forward_px->srv->pp_opts) {
1100+
cfg_sink->forward_px->srv->pp_opts = 0;
1101+
ha_warning("parsing [%s:%d] : 'send-proxy*' server option is unsupported there, ignoring it\n", file, linenum);
1102+
err_code |= ERR_WARN;
1103+
}
10911104
}
10921105
else if (strcmp(args[0],"timeout") == 0) {
10931106
if (!cfg_sink || !cfg_sink->forward_px) {

0 commit comments

Comments
 (0)