MINOR: filters: add filter name to flt_conf struct

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.
This commit is contained in:
Aurelien DARRAGON 2026-03-31 14:44:34 +02:00
parent 882176a602
commit 629a5ae531
3 changed files with 5 additions and 0 deletions

View 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 */

View 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).",

View 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;