MEDIUM: checks: Implement SPOP check using tcp-check rules
A share tcp-check ruleset is now created to support SPOP checks. This way no
extra memory is used if several backends use a SPOP check.
The following sequence is used :
tcp-check send-binary SPOP_REQ
tcp-check expect custom min-recv 4
The spop request is the result of the function
spoe_prepare_healthcheck_request() and the expect rule relies on a custom
function calling spoe_handle_healthcheck_response().
diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c
index 4286742..1111b74 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -2427,31 +2427,8 @@
goto out;
}
else if (!strcmp(args[1], "spop-check")) {
- if (curproxy == &defproxy) {
- ha_alert("parsing [%s:%d] : '%s %s' not allowed in 'defaults' section.\n",
- file, linenum, args[0], args[1]);
- err_code |= ERR_ALERT | ERR_FATAL;
- goto out;
- }
- if (curproxy->cap & PR_CAP_FE) {
- ha_alert("parsing [%s:%d] : '%s %s' not allowed in 'frontend' and 'listen' sections.\n",
- file, linenum, args[0], args[1]);
- err_code |= ERR_ALERT | ERR_FATAL;
- goto out;
- }
-
- /* use SPOE request to check servers' health */
- free(curproxy->check_req);
- curproxy->check_req = NULL;
- curproxy->options2 &= ~PR_O2_CHK_ANY;
- curproxy->options2 |= PR_O2_SPOP_CHK;
-
- if (spoe_prepare_healthcheck_request(&curproxy->check_req, &curproxy->check_len)) {
- ha_alert("parsing [%s:%d] : failed to prepare SPOP healthcheck request.\n", file, linenum);
- err_code |= ERR_ALERT | ERR_FATAL;
- goto out;
- }
- if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
+ err_code |= proxy_parse_spop_check_opt(args, 0, curproxy, &defproxy, file, linenum);
+ if (err_code & ERR_FATAL)
goto out;
}
else if (!strcmp(args[1], "tcp-check")) {