mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
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.
This commit is contained in:
parent
0aa79953c9
commit
7866e8e50d
@ -197,6 +197,7 @@ struct bind_conf {
|
||||
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 @@ struct listener {
|
||||
/* 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 */
|
||||
|
@ -745,7 +745,6 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
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 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
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 @@ int check_config_validity()
|
||||
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 @@ int check_config_validity()
|
||||
}
|
||||
#endif
|
||||
|
||||
listener->analysers |= curproxy->fe_req_ana;
|
||||
listener->default_target = curproxy->default_target;
|
||||
|
||||
if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
|
||||
|
@ -489,7 +489,7 @@ flt_stream_start(struct stream *s)
|
||||
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;
|
||||
}
|
||||
|
@ -1436,6 +1436,7 @@ struct bind_conf *bind_conf_alloc(struct proxy *fe, const char *file,
|
||||
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);
|
||||
|
@ -3825,7 +3825,6 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm)
|
||||
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++;
|
||||
}
|
||||
|
@ -2425,7 +2425,7 @@ int stream_set_backend(struct stream *s, struct proxy *be)
|
||||
*/
|
||||
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
|
||||
|
@ -502,7 +502,7 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user