]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dns: update record dname matching for SRV query types
authorBaptiste Assmann <bedis9@gmail.com>
Fri, 11 Aug 2017 08:31:22 +0000 (10:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Aug 2017 09:24:45 +0000 (11:24 +0200)
DNS response for SRV queries look like this:
- query dname looks like '_http._tcp.red.default.svc.cluster.local'
- answer record dname looks like
  '3336633266663038.red.default.svc.cluster.local.'

Of course, it never matches... and it triggers many false positive in
the current code (which is suitable for A/AAAA/CNAME).

This patch simply ignores this dname matching in the case of SRV query
type.

src/dns.c

index c3905f9ca02f26dc5251e3430b7b9eafabde810d..765c787d6a001f57332f650703481132e5727572 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1173,7 +1173,7 @@ int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend, struct
                /* check if the current record dname is valid.
                 * previous_dname points either to queried dname or last CNAME target
                 */
-               if (memcmp(previous_dname, tmpname, len) != 0) {
+               if (dns_query->type != DNS_RTYPE_SRV && memcmp(previous_dname, tmpname, len) != 0) {
                        free_dns_answer_item(dns_answer_record);
                        if (i == 0) {
                                /* first record, means a mismatch issue between queried dname