MEDIUM: listener: move the analysers mask to the bind_conf
When bind_conf were created, some elements such as the analysers mask
ought to have moved there but that wasn't the case. Now that it's
getting clearer that bind_conf provides all binding parameters and
the listener is essentially a listener on an address, it's starting
to get really confusing to keep such parameters in the listener, so
let's move the mask to the bind_conf. We also take this opportunity
for pre-setting the mask to the frontend's upon initalization. Now
several loops have one less argument to take care of.
diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h
index c3bc45c..17f4683 100644
--- a/include/haproxy/listener-t.h
+++ b/include/haproxy/listener-t.h
@@ -197,6 +197,7 @@
const struct mux_proto_list *mux_proto; /* the mux to use for all incoming connections (specified by the "proto" keyword) */
struct xprt_ops *xprt; /* transport-layer operations for all listeners */
uint options; /* set of BC_O_* flags */
+ unsigned int analysers; /* bitmap of required protocol analysers */
int level; /* stats access level (ACCESS_LVL_*) */
int severity_output; /* default severity output format in cli feedback messages */
struct list listeners; /* list of listeners using this bind config */
@@ -246,7 +247,6 @@
/* cache line boundary */
struct mt_list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
unsigned int thr_idx; /* thread indexes for queue distribution : (t2<<16)+t1 */
- unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */
int tcp_ut; /* for TCP, user timeout */
char *name; /* listener's name */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 85cefb9..cc5c966 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -745,7 +745,6 @@
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
l->maxaccept = 1;
l->accept = session_accept_fd;
- l->analysers |= curpeers->peers_fe->fe_req_ana;
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
@@ -970,7 +969,6 @@
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
l->maxaccept = 1;
l->accept = session_accept_fd;
- l->analysers |= curpeers->peers_fe->fe_req_ana;
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
@@ -4285,6 +4283,7 @@
if (bind_conf->xprt->prepare_bind_conf &&
bind_conf->xprt->prepare_bind_conf(bind_conf) < 0)
cfgerr++;
+ bind_conf->analysers |= curproxy->fe_req_ana;
}
/* adjust this proxy's listeners */
@@ -4329,7 +4328,6 @@
}
#endif
- listener->analysers |= curproxy->fe_req_ana;
listener->default_target = curproxy->default_target;
if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
diff --git a/src/filters.c b/src/filters.c
index d91f4a7..0b98dcf 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -489,7 +489,7 @@
if (FLT_OPS(filter)->stream_start && FLT_OPS(filter)->stream_start(s, filter) < 0)
return -1;
}
- if (strm_li(s) && (strm_li(s)->analysers & AN_REQ_FLT_START_FE)) {
+ if (strm_li(s) && (strm_li(s)->bind_conf->analysers & AN_REQ_FLT_START_FE)) {
s->req.flags |= CF_FLT_ANALYZE;
s->req.analysers |= AN_REQ_FLT_END;
}
diff --git a/src/listener.c b/src/listener.c
index 4867566..717e878 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -1436,6 +1436,7 @@
bind_conf->settings.shards = 1;
bind_conf->xprt = xprt;
bind_conf->frontend = fe;
+ bind_conf->analysers = fe->fe_req_ana;
bind_conf->severity_output = CLI_SEVERITY_NONE;
#ifdef USE_OPENSSL
HA_RWLOCK_INIT(&bind_conf->sni_lock);
diff --git a/src/log.c b/src/log.c
index fc4cdd9..a3475ba 100644
--- a/src/log.c
+++ b/src/log.c
@@ -3825,7 +3825,6 @@
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
l->accept = session_accept_fd;
- l->analysers |= cfg_log_forward->fe_req_ana;
l->default_target = cfg_log_forward->default_target;
global.maxsock++;
}
diff --git a/src/proxy.c b/src/proxy.c
index 43a35f5..a021224 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -2425,7 +2425,7 @@
*/
req_ana &= ~(AN_REQ_WAIT_HTTP|AN_REQ_HTTP_PROCESS_FE);
}
- s->req.analysers |= req_ana & ~(strm_li(s) ? strm_li(s)->analysers : 0);
+ s->req.analysers |= req_ana & ~(strm_li(s) ? strm_li(s)->bind_conf->analysers : 0);
if (!IS_HTX_STRM(s) && be->mode == PR_MODE_HTTP) {
/* If we chain a TCP frontend to an HTX backend, we must upgrade
diff --git a/src/stream.c b/src/stream.c
index a4b428c..ce90151 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -502,7 +502,7 @@
channel_init(&s->req);
s->req.flags |= CF_READ_EVENT; /* the producer is already connected */
- s->req.analysers = sess->listener ? sess->listener->analysers : sess->fe->fe_req_ana;
+ s->req.analysers = sess->listener ? sess->listener->bind_conf->analysers : sess->fe->fe_req_ana;
if (IS_HTX_STRM(s)) {
/* Be sure to have HTTP analysers because in case of