diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index 0ea2fd95b..993751c5c 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -311,6 +311,10 @@ struct proxy { char flags; /* bit field PR_FL_* */ enum pr_mode mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP, ... */ char cap; /* supported capabilities (PR_CAP_*) */ + /* 4-bytes hole */ + + struct list global_list; /* list member for global proxy list */ + unsigned int maxconn; /* max # of active streams on the frontend */ int options; /* PR_O_REDISP, PR_O_TRANSP, ... */ diff --git a/include/haproxy/proxy.h b/include/haproxy/proxy.h index c6c41260c..43e975860 100644 --- a/include/haproxy/proxy.h +++ b/include/haproxy/proxy.h @@ -33,6 +33,7 @@ #include extern struct proxy *proxies_list; +extern struct list proxies; extern struct eb_root used_proxy_id; /* list of proxy IDs in use */ extern unsigned int error_snapshot_id; /* global ID assigned to each error then incremented */ extern struct eb_root proxy_by_name; /* tree of proxies sorted by name */ diff --git a/src/proxy.c b/src/proxy.c index 56066bf8e..70f19bcbf 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -58,7 +58,8 @@ int listeners; /* # of proxy listeners, set by cfgparse */ -struct proxy *proxies_list = NULL; /* list of all existing proxies */ +struct proxy *proxies_list = NULL; /* list of main proxies */ +struct list proxies = LIST_HEAD_INIT(proxies); /* list of all proxies */ struct eb_root used_proxy_id = EB_ROOT; /* list of proxy IDs in use */ struct eb_root proxy_by_name = EB_ROOT; /* tree of proxies sorted by name */ struct eb_root defproxy_by_name = EB_ROOT; /* tree of default proxies sorted by name (dups possible) */ @@ -218,6 +219,7 @@ static inline void proxy_free_common(struct proxy *px) /* note that the node's key points to p->id */ ebpt_delete(&px->conf.by_name); ha_free(&px->id); + LIST_DEL_INIT(&px->global_list); drop_file_name(&px->conf.file); ha_free(&px->check_command); ha_free(&px->check_path); @@ -1468,6 +1470,7 @@ void init_new_proxy(struct proxy *p) { memset(p, 0, sizeof(struct proxy)); p->obj_type = OBJ_TYPE_PROXY; + LIST_INIT(&p->global_list); LIST_INIT(&p->acl); LIST_INIT(&p->http_req_rules); LIST_INIT(&p->http_res_rules); @@ -1725,6 +1728,9 @@ int setup_new_proxy(struct proxy *px, const char *name, unsigned int cap, char * if (name && !(cap & PR_CAP_INT)) proxy_store_name(px); + if (!(cap & PR_CAP_DEF)) + LIST_APPEND(&proxies, &px->global_list); + return 1; }