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.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 7fc499a..c5b2b20 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1041,8 +1041,14 @@
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;