]> git.kaiwu.me - haproxy.git/commit
MINOR: cfgparse: always suggest the section names on an unknown keyword
authorWilly Tarreau <w@1wt.eu>
Thu, 8 Oct 2026 17:31:42 +0000 (19:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2026 08:30:59 +0000 (10:30 +0200)
commitfce387c5f0879fe140cc19a7349f901c3ce3b851
tree483734488c73c8ad465306cb6cc5baf11a55f3e6
parent347fb7cf78dacea52e9c7b747fffd9f5cb881680
MINOR: cfgparse: always suggest the section names on an unknown keyword

When an unknown keyword is met in a section, cfg_find_best_match() looks
for the closest match among the keywords registered for that section,
plus an optional list of extra words passed by the caller, which
cfg_parse_global() and cfg_parse_listen() were using to pass a list of
a few known hard-coded section names. But this resulted several times
in some names not being matched (e.g. "resolvers" which was later added
but only for "global"), or others still not being known, e.g.

  $ printf 'global\n\tcrt-stor\n' | ./haproxy -c -f /dev/stdin
  [ALERT] : parsing [/dev/stdin:2] : unknown keyword 'crt-stor' in
    'global' section; did you mean 'crt-store' maybe ?

Let's have the function always consider all known section names since
they are always permitted, that is much more effective and will no
longer require to hard-code certain combinations. This completely drops
the extra argument that's no longer used.
include/haproxy/cfgparse.h
src/acme.c
src/cfgparse-global.c
src/cfgparse-listen.c
src/cfgparse.c
src/ssl_ckch.c
src/trace.c