MEDIUM: listener: store the default target per listener
This will be useful later to state that some listeners have to use
certain decoders (typically an HTTP/2 decoder) regardless of the
regular processing applied to other listeners. For now it simply
defaults to the frontend's default target, and it is used by the
session.
diff --git a/include/types/listener.h b/include/types/listener.h
index ad2fcca..142e845 100644
--- a/include/types/listener.h
+++ b/include/types/listener.h
@@ -173,6 +173,7 @@
int (*accept)(struct listener *l, int fd, struct sockaddr_storage *addr); /* upper layer's accept() */
struct task * (*handler)(struct task *t); /* protocol handler. It is a task */
struct proxy *frontend; /* the frontend this listener belongs to, or NULL */
+ enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 5fe3ffb..b17527d 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1887,6 +1887,7 @@
l->accept = session_accept;
l->handler = process_session;
l->analysers |= ((struct proxy *)curpeers->peers_fe)->fe_req_ana;
+ l->default_target = ((struct proxy *)curpeers->peers_fe)->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock += l->maxconn;
}
@@ -7710,6 +7711,7 @@
listener->accept = session_accept;
listener->handler = process_session;
listener->analysers |= curproxy->fe_req_ana;
+ listener->default_target = curproxy->default_target;
if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
listener->options |= LI_O_TCP_RULES;
diff --git a/src/dumpstats.c b/src/dumpstats.c
index ba72d71..c23e988 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -339,6 +339,7 @@
l->backlog = global.stats_fe->backlog;
l->accept = session_accept;
l->handler = process_session;
+ l->default_target = global.stats_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
l->nice = -64; /* we want to boost priority for local stats */
global.maxsock += l->maxconn;
diff --git a/src/session.c b/src/session.c
index 7a00b0d..677d3a1 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,7 +481,7 @@
s->si[1].flags |= SI_FL_INDEP_STR;
session_init_srv_conn(s);
- s->target = p->default_target; /* used by peers and CLI */
+ s->target = l->default_target; /* used by peers and CLI */
s->pend_pos = NULL;
/* init store persistence */