]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: tcpcheck: Report hexstring instead of binary one on check failure
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Oct 2023 08:00:37 +0000 (09:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 31 Oct 2023 07:02:44 +0000 (08:02 +0100)
When an expect rule failed for a tcp-check, information about the expect
rule is dumped in the report. For a check on a binary string, a hexstring is
used in the configuration but the decoded string is dumped. It is an problem
because it can contain special characters. And it is not really handy
because there is no correspondance with the config.

So, now, the hexstring is dumped in the report. This way, we are sure there
is no special characters and it is easy to find it in the configuration.

This patch shoudl solve the issue #2326. It must be backported as far as
2.2.

src/check.c

index 652a8a5c0927b97a77d5cd47420899d646d91031..91fdbcb8c2f5b798f629487a9e7ce739b08080f4 100644 (file)
@@ -860,7 +860,9 @@ void chk_report_conn_err(struct check *check, int errno_bck, int expired)
                                        chunk_appendf(chk, " (expect string '%.*s')", (unsigned int)istlen(expect->data), istptr(expect->data));
                                        break;
                                case TCPCHK_EXPECT_BINARY:
-                                       chunk_appendf(chk, " (expect binary '%.*s')", (unsigned int)istlen(expect->data), istptr(expect->data));
+                                       chunk_appendf(chk, " (expect binary '");
+                                       dump_binary(chk, istptr(expect->data), (int)istlen(expect->data));
+                                       chunk_appendf(chk, "')");
                                        break;
                                case TCPCHK_EXPECT_STRING_REGEX:
                                        chunk_appendf(chk, " (expect regex)");