BUG/MINOR: dns: gracefully handle the "udp@" address format for nameservers

Just like with previous commit, DNS nameservers are affected as well with
addresses starting in "udp@", but here it's different, because due to
another bug in the DNS parser, the address is rejected, indicating that
it doesn't have a ->connect() method. Similarly, the DNS code believes
it's working on top of TCP at this point and this used to work because of
this. The same fix is applied to remap the protocol and the ->connect test
was dropped.

No backport is needed, as the ->connect() test will never strike in 2.2
or below.
This commit is contained in:
Willy Tarreau 2020-09-16 20:04:17 +02:00
parent e1c4c80441
commit e42d87f3de

View File

@ -1041,8 +1041,14 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
goto out;
}
/* handle nicely the case where "udp@" is forced */
if (sk->ss_family == AF_CUST_UDP4)
sk->ss_family = AF_INET;
else if (sk->ss_family == AF_CUST_UDP6)
sk->ss_family = AF_INET6;
proto = protocol_by_family(sk->ss_family);
if (!proto || !proto->connect) {
if (!proto) {
ha_alert("parsing [%s:%d] : '%s %s' : connect() not supported for this address family.\n",
file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL;