]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: Produce tcp-check info message for pure tcp-check rules only
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Apr 2020 10:06:14 +0000 (12:06 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Apr 2020 07:39:38 +0000 (09:39 +0200)
This way, messages reported by protocol checks are closer that the old one.

include/types/checks.h
src/checks.c

index d828331fe7f7178612ccd9f0afdb26fdd28db43a..2b17125f717ddcb74df7ef6fb4464e5cff25332a 100644 (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 {
index 2ffa1947b0a6ab55a3724221163aa0950306f462..aacaf612c1ec3e837d12363762a0b1d28d7c129c 100644 (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) {