]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy/checks: Move parsing of external-check option in checks.c
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 9 Apr 2020 13:58:50 +0000 (15:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Apr 2020 07:39:38 +0000 (09:39 +0200)
Parsing of the proxy directive "option external-check" have been moved in checks.c.

include/proto/checks.h
src/cfgparse-listen.c
src/checks.c

index 563e01f4c126eb138be8c8dee0e6f82c2d30cbf8..7fc84976022b2ddca8d411e6dbed6061987b4609 100644 (file)
@@ -87,6 +87,8 @@ int proxy_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, st
                               const char *file, int line);
 int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
                            const char *file, int line);
+int proxy_parse_external_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
+                                  const char *file, int line);
 
 int set_srv_agent_send(struct server *srv, const char *send);
 
index 7b33eb06f7445e64ab526b9d5dc9a6e406758d82..ddc7ba2d356c3ddef1b64e62a531ca82202705fa 100644 (file)
@@ -2375,12 +2375,8 @@ stats_error_parsing:
                                goto out;
                }
                else if (!strcmp(args[1], "external-check")) {
-                       /* excute an external command to check servers' health */
-                       free(curproxy->check_req);
-                       curproxy->check_req = NULL;
-                       curproxy->options2 &= ~PR_O2_CHK_ANY;
-                       curproxy->options2 |= PR_O2_EXT_CHK;
-                       if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
+                       err_code |= proxy_parse_external_check_opt(args, 0, curproxy, &defproxy, file, linenum);
+                       if (err_code & ERR_FATAL)
                                goto out;
                }
                else if (!strcmp(args[1], "forwardfor")) {
index ad72e08afeaf022b54c4647a4c442d8ea857fc9b..cfe10f8fa846ddc6ad10e372e1438124e3d1123d 100644 (file)
@@ -6339,6 +6339,22 @@ int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struc
        goto out;
 }
 
+int proxy_parse_external_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
+                                  const char *file, int line)
+{
+       int err_code = 0;
+
+       free(curpx->check_req);
+       curpx->check_req = NULL;
+       curpx->options2 &= ~PR_O2_CHK_ANY;
+       curpx->options2 |= PR_O2_EXT_CHK;
+       if (alertif_too_many_args_idx(0, 1, file, line, args, &err_code))
+               goto out;
+
+  out:
+       return err_code;
+}
+
 /* Parse the "addr" server keyword */
 static int srv_parse_addr(char **args, int *cur_arg, struct proxy *curpx, struct server *srv,
                          char **errmsg)