From: Christopher Faulet Date: Wed, 7 Oct 2026 09:09:39 +0000 (+0200) Subject: MINOR: filters: List the filter classes in haproxy -vv X-Git-Tag: v3.5-dev9~50 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=bc870c22f672955161e81843a2e250460ff7f2ce;p=haproxy.git MINOR: filters: List the filter classes in haproxy -vv The "Available filters" section dumped the keywords registered for the legacy "filter" directive, one per line with the scope of the keyword list they come from. New filters will support the new declaration mode only and will not register such keywords, so the list would be incomplete. And the printed names are the legacy keyword names, which are not the filter class names usable with "filter-config" anyway. Dump the registered filter classes instead, as a comma-separated list, in their global order, so both declaration modes are covered. Rename list_filters() to list_filter_classes() and change the header of the dump accordingly. The legacy keyword list remains reported by flt_dump_kws(), where a keyword list is what is expected: the "filter" keyword parsing errors and the "haproxy -dM flt" diagnostics. Update the "haproxy -vv" example in the internal API documentation and the sample debug outputs in the regression testing documentation. --- diff --git a/doc/internals/api/filters.txt b/doc/internals/api/filters.txt index 15cac51de..4813aa014 100644 --- a/doc/internals/api/filters.txt +++ b/doc/internals/api/filters.txt @@ -144,7 +144,7 @@ Note that additional parameters on the filter line must be parsed by the filter itself. The "filter" directive is only supported by filters registering a keyword with flt_register_keywords() (see section 3.2.2). -The list of available filter keywords is reported by 'haproxy -vv' : +The list of available filter classes is reported by 'haproxy -vv' : $> haproxy -vv HAProxy version 1.7-dev2-3a1d4a-33 2016/03/21 @@ -152,9 +152,9 @@ The list of available filter keywords is reported by 'haproxy -vv' : [...] - Available filters : - [COMP] compression - [TRACE] trace + Available filter classes : + trace, cache-store, decomp-req, decomp-res, spoe, lua, + http-comp-req, http-comp-res, bwlim-in, bwlim-out, fcgi Multiple filter lines can be used in a proxy section to chain filters. Filters diff --git a/doc/regression-testing.txt b/doc/regression-testing.txt index 4c2f825be..92afdd3ec 100644 --- a/doc/regression-testing.txt +++ b/doc/regression-testing.txt @@ -521,10 +521,10 @@ Here is the output produced by varnishtest with the latter VTC file: *** h1 0.0 debug|pref=150, test result FAILED *** h1 0.0 debug|Total: 3 (2 usable), will use epoll. *** h1 0.0 debug| - *** h1 0.0 debug|Available filters : - *** h1 0.0 debug|\t[SPOE] spoe - *** h1 0.0 debug|\t[COMP] compression - *** h1 0.0 debug|\t[TRACE] trace + *** h1 0.0 debug|Available filter classes : + *** h1 0.0 debug|\ttrace, cache-store, decomp-req, decomp-res, spoe, + *** h1 0.0 debug|\tlua, http-comp-req, http-comp-res, bwlim-in, + *** h1 0.0 debug|\tbwlim-out, fcgi **** Slg_1 0.0 syslog|<133>Jun 7 14:12:51 haproxy[15787]: Proxy fe1 started. ** Slg_1 0.0 === recv **** Slg_1 0.0 syslog|<133>Jun 7 14:12:51 haproxy[15787]: Proxy be_app started. @@ -651,10 +651,10 @@ of the "syslog" "expect" command: *** h1 0.0 debug| select : pref=150, test result FAILED *** h1 0.0 debug|Total: 3 (2 usable), will use epoll. *** h1 0.0 debug| - *** h1 0.0 debug|Available filters : - *** h1 0.0 debug|\t[SPOE] spoe - *** h1 0.0 debug|\t[COMP] compression - *** h1 0.0 debug|\t[TRACE] trace + *** h1 0.0 debug|Available filter classes : + *** h1 0.0 debug|\ttrace, cache-store, decomp-req, decomp-res, spoe, + *** h1 0.0 debug|\tlua, http-comp-req, http-comp-res, bwlim-in, + *** h1 0.0 debug|\tbwlim-out, fcgi *** h1 0.0 debug|Using epoll() as the polling mechanism. **** Slg_1 0.0 syslog|<133>Jun 7 14:10:18 haproxy[12728]: Proxy fe1 started. ** Slg_1 0.0 === recv diff --git a/include/haproxy/filters.h b/include/haproxy/filters.h index 680d51722..057b3ec04 100644 --- a/include/haproxy/filters.h +++ b/include/haproxy/filters.h @@ -187,7 +187,7 @@ int flt_xfer_data(struct stream *s, struct channel *chn, unsigned int an_bit); void flt_register_keywords(struct flt_kw_list *kwl); struct flt_kw *flt_find_kw(const char *kw); void flt_dump_kws(char **out); -void list_filters(FILE *out); +void list_filter_classes(FILE *out); int flt_has_filter(const struct proxy *px); diff --git a/src/filters.c b/src/filters.c index 59f46049f..6523568c6 100644 --- a/src/filters.c +++ b/src/filters.c @@ -395,18 +395,22 @@ flt_dump_kws(char **out) } /* - * Lists the known filters on + * Lists the known filter classes on , in their global order */ void -list_filters(FILE *out) +list_filter_classes(FILE *out) { - char *filters, *p, *f; + struct filter_class *cls; + int first = 1; - fprintf(out, "Available filters :\n"); - flt_dump_kws(&filters); - for (p = filters; (f = strtok_r(p,"\n",&p));) - fprintf(out, "\t%s\n", f); - free(filters); + fprintf(out, "Available filter classes :\n\t"); + list_for_each_entry(cls, &filter_classes, list) { + fprintf(out, "%s%s", first ? "" : ", ", cls->name); + first = 0; + } + if (first) + fprintf(out, ""); + fprintf(out, "\n"); } /* Returns 1 if the proxy has at least one active filter, legacy or diff --git a/src/haproxy.c b/src/haproxy.c index 537508729..a63068866 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -728,7 +728,7 @@ static void display_build_opts() putchar('\n'); list_services(stdout); putchar('\n'); - list_filters(stdout); + list_filter_classes(stdout); putchar('\n'); ha_free(&feat_list); } @@ -2536,7 +2536,7 @@ static void step_init_2(int argc, char** argv) if ((global.mode & (MODE_VERBOSE|MODE_DEBUG)) && !master) { list_pollers(stderr); fprintf(stderr, "\n"); - list_filters(stderr); + list_filter_classes(stderr); } if (!init_pollers()) {