MINOR: Produce tcp-check info message for pure tcp-check rules only

This way, messages reported by protocol checks are closer that the old one.
This commit is contained in:
Christopher Faulet 2020-04-07 12:06:14 +02:00
parent 617780f99b
commit 799f3a4621
2 changed files with 8 additions and 2 deletions

View File

@ -318,6 +318,8 @@ struct tcpcheck_rule {
#define TCPCHK_RULES_SSL3_CHK 0x00000070
#define TCPCHK_RULES_AGENT_CHK 0x00000080
#define TCPCHK_RULES_SPOP_CHK 0x00000090
/* Unused 0x000000A0..0x00000F00 (reserverd for futur proto) */
#define TCPCHK_RULES_PROTO_CHK 0x00000FF0 /* Mask to cover protocol check */
/* A list of tcp-check vars, to be registered before executing a ruleset */
struct tcpcheck_var {

View File

@ -635,7 +635,8 @@ static void chk_report_conn_err(struct check *check, int errno_bck, int expired)
*/
chk = get_trash_chunk();
if (check->type == PR_O2_TCPCHK_CHK) {
if (check->type == PR_O2_TCPCHK_CHK &&
!(check->tcpcheck_rules->flags & TCPCHK_RULES_PROTO_CHK)) {
step = tcpcheck_get_step_id(check, NULL);
if (!step)
chunk_printf(chk, " at initial connection step of tcp-check");
@ -2318,6 +2319,9 @@ static void tcpcheck_onerror_message(struct buffer *msg, struct check *check, st
goto comment;
}
if (check->type == PR_O2_TCPCHK_CHK && (check->tcpcheck_rules->flags & TCPCHK_RULES_PROTO_CHK))
goto comment;
chunk_strcat(msg, (match ? "TCPCHK matched unwanted content" : "TCPCHK did not match content"));
switch (rule->expect.type) {
case TCPCHK_EXPECT_STRING:
@ -2384,7 +2388,7 @@ static void tcpcheck_onsuccess_message(struct buffer *msg, struct check *check,
if (!LIST_ISEMPTY(&rule->expect.onsuccess_fmt))
msg->data += sess_build_logline(check->sess, NULL, b_tail(msg), b_room(msg),
&rule->expect.onsuccess_fmt);
else
else if (check->type == PR_O2_TCPCHK_CHK && !(check->tcpcheck_rules->flags & TCPCHK_RULES_PROTO_CHK))
chunk_strcat(msg, "(tcp-check)");
if (rule->expect.status_expr) {