void flt_dump_kws(char **out);
void list_filters(FILE *out);
+int flt_has_filter(const struct proxy *px);
+
/* Returns != 0 if the proxy <px> is in legacy filter mode, so when an explicit
* legacy "filter" directive was used (PR_FL_FILTER_LEGACY). In legacy mode, the
* filter configurations are in px->filter_configs; otherwise they come from the
free(filters);
}
+/* Returns 1 if the proxy <px> has at least one active filter, legacy or
+ * not. Must be called after the class references are flattened.
+ */
+int flt_has_filter(const struct proxy *px)
+{
+ return (!LIST_ISEMPTY(&px->filter_configs) || !LIST_ISEMPTY(&px->filter_instances));
+}
+
/* Checks for explicit filter instances or enable/sequence directives during
* configuration parsing, before the class references are flattened. Inherited
* directives count too, but implicit instances do not select a config mode.
px->fe_req_ana |= AN_REQ_SWITCHING_RULES;
/* Add filters analyzers if needed */
- if (!LIST_ISEMPTY(&px->filter_configs)) {
+ if (flt_has_filter(px)) {
px->fe_req_ana |= AN_REQ_FLT_START_FE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END;
px->fe_rsp_ana |= AN_RES_FLT_START_FE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END;
}
px->be_req_ana |= AN_REQ_PRST_RDP_COOKIE;
/* Add filters analyzers if needed */
- if (!LIST_ISEMPTY(&px->filter_configs)) {
+ if (flt_has_filter(px)) {
px->be_req_ana |= AN_REQ_FLT_START_BE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END;
px->be_rsp_ana |= AN_RES_FLT_START_BE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END;
}