From 2b049b81669898cf7bc2e54b2ab96ddb791f696e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 20 May 2022 17:28:30 +0200 Subject: [PATCH] CLEANUP: config: improve address parser error report for unmatched protocols 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools.c b/src/tools.c index c6bc81be9..71337aa64 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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; }