Make saving IP and CNAMEs more defensive
This commit is contained in:
@@ -302,11 +302,11 @@ func UpdateIPsAndCNAMEs(q *resolver.Query, rrCache *resolver.RRCache, conn *netw
|
|||||||
Expires: rrCache.Expires,
|
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
|
domain := q.FQDN
|
||||||
for {
|
for range 50 {
|
||||||
nextDomain, isCNAME := cnames[domain]
|
nextDomain, isCNAME := cnames[domain]
|
||||||
if !isCNAME {
|
if !isCNAME || nextDomain == domain {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,8 +224,8 @@ func handleRequest(ctx context.Context, w dns.ResponseWriter, request *dns.Msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the request as open, as we don't know if there will be a connection or not.
|
// Save the request as open, as we don't know if there will be a connection or not.
|
||||||
network.SaveOpenDNSRequest(q, rrCache, conn)
|
|
||||||
firewall.UpdateIPsAndCNAMEs(q, rrCache, conn)
|
firewall.UpdateIPsAndCNAMEs(q, rrCache, conn)
|
||||||
|
network.SaveOpenDNSRequest(q, rrCache, conn)
|
||||||
|
|
||||||
case network.VerdictUndeterminable:
|
case network.VerdictUndeterminable:
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|||||||
Reference in New Issue
Block a user