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.
This commit is contained in:
Willy Tarreau 2022-05-20 17:28:30 +02:00
parent 0d04410ebe
commit 2b049b8166

View 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;
}