]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
Revert "BUG/MINOR: dns: SRV records ignores duplicated AR records"
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 Jan 2021 09:27:26 +0000 (10:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 Jan 2021 15:37:54 +0000 (16:37 +0100)
This reverts commit 949a7f64591458eb06c998acf409093ea991dc3a.

The first part of the patch introduces a bug. When a dns answer item is
allocated, its <ar_item> is only initialized at the end of the parsing, when
the item is added in the answer list. Thus, we must not try to release it
during the parsing.

The second part is also probably buggy. It fixes the issue #971 but reverts
a fix for the issue #841 (see commit fb0884c8297 "BUG/MEDIUM: dns: Don't
store additional records in a linked-list"). So it must be at least
revalidated.

This revert fixes a segfault reported in a comment of the issue #971. It
must be backported as far as 2.2.

src/dns.c

index 4f7ed4b501181b8bc8c18fbeb406fc5b6a1ca68b..d71a5d3024cc2e0ccc22283909e5b332d07515bf 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1027,10 +1027,6 @@ static int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend,
                                dns_answer_record->data_len = len;
                                memcpy(dns_answer_record->target, tmpname, len);
                                dns_answer_record->target[len] = 0;
-                               if (dns_answer_record->ar_item != NULL) {
-                                       pool_free(dns_answer_item_pool, dns_answer_record->ar_item);
-                                       dns_answer_record->ar_item = NULL;
-                               }
                                break;
 
                        case DNS_RTYPE_AAAA:
@@ -1280,7 +1276,6 @@ static int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend,
                        // looking for the SRV record in the response list linked to this additional record
                        list_for_each_entry(tmp_record, &dns_p->answer_list, list) {
                                if (tmp_record->type == DNS_RTYPE_SRV &&
-                                   tmp_record->ar_item == NULL &&
                                    !dns_hostname_cmp(tmp_record->target, dns_answer_record->name, tmp_record->data_len)) {
                                        /* Always use the received additional record to refresh info */
                                        if (tmp_record->ar_item)