]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: check: report error on incompatible connect proto
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 Nov 2020 11:34:58 +0000 (12:34 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Nov 2020 15:26:10 +0000 (16:26 +0100)
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).

src/tcpcheck.c

index 3142e78680a942bd5a5fc04c2b572af0c587cd39..75d97f3df7cb9924e289eb8d0cd160be44e784c5 100644 (file)
@@ -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) {