]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: filters: List the filter classes in haproxy -vv
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 09:09:39 +0000 (11:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 9 Oct 2026 14:17:36 +0000 (16:17 +0200)
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.

doc/internals/api/filters.txt
doc/regression-testing.txt
include/haproxy/filters.h
src/filters.c
src/haproxy.c

index 15cac51decaa388aa42ab3626426151e5b0c8868..4813aa014e1b3c094c5cdaca78f1f9ab158a8879 100644 (file)
@@ -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
index 4c2f825beb2e4f71d4ee012c18dca4f31ddaa255..92afdd3ec61310a652cbb2d458373092c404394a 100644 (file)
@@ -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
index 680d51722f4d959c7d00843bfc136fc9b502563f..057b3ec04f7c135501c59b7d4298095dac60f8f8 100644 (file)
@@ -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);
 
index 59f46049f0cf421c54f39c66815f146788e2fb38..6523568c6e2e740e706b761b1bd2541ba811d471 100644 (file)
@@ -395,18 +395,22 @@ flt_dump_kws(char **out)
 }
 
 /*
- * Lists the known filters on <out>
+ * Lists the known filter classes on <out>, 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, "<none>");
+       fprintf(out, "\n");
 }
 
 /* Returns 1 if the proxy <px> has at least one active filter, legacy or
index 537508729a48c442bba65d39770f803e27afbe45..a630688667425a71c096571fecfd6b02d1e12623 100644 (file)
@@ -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()) {