From: Christopher Faulet Date: Tue, 7 Apr 2020 10:06:14 +0000 (+0200) Subject: MINOR: Produce tcp-check info message for pure tcp-check rules only X-Git-Tag: v2.2-dev7~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=799f3a462161dd3747d53b912575afafe7f05b2c;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/types/checks.h b/include/types/checks.h index d828331fe7..2b17125f71 100644 --- a/include/types/checks.h +++ b/include/types/checks.h @@ -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 { diff --git a/src/checks.c b/src/checks.c index 2ffa1947b0..aacaf612c1 100644 --- a/src/checks.c +++ b/src/checks.c @@ -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) {