1 commit 3bd00f356783d331deba80de76c989d416e4a52e
2 Author: Willy Tarreau <w@1wt.eu>
3 Date: Thu Apr 11 14:47:08 2019 +0200
5 BUG/MEDIUM: pattern: assign pattern IDs after checking the config validity
7 Pavlos Parissis reported an interesting case where some map identifiers
8 were not assigned (appearing as -1 in show map). It turns out that it
9 only happens for log-format expressions parsed in check_config_validity()
10 that involve maps (log-format, use_backend, unique-id-header), as in the
11 sample configuration below :
15 unique-id-format %[src,map(addr.lst)]
16 log-format %[src,map(addr.lst)]
17 use_backend %[src,map(addr.lst)]
19 The reason stems from the initial introduction of unique IDs in 1.5 via
20 commit af5a29d5f ("MINOR: pattern: Each pattern is identified by unique
21 id.") : the unique_id assignment was done before calling
22 check_config_validity() so all maps loaded after this call are not
23 properly configured. From what the function does, it seems they will not
24 be able to use a cache, will not have a unique_id assigned and will not
25 be updatable from the CLI.
27 This fix must be backported to all supported versions.
29 (cherry picked from commit 0f93672dfea805268d674c97573711fbff7e0e70)
30 Signed-off-by: William Lallemand <wlallemand@haproxy.org>
31 (cherry picked from commit ba475a5b390f58450756da67dbf54bf063f2dbef)
32 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
34 diff --git a/src/haproxy.c b/src/haproxy.c
35 index 5c3febdd..105cde6f 100644
38 @@ -1570,14 +1570,14 @@ static void init(int argc, char **argv)
42 - pattern_finalize_config();
44 err_code |= check_config_validity();
45 if (err_code & (ERR_ABORT|ERR_FATAL)) {
46 ha_alert("Fatal errors found in configuration.\n");
50 + pattern_finalize_config();
52 /* recompute the amount of per-process memory depending on nbproc and
53 * the shared SSL cache size (allowed to exist in all processes).