]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: pass the file and line to config keyword parsers
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Sep 2012 18:02:48 +0000 (20:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 18 Sep 2012 18:02:48 +0000 (20:02 +0200)
This will be needed when we need to create bind config settings.

include/common/cfgparse.h
src/cfgparse.c
src/dumpstats.c
src/proto_tcp.c
src/proxy.c

index 118d098de4583330b6b76b425cf24bd94b02906e..e7ba8d14862029518aebac3d13ac8da5dce6e330 100644 (file)
@@ -43,6 +43,8 @@ struct cfg_keyword {
                     int section_type,          /* current section CFG_{GLOBAL|LISTEN} */
                     struct proxy *curpx,       /* current proxy (NULL in GLOBAL) */
                     struct proxy *defpx,       /* default proxy (NULL in GLOBAL) */
+                    const char *file,          /* config file name */
+                    int line,                  /* config file line number */
                     char **err);               /* error or warning message output pointer */
 };
 
index 6a12d4028f856515a6053e17fb13d553f4a7e12b..08c88d4fdcf5ec2ce64999f65e9410c57c692385 100644 (file)
@@ -1069,7 +1069,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                                        /* prepare error message just in case */
                                        snprintf(trash, trashlen,
                                                 "error near '%s' in '%s' section", args[0], "global");
-                                       rc = kwl->kw[index].parse(args, CFG_GLOBAL, NULL, NULL, &errmsg);
+                                       rc = kwl->kw[index].parse(args, CFG_GLOBAL, NULL, NULL, file, linenum, &errmsg);
                                        if (rc < 0) {
                                                Alert("parsing [%s:%d] : %s\n", file, linenum, errmsg);
                                                err_code |= ERR_ALERT | ERR_FATAL;
@@ -5184,7 +5184,7 @@ stats_error_parsing:
                                        /* prepare error message just in case */
                                        snprintf(trash, trashlen,
                                                 "error near '%s' in %s section", args[0], cursection);
-                                       rc = kwl->kw[index].parse(args, CFG_LISTEN, curproxy, &defproxy, &errmsg);
+                                       rc = kwl->kw[index].parse(args, CFG_LISTEN, curproxy, &defproxy, file, linenum, &errmsg);
                                        if (rc < 0) {
                                                Alert("parsing [%s:%d] : %s\n", file, linenum, errmsg);
                                                err_code |= ERR_ALERT | ERR_FATAL;
index e28f808111b614eb21add16e56ac1a6a6d9ccab5..8564e2d943a2b927fb1c9e30d2e2ca03d01dcbe0 100644 (file)
@@ -177,7 +177,8 @@ static struct proxy *alloc_stats_fe(const char *name)
  * the first word after "stats".
  */
 static int stats_parse_global(char **args, int section_type, struct proxy *curpx,
-                             struct proxy *defpx, char **err)
+                              struct proxy *defpx, const char *file, int line,
+                              char **err)
 {
        if (!strcmp(args[1], "socket")) {
                struct sockaddr_un *su;
index 6b1b15ed6ad34cb96cb2627ebcdce243747a1e74..79e4d0d60959201ffe4fa6ebb38fe3521d9cf653 100644 (file)
@@ -1167,7 +1167,8 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
  * keyword.
  */
 static int tcp_parse_tcp_rep(char **args, int section_type, struct proxy *curpx,
-                             struct proxy *defpx, char **err)
+                             struct proxy *defpx, const char *file, int line,
+                             char **err)
 {
        const char *ptr = NULL;
        unsigned int val;
@@ -1248,7 +1249,8 @@ static int tcp_parse_tcp_rep(char **args, int section_type, struct proxy *curpx,
  * keyword.
  */
 static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
-                             struct proxy *defpx, char **err)
+                             struct proxy *defpx, const char *file, int line,
+                             char **err)
 {
        const char *ptr = NULL;
        unsigned int val;
index 307af93eb06d6d6b11a5733137d9cfae7c2f5d10..35e58b03e082a809b57e4c184647a91da5298648 100644 (file)
@@ -133,7 +133,8 @@ int get_backend_server(const char *bk_name, const char *sv_name,
  * "{cli|srv|con}timeout" in args[0].
  */
 static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
-                               struct proxy *defpx, char **err)
+                               struct proxy *defpx, const char *file, int line,
+                               char **err)
 {
        unsigned timeout;
        int retval, cap;
@@ -229,7 +230,8 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
  * parsed, and <defpx> to the default proxy or NULL.
  */
 static int proxy_parse_rate_limit(char **args, int section, struct proxy *proxy,
-                                  struct proxy *defpx, char **err)
+                                  struct proxy *defpx, const char *file, int line,
+                                  char **err)
 {
        int retval, cap;
        char *res;