]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] config: reference file and line with any listener/proxy/server declaration
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Oct 2009 18:54:54 +0000 (20:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 4 Oct 2009 19:14:56 +0000 (21:14 +0200)
Those will be used later for cross-references of conflicts or errors.

include/types/protocols.h
include/types/proxy.h
include/types/server.h
src/cfgparse.c

index c89deb3d3151ca2343805943bd3f9aa09027f96e..62d9f60e86753da580d14375b6f5f8eda8db1ec6 100644 (file)
@@ -104,6 +104,11 @@ struct listener {
        } perm;
        char *interface;                /* interface name or NULL */
        int maxseg;                     /* for TCP, advertised MSS */
+
+       struct {
+               const char *file;       /* file where the section appears */
+               int line;               /* line where the section appears */
+       } conf;                         /* config information */
 };
 
 /* This structure contains all information needed to easily handle a protocol.
index 1c73d24e2b69a4e8671aa5945ef285ed8d25d2ba..88a01cc34cfae853c6995d37d276389e4d268071 100644 (file)
@@ -258,6 +258,11 @@ struct proxy {
        int no_options2;                        /* PR_O2_* */
 
        struct pxcounters counters;             /* statistics counters */
+
+       struct {
+               const char *file;               /* file where the section appears */
+               int line;                       /* line where the section appears */
+       } conf;                                 /* config information */
 };
 
 struct switching_rule {
index ddf5a468221ebab542ecbe8c1aa73204bee0a345..45528fa99bd8ec50b965e3071b25f291f08c0177 100644 (file)
@@ -131,6 +131,11 @@ struct server {
        int puid;                               /* proxy-unique server ID, used for SNMP */
 
        struct srvcounters counters;            /* statistics counters */
+
+       struct {
+               const char *file;               /* file where the section appears */
+               int line;                       /* line where the section appears */
+       } conf;                                 /* config information */
 };
 
 
index b35a15ea6c0e4b0ee8608e5cf74fb69b89e13467..38dd8eb1ca6cf49f8ee96e55763d733be977b836 100644 (file)
@@ -876,6 +876,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 
                curproxy->next = proxy;
                proxy = curproxy;
+               curproxy->conf.file = file;
+               curproxy->conf.line = linenum;
                LIST_INIT(&curproxy->pendconns);
                LIST_INIT(&curproxy->acl);
                LIST_INIT(&curproxy->block_cond);
@@ -895,10 +897,17 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 
                /* parse the listener address if any */
                if ((curproxy->cap & PR_CAP_FE) && *args[2]) {
+                       struct listener *new, *last = curproxy->listen;
                        if (!str2listener(args[2], curproxy)) {
                                err_code |= ERR_FATAL;
                                goto out;
                        }
+                       new = curproxy->listen;
+                       while (new != last) {
+                               new->conf.file = file;
+                               new->conf.line = linenum;
+                               new = new->next;
+                       }
                        global.maxsock++;
                }
 
@@ -1044,7 +1053,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 
        /* Now let's parse the proxy-specific keywords */
        if (!strcmp(args[0], "bind")) {  /* new listen addresses */
-               struct listener *last_listen;
+               struct listener *new_listen, *last_listen;
                int cur_arg;
 
                if (curproxy == &defproxy) {
@@ -1068,6 +1077,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        goto out;
                }
 
+               new_listen = curproxy->listen;
+               while (new_listen != last_listen) {
+                       new_listen->conf.file = file;
+                       new_listen->conf.line = linenum;
+                       new_listen = new_listen->next;
+               }
+
                cur_arg = 2;
                while (*(args[cur_arg])) {
                        if (!strcmp(args[cur_arg], "interface")) { /* specifically bind to this interface */
@@ -2453,6 +2469,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                curproxy->srv = newsrv;
                newsrv->proxy = curproxy;
                newsrv->puid = curproxy->next_svid++;
+               newsrv->conf.file = file;
+               newsrv->conf.line = linenum;
 
                LIST_INIT(&newsrv->pendconns);
                do_check = 0;