When too many NS records are fetched from authoritative zone, limit number of fetched additional records. Instead of not producing any additional record when there is over 13 NS servers, limit number of records for which those records would be fetched. Resolves: RHEL-84006
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
From 9140eac85cda21fa86f2768f7ccaf6800776c726 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
|
Date: Thu, 19 Jun 2025 19:51:43 +0200
|
|
Subject: [PATCH] Limit number of additional records fetched
|
|
|
|
Limit number of started fetches for additional zone instead of doing
|
|
none. Keep limit of NS filled with additional records, but present at
|
|
least some if possible.
|
|
|
|
Might help broken implementations relying on receiving addresses in the
|
|
response for NS query in authoritative zone.
|
|
---
|
|
lib/dns/rdataset.c | 11 ++++++-----
|
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c
|
|
index ffe6163..cfdb7d5 100644
|
|
--- a/lib/dns/rdataset.c
|
|
+++ b/lib/dns/rdataset.c
|
|
@@ -586,6 +586,7 @@ dns_rdataset_additionaldata2(dns_rdataset_t *rdataset,
|
|
dns_additionaldatafunc_t add, void *arg, size_t limit) {
|
|
dns_rdata_t rdata = DNS_RDATA_INIT;
|
|
isc_result_t result;
|
|
+ size_t n = 0;
|
|
|
|
/*
|
|
* For each rdata in rdataset, call 'add' for each name and type in the
|
|
@@ -595,10 +596,6 @@ dns_rdataset_additionaldata2(dns_rdataset_t *rdataset,
|
|
REQUIRE(DNS_RDATASET_VALID(rdataset));
|
|
REQUIRE((rdataset->attributes & DNS_RDATASETATTR_QUESTION) == 0);
|
|
|
|
- if (limit != 0 && dns_rdataset_count(rdataset) > limit) {
|
|
- return DNS_R_TOOMANYRECORDS;
|
|
- }
|
|
-
|
|
result = dns_rdataset_first(rdataset);
|
|
if (result != ISC_R_SUCCESS) {
|
|
return (result);
|
|
@@ -608,7 +605,11 @@ dns_rdataset_additionaldata2(dns_rdataset_t *rdataset,
|
|
dns_rdataset_current(rdataset, &rdata);
|
|
result = dns_rdata_additionaldata(&rdata, add, arg);
|
|
if (result == ISC_R_SUCCESS) {
|
|
- result = dns_rdataset_next(rdataset);
|
|
+ if (limit != 0 && ++n >= limit) {
|
|
+ result = DNS_R_TOOMANYRECORDS;
|
|
+ } else {
|
|
+ result = dns_rdataset_next(rdataset);
|
|
+ }
|
|
}
|
|
dns_rdata_reset(&rdata);
|
|
} while (result == ISC_R_SUCCESS);
|
|
--
|
|
2.49.0
|
|
|