]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: config: improve address parser error report for unmatched protocols
authorWilly Tarreau <w@1wt.eu>
Fri, 20 May 2022 15:28:30 +0000 (17:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 20 May 2022 16:39:43 +0000 (18:39 +0200)
Just trying "quic4@:4433" with USE_QUIC not set rsults in such a cryptic
error:

   [ALERT]    (14610) : config : parsing [quic-mini.cfg:44] : 'bind' : unsupported protocol family 2 for address 'quic4@:4433'

Let's at least add the stream and datagram statuses to indicate what was
being looked for:

   [ALERT]    (15252) : config : parsing [quic-mini.cfg:44] : 'bind' : unsupported stream protocol for datagram family 2 address 'quic4@:4433'

Still not very pretty but gives a little bit more info.

src/tools.c

index c6bc81be91193625f0c1b6aa55a6ece225134362..71337aa6412a889d20c1ce2b1a3ad6fc57332fbc 100644 (file)
@@ -1300,7 +1300,11 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
                                            ctrl_type == SOCK_DGRAM);
 
                if (!new_proto && (!fqdn || !*fqdn) && (ss.ss_family != AF_CUST_EXISTING_FD)) {
-                       memprintf(err, "unsupported protocol family %d for address '%s'", ss.ss_family, str);
+                       memprintf(err, "unsupported %s protocol for %s family %d address '%s'",
+                                 (ctrl_type == SOCK_DGRAM) ? "datagram" : "stream",
+                                 (proto_type == PROTO_TYPE_DGRAM) ? "datagram" : "stream",
+                                 ss.ss_family,
+                                 str);
                        goto out;
                }