Make saving IP and CNAMEs more defensive

This commit is contained in:
Daniel
2024-11-12 15:13:44 +01:00
parent 07acb9befa
commit f4b96e1ce7
2 changed files with 4 additions and 4 deletions

View File

@@ -302,11 +302,11 @@ func UpdateIPsAndCNAMEs(q *resolver.Query, rrCache *resolver.RRCache, conn *netw
Expires: rrCache.Expires,
}
// Resolve all CNAMEs in the correct order and add the to the record.
// Resolve all CNAMEs in the correct order and add the to the record - up to max 50 layers.
domain := q.FQDN
for {
for range 50 {
nextDomain, isCNAME := cnames[domain]
if !isCNAME {
if !isCNAME || nextDomain == domain {
break
}