]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: filters: add filter name to flt_conf struct
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 31 Mar 2026 12:44:34 +0000 (14:44 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 3 Apr 2026 10:10:20 +0000 (12:10 +0200)
flt_conf struct stores the filter id, which is used internally to check
match the filter against static pointer identifier, and also used as
descriptive text to describe the filter. But the id is not consistent
with the public name as used in the configuration (for instance when
selecting filter through the 'filter' directive).

What we do in this patch is that we add flt_conf->name member, which
stores the real filter name as seen in the configuration. This will
allow to select filters by their name from other directives in the
configuration.

include/haproxy/filters-t.h
src/filters.c
src/flt_http_comp.c

index 19658d847a08cbe89f70f3f13dca872d3d1edfcc..f5a49856bd07d3592012d627d06fa75c885538d2 100644 (file)
@@ -207,6 +207,7 @@ struct flt_ops {
  * accessible from a filter when instantiated in a stream
  */
 struct flt_conf {
+       const char     *name; /* The filter name (same name used to select the filter from config) */
        const char     *id;   /* The filter id */
        struct flt_ops *ops;  /* The filter callbacks */
        void           *conf; /* The filter configuration */
index 20f965e0631a36ca555d7553db4febba45b4e765..61fcc8fe29977f9f2038ee0a1889b252acf404df 100644 (file)
@@ -249,6 +249,8 @@ parse_filter(char **args, int section_type, struct proxy *curpx,
                cur_arg = 1;
                kw = flt_find_kw(args[cur_arg]);
                if (kw) {
+                       /* default name is keyword name, unless overriden by parse func */
+                       fconf->name = kw->kw;
                        if (!kw->parse) {
                                memprintf(err, "parsing [%s:%d] : '%s' : "
                                          "'%s' option is not implemented in this version (check build options).",
index ea9adddc94c76d097c56db1d40be1136b8687c7d..6e15cb7e9181085209efe7b440f746f324ee27db 100644 (file)
@@ -1033,6 +1033,7 @@ parse_http_comp_flt(char **args, int *cur_arg, struct proxy *px,
        }
 
        fconf->id   = http_comp_req_flt_id;
+       fconf->name = "comp-req";
        fconf->conf = NULL;
        fconf->ops  = &comp_req_ops;
 
@@ -1048,6 +1049,7 @@ parse_http_comp_flt(char **args, int *cur_arg, struct proxy *px,
                return -1;
        }
        fconf_res->id = http_comp_res_flt_id;
+       fconf_res->name = "comp-res";
        fconf_res->conf = NULL;
        fconf_res->ops = &comp_res_ops;