]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dns: query type change when last record is a CNAME
authorBaptiste Assmann <bedis9@gmail.com>
Mon, 5 Sep 2016 06:38:57 +0000 (08:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Sep 2016 18:01:40 +0000 (20:01 +0200)
DNS servers don't return A or AAAA record if the query points to a CNAME
not resolving to the right type.
We know it because the last record of the response is a CNAME. We can
trigger a new query, switching to a new query type, handled by the layer
above.

src/server.c

index b6eef5db9ca9bad85822c9f2aa9574991da8698c..68fa8009f42f1976d9382d2f1eeb88e3d2bc2e91 100644 (file)
@@ -2964,6 +2964,7 @@ int snr_resolution_error_cb(struct dns_resolution *resolution, int error_code)
                case DNS_RESP_TRUNCATED:
                case DNS_RESP_ERROR:
                case DNS_RESP_NO_EXPECTED_RECORD:
+               case DNS_RESP_CNAME_ERROR:
                        res_preferred_afinet = resolution->opts->family_prio == AF_INET && resolution->query_type == DNS_RTYPE_A;
                        res_preferred_afinet6 = resolution->opts->family_prio == AF_INET6 && resolution->query_type == DNS_RTYPE_AAAA;
 
@@ -3024,9 +3025,6 @@ int snr_resolution_error_cb(struct dns_resolution *resolution, int error_code)
                        }
                        break;
 
-               case DNS_RESP_CNAME_ERROR:
-                       break;
-
                case DNS_RESP_TIMEOUT:
                        if (resolution->status != RSLV_STATUS_TIMEOUT) {
                                resolution->status = RSLV_STATUS_TIMEOUT;