/* Flags set on a filter config */
#define FLT_CFG_FL_HTX 0x00000001 /* The filter can filter HTX streams */
-#define FLT_CFG_FL_LEGACY 0x00000002 /* Declared with the legacy "filter" directive */
/* Flags set on a filter instance */
#define FLT_FL_IS_BACKEND_FILTER 0x0001 /* The filter is a backend filter */
void flt_dump_kws(char **out);
void list_filters(FILE *out);
+/* 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
+ * filter instances (px->filter_instances and the flat per-side lists).
+ */
+static inline int flt_use_legacy_filter(const struct proxy *px)
+{
+ return px->flags & PR_FL_FILTER_LEGACY;
+}
+
/* Helper function that returns the "global" state of filters attached to a
* stream. */
static inline struct strm_flt *
#define PR_FL_BE_UNPUBLISHED 0x00000080 /* The proxy cannot be targeted by content switching rules */
#define PR_FL_DELETED 0x00000100 /* Proxy has been deleted and must be manipulated with care */
#define PR_FL_NON_PURGEABLE 0x00000200 /* Proxy referenced by config elements which prevent its runtime removal. */
+#define PR_FL_FILTER_LEGACY 0x00000400 /* An explicit legacy "filter" directive was used */
struct stream;
*/
static int flt_check_config_mode(struct proxy *px, int legacy, char **err)
{
- struct flt_conf *fconf;
-
if (legacy) {
if (flt_has_explicit_config(px))
goto error;
}
- else {
- list_for_each_entry(fconf, &px->filter_configs, list) {
- if (fconf->flags & FLT_CFG_FL_LEGACY)
- goto error;
- }
- }
+ else if (flt_use_legacy_filter(px))
+ goto error;
return 0;
error:
goto error;
}
- fconf->flags |= FLT_CFG_FL_LEGACY;
+ curpx->flags |= PR_FL_FILTER_LEGACY;
LIST_APPEND(&curpx->filter_configs, &fconf->list);
}
return 0;
fconf->id = fcgi_flt_id;
fconf->conf = fcgi_conf;
fconf->ops = &fcgi_flt_ops;
- fconf->flags |= FLT_CFG_FL_LEGACY;
LIST_APPEND(&hld_proxy.filter_configs, &fconf->list);
+
+ hld_proxy.flags |= PR_FL_FILTER_LEGACY;
}
ret = 1;