/* Dumps all registered "bind" keywords to the <out> string pointer. */
void bind_dump_kws(char **out);
-/* allocate an bind_conf struct for a bind line, and chain it to list head <lh>.
+/* allocate an bind_conf struct for a bind line, and chain it to the frontend <fe>.
* If <arg> is not NULL, it is duplicated into ->arg to store useful config
* information for error reporting.
*/
-static inline struct bind_conf *bind_conf_alloc(struct list *lh, const char *file,
+static inline struct bind_conf *bind_conf_alloc(struct proxy *fe, const char *file,
int line, const char *arg, struct xprt_ops *xprt)
{
struct bind_conf *bind_conf = (void *)calloc(1, sizeof(struct bind_conf));
bind_conf->file = strdup(file);
bind_conf->line = line;
- if (lh)
- LIST_ADDQ(lh, &bind_conf->by_fe);
+ LIST_ADDQ(&fe->conf.bind, &bind_conf->by_fe);
if (arg)
bind_conf->arg = strdup(arg);
bind_conf->ux.gid = -1;
bind_conf->ux.mode = 0;
bind_conf->xprt = xprt;
+ bind_conf->frontend = fe;
LIST_INIT(&bind_conf->listeners);
return bind_conf;
X509 *ca_sign_cert; /* CA certificate referenced by ca_file */
EVP_PKEY *ca_sign_pkey; /* CA private key referenced by ca_key */
#endif
+ struct proxy *frontend; /* the frontend all these listeners belong to, or NULL */
struct xprt_ops *xprt; /* transport-layer operations for all listeners */
int is_ssl; /* SSL is required for these listeners */
int generate_certs; /* 1 if generate-certificates option is set, else 0 */
struct list proto_list; /* list in the protocol header */
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 */
l->obj_type = OBJ_TYPE_LISTENER;
LIST_ADDQ(&curproxy->conf.listeners, &l->by_fe);
LIST_ADDQ(&bind_conf->listeners, &l->by_bind);
- l->frontend = curproxy;
l->bind_conf = bind_conf;
l->fd = fd;
curpeers->peers_fe->conf.args.line = curpeers->peers_fe->conf.line = linenum;
peers_setup_frontend(curpeers->peers_fe);
- bind_conf = bind_conf_alloc(&curpeers->peers_fe->conf.bind, file, linenum, args[2], &raw_sock);
+ bind_conf = bind_conf_alloc(curpeers->peers_fe, file, linenum, args[2], &raw_sock);
if (!str2listener(args[2], curpeers->peers_fe, bind_conf, file, linenum, &errmsg)) {
if (errmsg && *errmsg) {
goto out;
}
- bind_conf = bind_conf_alloc(&curproxy->conf.bind, file, linenum, args[1], &raw_sock);
+ bind_conf = bind_conf_alloc(curproxy, file, linenum, args[1], &raw_sock);
/* use default settings for unix sockets */
bind_conf->ux.uid = global.unix_bind.ux.uid;
}
}
- bind_conf = bind_conf_alloc(&global.stats_fe->conf.bind, file, line, args[2], &raw_sock);
+ bind_conf = bind_conf_alloc(global.stats_fe, file, line, args[2], &raw_sock);
bind_conf->level = ACCESS_LVL_OPER; /* default access level */
if (!str2listener(args[2], global.stats_fe, bind_conf, file, line, err)) {
li = hlua_check_listener(L, 1);
- if (!li->frontend) {
+ if (!li->bind_conf->frontend) {
lua_pushnil(L);
return 1;
}
- stats_fill_li_stats(li->frontend, li, ST_SHLGNDS, stats, STATS_LEN);
+ stats_fill_li_stats(li->bind_conf->frontend, li, ST_SHLGNDS, stats, STATS_LEN);
lua_newtable(L);
for (i=0; i<ST_F_TOTAL_FIELDS; i++) {
void listener_accept(int fd)
{
struct listener *l = fdtab[fd].owner;
- struct proxy *p = l->frontend;
+ struct proxy *p = l->bind_conf->frontend;
int max_accept = l->maxaccept ? l->maxaccept : 1;
int expire;
int cfd;
static struct appctx *peer_session_create(struct peers *peers, struct peer *peer)
{
struct listener *l = LIST_NEXT(&peers->peers_fe->conf.listeners, struct listener *, by_fe);
- struct proxy *p = l->frontend; /* attached frontend */
+ struct proxy *p = l->bind_conf->frontend; /* attached frontend */
struct appctx *appctx;
struct session *sess;
struct stream *s;
int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr)
{
struct connection *cli_conn;
- struct proxy *p = l->frontend;
+ struct proxy *p = l->bind_conf->frontend;
struct session *sess;
struct stream *strm;
struct task *t;