mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
[BUG] check if rise/fall has an argument and it is > 0
Check if rise/fall has an argument and it is > 0 or bad things may happen in the health checks. ;) Now it is verified and the code no longer allows for such condition: backend bad (...) server o-f0 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise 0 server o-r0 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall 0 server o-f1 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise server o-r1 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall [ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:98]: 'rise' has to be > 0. [ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:99]: 'fall' has to be > 0. [ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:100]: 'rise' expects an integer argument. [ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:101]: 'fall' expects an integer argument. Also add endline in the custom id checking code.
This commit is contained in:
parent
213014e587
commit
08ff959c3e
@ -1162,7 +1162,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
curproxy->uuid = atol(args[1]);
|
curproxy->uuid = atol(args[1]);
|
||||||
|
|
||||||
if (curproxy->uuid < 1001) {
|
if (curproxy->uuid < 1001) {
|
||||||
Alert("parsing [%s:%d]: custom id has to be > 1000",
|
Alert("parsing [%s:%d]: custom id has to be > 1000.\n",
|
||||||
file, linenum);
|
file, linenum);
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -2339,7 +2339,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
newsrv->puid = atol(args[cur_arg + 1]);
|
newsrv->puid = atol(args[cur_arg + 1]);
|
||||||
|
|
||||||
if (newsrv->puid< 1001) {
|
if (newsrv->puid< 1001) {
|
||||||
Alert("parsing [%s:%d]: custom id has to be > 1000",
|
Alert("parsing [%s:%d]: custom id has to be > 1000.\n",
|
||||||
file, linenum);
|
file, linenum);
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -2365,12 +2365,41 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
cur_arg += 2;
|
cur_arg += 2;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[cur_arg], "rise")) {
|
else if (!strcmp(args[cur_arg], "rise")) {
|
||||||
|
if (!*args[cur_arg + 1]) {
|
||||||
|
Alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
|
||||||
|
file, linenum, args[cur_arg]);
|
||||||
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
newsrv->rise = atol(args[cur_arg + 1]);
|
newsrv->rise = atol(args[cur_arg + 1]);
|
||||||
|
if (newsrv->rise <= 0) {
|
||||||
|
Alert("parsing [%s:%d]: '%s' has to be > 0.\n",
|
||||||
|
file, linenum, args[cur_arg]);
|
||||||
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
newsrv->health = newsrv->rise;
|
newsrv->health = newsrv->rise;
|
||||||
cur_arg += 2;
|
cur_arg += 2;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[cur_arg], "fall")) {
|
else if (!strcmp(args[cur_arg], "fall")) {
|
||||||
newsrv->fall = atol(args[cur_arg + 1]);
|
newsrv->fall = atol(args[cur_arg + 1]);
|
||||||
|
|
||||||
|
if (!*args[cur_arg + 1]) {
|
||||||
|
Alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
|
||||||
|
file, linenum, args[cur_arg]);
|
||||||
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newsrv->fall <= 0) {
|
||||||
|
Alert("parsing [%s:%d]: '%s' has to be > 0.\n",
|
||||||
|
file, linenum, args[cur_arg]);
|
||||||
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
cur_arg += 2;
|
cur_arg += 2;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[cur_arg], "inter")) {
|
else if (!strcmp(args[cur_arg], "inter")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user