]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: filters: Declare a proxy as using the legacy API before parsing filter directive
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 Oct 2026 10:14:17 +0000 (11:14 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 Oct 2026 12:30:22 +0000 (13:30 +0100)
The "filter" directive declares a legacy filter configuration on the
proxy being parsed, which selects the legacy filter mode: the
PR_FL_FILTER_LEGACY flag is set on the proxy. Until now the flag was set
at the end of the parsing, after the filter keyword was resolved and its
configuration produced.

The filter keyword parsers may call flt_find_conf() to resolve a
previously declared configuration, or may add an implicit instance with
flt_add_implicit_instance(). Both rely on the filter mode of the proxy
to walk the right configuration list: without the flag they would
inspect the filter instances instead of the legacy filter
configurations. The keyword parser of a filter is called while the
directive is being parsed, so the mode must be known before, not after.

The flag is now set as soon as the "filter" directive is identified, so
the keyword parsers always see the mode their own directive selects.

src/filters.c

index 36f6c14154de1b60a63a8187fff1e4397c7ea9e0..c9e453719dd32b2c490679768d11b1b0e4bc544a 100644 (file)
@@ -517,6 +517,7 @@ parse_filter(char **args, int section_type, struct proxy *curpx,
                struct flt_kw *kw;
                int cur_arg;
 
+               curpx->flags |= PR_FL_FILTER_LEGACY;
                if (!*args[1]) {
                        memprintf(err,
                                  "parsing [%s:%d] : missing argument for '%s' in %s '%s'.",
@@ -567,7 +568,6 @@ parse_filter(char **args, int section_type, struct proxy *curpx,
                        goto error;
                }
 
-               curpx->flags |= PR_FL_FILTER_LEGACY;
                fconf->flags |= FLT_CFG_FL_EXPLICIT;
                flt_conf_add(curpx, fconf);
        }