MINOR: filters: Extract proxy stuff from the struct filter
Now, filter's configuration (.id, .conf and .ops fields) is stored in the
structure 'flt_conf'. So proxies own a flt_conf list instead of a filter
list. When a filter is attached to a stream, it gets a pointer on its
configuration. This avoids mixing the filter's context (owns by a stream) and
its configuration (owns by a proxy). It also saves 2 pointers per filter
instance.
diff --git a/include/proto/filters.h b/include/proto/filters.h
index e4061a7..f9b0fb0 100644
--- a/include/proto/filters.h
+++ b/include/proto/filters.h
@@ -29,6 +29,10 @@
#include <proto/channel.h>
+#define FLT_ID(flt) (flt)->config->id
+#define FLT_CONF(flt) (flt)->config->conf
+#define FLT_OPS(flt) (flt)->config->ops
+
/* Useful macros to access per-channel values. It can be safely used inside
* filters. */
#define CHN_IDX(chn) (((chn)->flags & CF_ISRESP) == CF_ISRESP)
diff --git a/include/types/filters.h b/include/types/filters.h
index c433078..8446946 100644
--- a/include/types/filters.h
+++ b/include/types/filters.h
@@ -28,6 +28,7 @@
struct proxy;
struct stream;
struct channel;
+struct flt_conf;
struct filter;
/* Descriptor for a "filter" keyword. The ->parse() function returns 0 in case
@@ -40,7 +41,7 @@
struct flt_kw {
const char *kw;
int (*parse)(char **args, int *cur_arg, struct proxy *px,
- struct filter *filter, char **err);
+ struct flt_conf *fconf, char **err);
};
/*
@@ -123,9 +124,9 @@
/*
* Callbacks to manage the filter lifecycle
*/
- int (*init) (struct proxy *p, struct filter *f);
- void (*deinit)(struct proxy *p, struct filter *f);
- int (*check) (struct proxy *p, struct filter *f);
+ int (*init) (struct proxy *p, struct flt_conf *fconf);
+ void (*deinit)(struct proxy *p, struct flt_conf *fconf);
+ int (*check) (struct proxy *p, struct flt_conf *fconf);
/*
* Stream callbacks
@@ -171,9 +172,18 @@
#define STRM_FLT_FL_HAS_FILTERS 0x0001 /* The stream has at least one filter */
/*
- * Structure representing the state of a filter. When attached to a proxy, only
- * <ops> and <conf> field (and optionnaly <id>) are set. All other fields are
- * used when the filter is attached to a stream.
+ * Structure representing the filter configuration, attached to a proxy and
+ * accessible from a filter when instantiated in a stream
+ */
+struct flt_conf {
+ const char *id; /* The filter id */
+ struct flt_ops *ops; /* The filter callbacks */
+ void *conf; /* The filter configuration */
+ struct list list; /* Next filter for the same proxy */
+};
+
+/*
+ * Structure reprensenting a filter instance attached to a stream
*
* 2D-Array fields are used to store info per channel. The first index stands
* for the request channel, and the second one for the response channel.
@@ -182,9 +192,7 @@
* access these values using FLT_NXT and FLT_FWD macros.
*/
struct filter {
- const char *id; /* The filter id */
- struct flt_ops *ops; /* The filter callbacks */
- void *conf; /* The filter configuration */
+ struct flt_conf *config; /* the filter's configuration */
void *ctx; /* The filter context (opaque) */
unsigned short flags; /* FLT_FL_* */
unsigned int next[2]; /* Offset, relative to buf->p, to the next byte to parse for a specific channel
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 71fd35d..79a3411 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -432,8 +432,7 @@
* this backend. If not specified or void, then the backend
* name is used
*/
-
- struct list filters;
+ struct list filter_configs; /* list of the filters that are declared on this proxy */
};
struct switching_rule {
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 55622a4..68cee26 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -8435,7 +8435,7 @@
curproxy->fe_req_ana |= AN_REQ_SWITCHING_RULES;
/* Add filters analyzers if needed */
- if (!LIST_ISEMPTY(&curproxy->filters)) {
+ if (!LIST_ISEMPTY(&curproxy->filter_configs)) {
curproxy->fe_req_ana |= AN_FLT_ALL_FE;
curproxy->fe_rsp_ana |= AN_FLT_ALL_FE;
if (curproxy->mode == PR_MODE_HTTP) {
@@ -8465,7 +8465,7 @@
curproxy->be_req_ana |= AN_REQ_PRST_RDP_COOKIE;
/* Add filters analyzers if needed */
- if (!LIST_ISEMPTY(&curproxy->filters)) {
+ if (!LIST_ISEMPTY(&curproxy->filter_configs)) {
curproxy->be_req_ana |= AN_FLT_ALL_BE;
curproxy->be_rsp_ana |= AN_FLT_ALL_BE;
if (curproxy->mode == PR_MODE_HTTP) {
diff --git a/src/filters.c b/src/filters.c
index 1ab2b37..420ad80 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -158,7 +158,7 @@
parse_filter(char **args, int section_type, struct proxy *curpx,
struct proxy *defpx, const char *file, int line, char **err)
{
- struct filter *filter = NULL;
+ struct flt_conf *fconf = NULL;
/* Filter cannot be defined on a default proxy */
if (curpx == defpx) {
@@ -176,12 +176,11 @@
file, line, args[0], proxy_type_str(curpx), curpx->id);
goto error;
}
- filter = pool_alloc2(pool2_filter);
- if (!filter) {
+ fconf = calloc(1, sizeof(*fconf));
+ if (!fconf) {
memprintf(err, "'%s' : out of memory", args[0]);
goto error;
}
- memset(filter, 0, sizeof(*filter));
cur_arg = 1;
kw = flt_find_kw(args[cur_arg]);
@@ -192,7 +191,7 @@
file, line, args[0], args[cur_arg]);
goto error;
}
- if (kw->parse(args, &cur_arg, curpx, filter, err) != 0) {
+ if (kw->parse(args, &cur_arg, curpx, fconf, err) != 0) {
if (err && *err)
memprintf(err, "'%s' : '%s'",
args[0], *err);
@@ -216,13 +215,12 @@
goto error;
}
- LIST_ADDQ(&curpx->filters, &filter->list);
+ LIST_ADDQ(&curpx->filter_configs, &fconf->list);
}
return 0;
error:
- if (filter)
- pool_free2(pool2_filter, filter);
+ free(fconf);
return -1;
@@ -236,10 +234,10 @@
int
flt_init(struct proxy *proxy)
{
- struct filter *filter;
+ struct flt_conf *fconf;
- list_for_each_entry(filter, &proxy->filters, list) {
- if (filter->ops->init && filter->ops->init(proxy, filter) < 0)
+ list_for_each_entry(fconf, &proxy->filter_configs, list) {
+ if (fconf->ops->init && fconf->ops->init(proxy, fconf) < 0)
return ERR_ALERT|ERR_FATAL;
}
return 0;
@@ -253,12 +251,12 @@
int
flt_check(struct proxy *proxy)
{
- struct filter *filter;
- int err = 0;
+ struct flt_conf *fconf;
+ int err = 0;
- list_for_each_entry(filter, &proxy->filters, list) {
- if (filter->ops->check)
- err += filter->ops->check(proxy, filter);
+ list_for_each_entry(fconf, &proxy->filter_configs, list) {
+ if (fconf->ops->check)
+ err += fconf->ops->check(proxy, fconf);
}
err += check_legacy_http_comp_flt(proxy);
return err;
@@ -271,27 +269,25 @@
void
flt_deinit(struct proxy *proxy)
{
- struct filter *filter, *back;
+ struct flt_conf *fconf, *back;
- list_for_each_entry_safe(filter, back, &proxy->filters, list) {
- if (filter->ops->deinit)
- filter->ops->deinit(proxy, filter);
- LIST_DEL(&filter->list);
- pool_free2(pool2_filter, filter);
+ list_for_each_entry_safe(fconf, back, &proxy->filter_configs, list) {
+ if (fconf->ops->deinit)
+ fconf->ops->deinit(proxy, fconf);
+ LIST_DEL(&fconf->list);
+ free(fconf);
}
}
/* Attaches a filter to a stream. Returns -1 if an error occurs, 0 otherwise. */
static int
-flt_stream_add_filter(struct stream *s, struct filter *filter, unsigned int flags)
+flt_stream_add_filter(struct stream *s, struct flt_conf *fconf, unsigned int flags)
{
struct filter *f = pool_alloc2(pool2_filter);
if (!f) /* not enough memory */
return -1;
memset(f, 0, sizeof(*f));
- f->id = filter->id;
- f->ops = filter->ops;
- f->conf = filter->conf;
+ f->config = fconf;
f->flags |= flags;
LIST_ADDQ(&strm_flt(s)->filters, &f->list);
strm_flt(s)->flags |= STRM_FLT_FL_HAS_FILTERS;
@@ -305,12 +301,12 @@
int
flt_stream_init(struct stream *s)
{
- struct filter *filter;
+ struct flt_conf *fconf;
memset(strm_flt(s), 0, sizeof(*strm_flt(s)));
LIST_INIT(&strm_flt(s)->filters);
- list_for_each_entry(filter, &strm_fe(s)->filters, list) {
- if (flt_stream_add_filter(s, filter, 0) < 0)
+ list_for_each_entry(fconf, &strm_fe(s)->filter_configs, list) {
+ if (flt_stream_add_filter(s, fconf, 0) < 0)
return -1;
}
return 0;
@@ -348,7 +344,7 @@
struct filter *filter;
list_for_each_entry(filter, &strm_flt(s)->filters, list) {
- if (filter->ops->stream_start && filter->ops->stream_start(s, filter) < 0)
+ if (FLT_OPS(filter)->stream_start && FLT_OPS(filter)->stream_start(s, filter) < 0)
return -1;
}
return 0;
@@ -364,8 +360,8 @@
struct filter *filter;
list_for_each_entry(filter, &strm_flt(s)->filters, list) {
- if (filter->ops->stream_stop)
- filter->ops->stream_stop(s, filter);
+ if (FLT_OPS(filter)->stream_stop)
+ FLT_OPS(filter)->stream_stop(s, filter);
}
}
@@ -377,13 +373,13 @@
int
flt_set_stream_backend(struct stream *s, struct proxy *be)
{
- struct filter *filter;
+ struct flt_conf *fconf;
if (strm_fe(s) == be)
return 0;
- list_for_each_entry(filter, &be->filters, list) {
- if (flt_stream_add_filter(s, filter, FLT_FL_IS_BACKEND_FILTER) < 0)
+ list_for_each_entry(fconf, &be->filter_configs, list) {
+ if (flt_stream_add_filter(s, fconf, FLT_FL_IS_BACKEND_FILTER) < 0)
return -1;
}
return 0;
@@ -423,8 +419,8 @@
if (msg->next > *nxt)
*nxt = msg->next;
- if (filter->ops->http_data) {
- ret = filter->ops->http_data(s, filter, msg);
+ if (FLT_OPS(filter)->http_data) {
+ ret = FLT_OPS(filter)->http_data(s, filter, msg);
if (ret < 0)
break;
@@ -477,8 +473,8 @@
nxt = &FLT_NXT(filter, msg->chn);
*nxt = msg->next;
- if (filter->ops->http_chunk_trailers) {
- ret = filter->ops->http_chunk_trailers(s, filter, msg);
+ if (FLT_OPS(filter)->http_chunk_trailers) {
+ ret = FLT_OPS(filter)->http_chunk_trailers(s, filter, msg);
if (ret < 0)
break;
}
@@ -502,8 +498,8 @@
int ret = 1;
RESUME_FILTER_LOOP(s, msg->chn) {
- if (filter->ops->http_end) {
- ret = filter->ops->http_end(s, filter, msg);
+ if (FLT_OPS(filter)->http_end) {
+ ret = FLT_OPS(filter)->http_end(s, filter, msg);
if (ret <= 0)
BREAK_EXECUTION(s, msg->chn, end);
}
@@ -522,8 +518,8 @@
struct filter *filter;
list_for_each_entry(filter, &strm_flt(s)->filters, list) {
- if (filter->ops->http_reset)
- filter->ops->http_reset(s, filter, msg);
+ if (FLT_OPS(filter)->http_reset)
+ FLT_OPS(filter)->http_reset(s, filter, msg);
}
}
@@ -537,8 +533,8 @@
struct filter *filter;
list_for_each_entry(filter, &strm_flt(s)->filters, list) {
- if (filter->ops->http_reply)
- filter->ops->http_reply(s, filter, status, msg);
+ if (FLT_OPS(filter)->http_reply)
+ FLT_OPS(filter)->http_reply(s, filter, status, msg);
}
}
@@ -572,10 +568,10 @@
if (msg->next > *nxt)
*nxt = msg->next;
- if (filter->ops->http_forward_data) {
+ if (FLT_OPS(filter)->http_forward_data) {
/* Remove bytes that the current filter considered as
* forwarded */
- ret = filter->ops->http_forward_data(s, filter, msg, ret - *fwd);
+ ret = FLT_OPS(filter)->http_forward_data(s, filter, msg, ret - *fwd);
if (ret < 0)
goto end;
}
@@ -628,8 +624,8 @@
FLT_NXT(filter, chn) = 0;
FLT_FWD(filter, chn) = 0;
- if (filter->ops->channel_start_analyze) {
- ret = filter->ops->channel_start_analyze(s, filter, chn);
+ if (FLT_OPS(filter)->channel_start_analyze) {
+ ret = FLT_OPS(filter)->channel_start_analyze(s, filter, chn);
if (ret <= 0)
BREAK_EXECUTION(s, chn, end);
}
@@ -652,8 +648,8 @@
int ret = 1;
RESUME_FILTER_LOOP(s, chn) {
- if (filter->ops->channel_analyze) {
- ret = filter->ops->channel_analyze(s, filter, chn, an_bit);
+ if (FLT_OPS(filter)->channel_analyze) {
+ ret = FLT_OPS(filter)->channel_analyze(s, filter, chn, an_bit);
if (ret <= 0)
BREAK_EXECUTION(s, chn, check_result);
}
@@ -676,8 +672,8 @@
int ret = 1;
RESUME_FILTER_LOOP(s, chn) {
- if (filter->ops->channel_analyze) {
- ret = filter->ops->channel_analyze(s, filter, chn, an_bit);
+ if (FLT_OPS(filter)->channel_analyze) {
+ ret = FLT_OPS(filter)->channel_analyze(s, filter, chn, an_bit);
if (ret <= 0)
BREAK_EXECUTION(s, chn, check_result);
}
@@ -717,8 +713,8 @@
FLT_FWD(filter, chn) = 0;
unregister_data_filter(s, chn, filter);
- if (filter->ops->channel_end_analyze) {
- ret = filter->ops->channel_end_analyze(s, filter, chn);
+ if (FLT_OPS(filter)->channel_end_analyze) {
+ ret = FLT_OPS(filter)->channel_end_analyze(s, filter, chn);
if (ret <= 0)
BREAK_EXECUTION(s, chn, end);
}
@@ -778,8 +774,8 @@
continue;
nxt = &FLT_NXT(filter, chn);
- if (filter->ops->tcp_data) {
- ret = filter->ops->tcp_data(s, filter, chn);
+ if (FLT_OPS(filter)->tcp_data) {
+ ret = FLT_OPS(filter)->tcp_data(s, filter, chn);
if (ret < 0)
break;
@@ -830,10 +826,10 @@
continue;
fwd = &FLT_FWD(filter, chn);
- if (filter->ops->tcp_forward_data) {
+ if (FLT_OPS(filter)->tcp_forward_data) {
/* Remove bytes that the current filter considered as
* forwarded */
- ret = filter->ops->tcp_forward_data(s, filter, chn, ret - *fwd);
+ ret = FLT_OPS(filter)->tcp_forward_data(s, filter, chn, ret - *fwd);
if (ret < 0)
goto end;
}
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index d9a1338..46abe52 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -62,7 +62,7 @@
/***********************************************************************/
static int
-comp_flt_init(struct proxy *px, struct filter *filter)
+comp_flt_init(struct proxy *px, struct flt_conf *fconf)
{
if (!tmpbuf->size && b_alloc(&tmpbuf) == NULL)
@@ -73,7 +73,7 @@
}
static void
-comp_flt_deinit(struct proxy *px, struct filter *filter)
+comp_flt_deinit(struct proxy *px, struct flt_conf *fconf)
{
if (tmpbuf->size)
b_free(&tmpbuf);
@@ -830,20 +830,20 @@
static int
parse_http_comp_flt(char **args, int *cur_arg, struct proxy *px,
- struct filter *filter, char **err)
+ struct flt_conf *fconf, char **err)
{
- struct filter *flt, *back;
+ struct flt_conf *fc, *back;
- list_for_each_entry_safe(flt, back, &px->filters, list) {
- if (flt->id == http_comp_flt_id) {
+ list_for_each_entry_safe(fc, back, &px->filter_configs, list) {
+ if (fc->id == http_comp_flt_id) {
memprintf(err, "%s: Proxy supports only one compression filter\n", px->id);
return -1;
}
}
- filter->id = http_comp_flt_id;
- filter->conf = NULL;
- filter->ops = &comp_ops;
+ fconf->id = http_comp_flt_id;
+ fconf->conf = NULL;
+ fconf->ops = &comp_ops;
(*cur_arg)++;
return 0;
@@ -853,14 +853,14 @@
int
check_legacy_http_comp_flt(struct proxy *proxy)
{
- struct filter *filter;
+ struct flt_conf *fconf;
int err = 0;
if (proxy->comp == NULL)
goto end;
- if (!LIST_ISEMPTY(&proxy->filters)) {
- list_for_each_entry(filter, &proxy->filters, list) {
- if (filter->id == http_comp_flt_id)
+ if (!LIST_ISEMPTY(&proxy->filter_configs)) {
+ list_for_each_entry(fconf, &proxy->filter_configs, list) {
+ if (fconf->id == http_comp_flt_id)
goto end;
}
Alert("config: %s '%s': require an explicit filter declaration to use HTTP compression\n",
@@ -869,18 +869,17 @@
goto end;
}
- filter = pool_alloc2(pool2_filter);
- if (!filter) {
+ fconf = calloc(1, sizeof(*fconf));
+ if (!fconf) {
Alert("config: %s '%s': out of memory\n",
proxy_type_str(proxy), proxy->id);
err++;
goto end;
}
- memset(filter, 0, sizeof(*filter));
- filter->id = http_comp_flt_id;
- filter->conf = NULL;
- filter->ops = &comp_ops;
- LIST_ADDQ(&proxy->filters, &filter->list);
+ fconf->id = http_comp_flt_id;
+ fconf->conf = NULL;
+ fconf->ops = &comp_ops;
+ LIST_ADDQ(&proxy->filter_configs, &fconf->list);
end:
return err;
@@ -916,7 +915,7 @@
return 0;
list_for_each_entry(filter, &strm_flt(smp->strm)->filters, list) {
- if (filter->id != http_comp_flt_id)
+ if (FLT_ID(filter) != http_comp_flt_id)
continue;
if (!(st = filter->ctx))
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 94664eb..a45f4a0 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -70,15 +70,15 @@
**************************************************************************/
/* Initialize the filter. Returns -1 on error, else 0. */
static int
-trace_init(struct proxy *px, struct filter *filter)
+trace_init(struct proxy *px, struct flt_conf *fconf)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = fconf->conf;
if (conf->name)
memprintf(&conf->name, "%s/%s", conf->name, px->id);
else
memprintf(&conf->name, "TRACE/%s", px->id);
- filter->conf = conf;
+ fconf->conf = conf;
TRACE(conf, "filter initialized [read random=%s - fwd random=%s]",
(conf->rand_parsing ? "true" : "false"),
(conf->rand_forwarding ? "true" : "false"));
@@ -87,22 +87,22 @@
/* Free ressources allocated by the trace filter. */
static void
-trace_deinit(struct proxy *px, struct filter *filter)
+trace_deinit(struct proxy *px, struct flt_conf *fconf)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = fconf->conf;
if (conf) {
TRACE(conf, "filter deinitialized");
free(conf->name);
free(conf);
}
- filter->conf = NULL;
+ fconf->conf = NULL;
}
/* Check configuration of a trace filter for a specified proxy.
* Return 1 on error, else 0. */
static int
-trace_check(struct proxy *px, struct filter *filter)
+trace_check(struct proxy *px, struct flt_conf *fconf)
{
return 0;
}
@@ -114,7 +114,7 @@
static int
trace_stream_start(struct stream *s, struct filter *filter)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s",
__FUNCTION__);
@@ -125,7 +125,7 @@
static void
trace_stream_stop(struct stream *s, struct filter *filter)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s",
__FUNCTION__);
@@ -139,7 +139,7 @@
trace_chn_start_analyze(struct stream *s, struct filter *filter,
struct channel *chn)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
@@ -153,7 +153,7 @@
trace_chn_analyze(struct stream *s, struct filter *filter,
struct channel *chn, unsigned an_bit)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
char *ana;
switch (an_bit) {
@@ -236,7 +236,7 @@
trace_chn_end_analyze(struct stream *s, struct filter *filter,
struct channel *chn)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
@@ -251,7 +251,7 @@
trace_http_data(struct stream *s, struct filter *filter,
struct http_msg *msg)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
int avail = MIN(msg->chunk_len + msg->next, msg->chn->buf->i) - FLT_NXT(filter, msg->chn);
int ret = avail;
@@ -273,7 +273,7 @@
trace_http_chunk_trailers(struct stream *s, struct filter *filter,
struct http_msg *msg)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
@@ -285,7 +285,7 @@
trace_http_end(struct stream *s, struct filter *filter,
struct http_msg *msg)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
@@ -297,7 +297,7 @@
trace_http_reset(struct stream *s, struct filter *filter,
struct http_msg *msg)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
@@ -308,7 +308,7 @@
trace_http_reply(struct stream *s, struct filter *filter, short status,
const struct chunk *msg)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__, "-", proxy_mode(s), stream_pos(s));
@@ -318,7 +318,7 @@
trace_http_forward_data(struct stream *s, struct filter *filter,
struct http_msg *msg, unsigned int len)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
int ret = len;
if (ret && conf->rand_forwarding)
@@ -342,7 +342,7 @@
static int
trace_tcp_data(struct stream *s, struct filter *filter, struct channel *chn)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
int avail = chn->buf->i - FLT_NXT(filter, chn);
int ret = avail;
@@ -363,7 +363,7 @@
trace_tcp_forward_data(struct stream *s, struct filter *filter, struct channel *chn,
unsigned int len)
{
- struct trace_config *conf = filter->conf;
+ struct trace_config *conf = FLT_CONF(filter);
int ret = len;
if (ret && conf->rand_forwarding)
@@ -414,7 +414,7 @@
/* Return -1 on error, else 0 */
static int
parse_trace_flt(char **args, int *cur_arg, struct proxy *px,
- struct filter *filter, char **err)
+ struct flt_conf *fconf, char **err)
{
struct trace_config *conf;
int pos = *cur_arg;
@@ -452,10 +452,10 @@
pos++;
}
*cur_arg = pos;
- filter->ops = &trace_ops;
+ fconf->ops = &trace_ops;
}
- filter->conf = conf;
+ fconf->conf = conf;
return 0;
error:
diff --git a/src/proxy.c b/src/proxy.c
index 1c92e91..5fb5b93 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -748,7 +748,7 @@
LIST_INIT(&p->conf.listeners);
LIST_INIT(&p->conf.args.list);
LIST_INIT(&p->tcpcheck_rules);
- LIST_INIT(&p->filters);
+ LIST_INIT(&p->filter_configs);
/* Timeouts are defined as -1 */
proxy_reset_timeouts(p);