From e4c4b7dda6eb55a48de6f961afae80bf2447b578 Mon Sep 17 00:00:00 2001 From: Baptiste Assmann Date: Wed, 28 Oct 2015 02:10:02 +0100 Subject: [PATCH] BUG/MINOR: dns: unable to parse CNAMEs response A bug lied in the parsing of DNS CNAME response, leading HAProxy to think the CNAME was improperly resolved in the response. This should be backported into 1.6 branch --- src/dns.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dns.c b/src/dns.c index 53b65ab8d..1348be3d9 100644 --- a/src/dns.c +++ b/src/dns.c @@ -628,8 +628,11 @@ int dns_get_ip_from_response(unsigned char *resp, unsigned char *resp_end, else ptr = reader; - if (cname && memcmp(ptr, cname, cnamelen)) - return DNS_UPD_NAME_ERROR; + if (cname) { + if (memcmp(ptr, cname, cnamelen)) { + return DNS_UPD_NAME_ERROR; + } + } else if (memcmp(ptr, dn_name, dn_name_len)) return DNS_UPD_NAME_ERROR;