From b12ef0aa447fdbc6ecd142bac212cd41e728ff5f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 26 Jun 2026 10:23:23 +0200 Subject: [PATCH] MINOR: proxy: permit to report version info for option deprecation It's already possible to report that some options are not supported due to build options by passing 0 instead of PR_CAP_* in the option's cap field. Let's extend that by passing a non-zero value in the val field, where the 3rd byte will be the major version and the 4th one the minor. In this case haproxy will now indicate that support for that option was removed in that version. --- src/cfgparse-listen.c | 11 +++++++++-- src/proxy.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 38f2bc4d0..c467e12c4 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -256,8 +256,15 @@ int cfg_parse_listen_match_option(const char *file, int linenum, int kwm, for (optnum = 0; config_opts[optnum].name; optnum++) { if (strcmp(args[1], config_opts[optnum].name) == 0) { if (config_opts[optnum].cap == PR_CAP_NONE) { - ha_alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", - file, linenum, config_opts[optnum].name); + if (config_opts[optnum].val) + ha_alert("parsing [%s:%d]: support for option '%s' was removed in version %u.%u.\n", + file, linenum, config_opts[optnum].name, + (config_opts[optnum].val >> 8) & 0xff, + config_opts[optnum].val & 0xff); + else + ha_alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", + file, linenum, config_opts[optnum].name); + *err_code |= ERR_ALERT | ERR_FATAL; goto out; } diff --git a/src/proxy.c b/src/proxy.c index ae1b589a4..6b54a08ea 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -94,7 +94,11 @@ struct show_srv_ctx { } state; }; -/* proxy->options */ +/* proxy->options. For unsupported ones, pass 0 in the "cap" (PR_CAP_*) field. + * If this is due to feature removal, the val field can contain the version the + * option was removed in the "val" (PR_O_*) field as (major<<8)+minor (e.g. + * 0x305 for "3.5"). Pass zero there to indicate build options instead. + */ const struct cfg_opt cfg_opts[] = { { "abortonclose", PR_O_ABRT_CLOSE, PR_CAP_BE|PR_CAP_FE, 0, 0 },