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.
This commit is contained in:
Willy Tarreau 2026-06-26 10:23:23 +02:00
parent 088552ec08
commit b12ef0aa44
2 changed files with 14 additions and 3 deletions

View file

@ -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;
}

View file

@ -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 },