From: Willy Tarreau Date: Fri, 20 May 2022 15:28:30 +0000 (+0200) Subject: CLEANUP: config: improve address parser error report for unmatched protocols X-Git-Tag: v2.6-dev11~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b049b81669898cf7bc2e54b2ab96ddb791f696e;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/tools.c b/src/tools.c index c6bc81be91..71337aa641 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; }