diff --git a/include/types/listener.h b/include/types/listener.h index ad2fcca1aa..142e845695 100644 --- a/include/types/listener.h +++ b/include/types/listener.h @@ -173,6 +173,7 @@ struct listener { 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 5fe3ffb1eb..b17527d68d 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1887,6 +1887,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) 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 @@ int check_config_validity() 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 ba72d713b1..c23e9888b0 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -339,6 +339,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx 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 7a00b0d5a9..677d3a1a64 100644 --- a/src/session.c +++ b/src/session.c @@ -481,7 +481,7 @@ int session_complete(struct session *s) 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 */