From: Willy Tarreau Date: Wed, 16 Sep 2020 20:04:46 +0000 (+0200) Subject: MINOR: tools: drop listener detection hack from str2sa_range() X-Git-Tag: v2.3-dev5~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af9609b4d1ceafa9c637b57999ec6d3503742dd6;p=thirdparty%2Fhaproxy.git MINOR: tools: drop listener detection hack from str2sa_range() We used to resort to a trick to detect whether the caller was a listener or an outgoing socket in order never to present an AF_CUST_UDP* socket to a log server nor a nameserver. This is no longer necessary, the socket type alone will be enough. --- diff --git a/src/tools.c b/src/tools.c index 54cf2d644b..53d2486f46 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1170,16 +1170,9 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int * in which case the address is not known yet (this is only * for servers actually). */ - - /* FIXME: for now UDP is still its own family. However some UDP clients - * (logs, dns) use AF_INET and are not aware of AF_CUST_UDP*. Since we - * only want this mapping for listeners and they are the only ones - * setting PA_O_SOCKET_FD, for now we condition this mapping to this. - * This effectively means that for now we return TCPv4/v6 for UDP senders. - */ new_proto = protocol_lookup(ss.ss_family, - (opts & PA_O_SOCKET_FD) && sock_type == SOCK_DGRAM, - (opts & PA_O_SOCKET_FD) && ctrl_type == SOCK_DGRAM); + sock_type == SOCK_DGRAM, + ctrl_type == SOCK_DGRAM); if (!new_proto && (!fqdn || !*fqdn)) { memprintf(err, "unsupported protocol family %d for address '%s'", ss.ss_family, str);