extern unsigned int dropped_logs;
/* lof forward proxy list */
-extern struct proxy *cfg_log_forward;
+extern struct list cfg_log_forward;
extern THREAD_LOCAL char *logline;
extern THREAD_LOCAL char *logline_rfc5424;
*/
static inline struct proxy *log_forward_by_name(const char *name)
{
- struct proxy *px = cfg_log_forward;
+ struct proxy *px;
- while (px) {
+ list_for_each_entry(px, &cfg_log_forward, el) {
if (strcmp(px->id, name) == 0)
return px;
- px = px->next;
}
return NULL;
}
unsigned long last_change; /* internal use only: last time the proxy state was changed */
struct list global_list; /* list member for global proxy list */
- struct list el; /* attach point in various list - currently used only on defaults_list for defaults section */
+ struct list el; /* attach point in various list
+ * - <cfg_log_forward> for log forwarder
+ * - <defaults_list> for defaults section
+ */
unsigned int maxconn; /* max # of active streams on the frontend */
struct proxy *next;
struct list *list = (struct list *)head;
- if (0) { /* TODO complete with newly converted list */
+ if (head == &cfg_log_forward) {
next = cur ?
LIST_ELEM(cur->el.n, struct proxy *, el) :
LIST_ELEM(list->n, struct proxy *, el);
* we must also configure the log-forward proxies list
*/
if (init_proxies_list == proxies_list) {
- init_proxies_list = cfg_log_forward;
- /* check if list is not null to avoid infinite loop */
- if (init_proxies_list)
- goto init_proxies_list_stage1;
+ init_proxies_list = &cfg_log_forward;
+ goto init_proxies_list_stage1;
}
- if (init_proxies_list == cfg_log_forward) {
+ if (init_proxies_list == &cfg_log_forward) {
init_proxies_list = sink_proxies_list;
/* check if list is not null to avoid infinite loop */
if (init_proxies_list)
* we must also configure the log-forward proxies list
*/
if (init_proxies_list == proxies_list) {
- init_proxies_list = cfg_log_forward;
- /* check if list is not null to avoid infinite loop */
- if (init_proxies_list)
- goto init_proxies_list_stage2;
+ init_proxies_list = &cfg_log_forward;
+ goto init_proxies_list_stage2;
}
- if (init_proxies_list == cfg_log_forward) {
+ if (init_proxies_list == &cfg_log_forward) {
init_proxies_list = sink_proxies_list;
/* check if list is not null to avoid infinite loop */
if (init_proxies_list)
if (!px) {
/* We may only have log-forward section */
- for (px = cfg_log_forward; px; px = px->next)
+ list_for_each_entry(px, &cfg_log_forward, el) {
if (!(px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && px->li_all)
break;
+ }
}
if (pr || px) {
int cum_log_messages;
/* log forward proxy list */
-struct proxy *cfg_log_forward;
+struct list cfg_log_forward = LIST_HEAD_INIT(cfg_log_forward);
struct log_fmt_st {
char *name;
{
struct proxy *p, *p0;
- p = cfg_log_forward;
/* we need to manually clean cfg_log_forward proxy list */
- while (p) {
- p0 = p;
- p = p->next;
- proxy_drop(p0);
+ list_for_each_entry_safe(p, p0, &cfg_log_forward, el) {
+ LIST_DEL_INIT(&p->el);
+ proxy_drop(p);
}
}
goto out;
}
- curproxy->next = cfg_log_forward;
- cfg_log_forward = curproxy;
+ LIST_INSERT(&cfg_log_forward, &curproxy->el);
curproxy->conf.file = copy_file_name(file);
curproxy->conf.line = linenum;
curproxy->mode = PR_MODE_SYSLOG;
* also, cfg_parse_listen_match_option() assumes global curproxy variable points to
* currently evaluated proxy
*/
- curproxy = cfg_log_forward;
+ curproxy = LIST_NEXT(&cfg_log_forward, struct proxy *, el);
if (cfg_parse_listen_match_option(file, linenum, kwm, cfg_opts3, &err_code, args,
PR_MODE_SYSLOG, PR_CAP_FE,
&curproxy->options3, &curproxy->no_options3))
for (px = proxies_list; px; px = px->next)
err_code |= postresolve_logger_list(px, &px->loggers, "proxy", px->id);
/* log-forward log directives */
- for (px = cfg_log_forward; px; px = px->next)
+ list_for_each_entry(px, &cfg_log_forward, el)
err_code |= postresolve_logger_list(NULL, &px->loggers, "log-forward", px->id);
return err_code;