MINOR: proxy/checks: Move parsing of external-check option in checks.c

Parsing of the proxy directive "option external-check" have been moved in checks.c.
This commit is contained in:
Christopher Faulet 2020-04-09 15:58:50 +02:00
parent 51b129fd0f
commit 6f5579160a
3 changed files with 20 additions and 6 deletions

View 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); const char *file, int line);
int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx, int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
const char *file, int line); 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); int set_srv_agent_send(struct server *srv, const char *send);

View File

@ -2375,12 +2375,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
goto out; goto out;
} }
else if (!strcmp(args[1], "external-check")) { else if (!strcmp(args[1], "external-check")) {
/* excute an external command to check servers' health */ err_code |= proxy_parse_external_check_opt(args, 0, curproxy, &defproxy, file, linenum);
free(curproxy->check_req); if (err_code & ERR_FATAL)
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))
goto out; goto out;
} }
else if (!strcmp(args[1], "forwardfor")) { else if (!strcmp(args[1], "forwardfor")) {

View File

@ -6339,6 +6339,22 @@ int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struc
goto out; 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 */ /* Parse the "addr" server keyword */
static int srv_parse_addr(char **args, int *cur_arg, struct proxy *curpx, struct server *srv, static int srv_parse_addr(char **args, int *cur_arg, struct proxy *curpx, struct server *srv,
char **errmsg) char **errmsg)