From: Amaury Denoyelle Date: Fri, 13 Nov 2020 11:34:58 +0000 (+0100) Subject: MINOR: check: report error on incompatible connect proto X-Git-Tag: v2.4-dev1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90eb93f79204336e38fdb859f61ab75ce44a4367;p=thirdparty%2Fhaproxy.git MINOR: check: report error on incompatible connect proto Report an error when using an explicit proto for a connect rule with non-compatible mode in regards with the selected check type (tcp-check vs http-check). --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 3142e78680..75d97f3df7 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -2282,6 +2282,16 @@ struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, struct pr memprintf(errmsg, "'%s' : unknown MUX protocol '%s'.", args[cur_arg], args[cur_arg+1]); goto error; } + + if (strcmp(args[0], "tcp-check") == 0 && mux_proto->mode != PROTO_MODE_TCP) { + memprintf(errmsg, "'%s' : invalid MUX protocol '%s' for tcp-check", args[cur_arg], args[cur_arg+1]); + goto error; + } + else if (strcmp(args[0], "http-check") == 0 && mux_proto->mode != PROTO_MODE_HTTP) { + memprintf(errmsg, "'%s' : invalid MUX protocol '%s' for http-check", args[cur_arg], args[cur_arg+1]); + goto error; + } + cur_arg++; } else if (strcmp(args[cur_arg], "comment") == 0) {