resolver: store a name's CNAME once per nameserver (closes #220)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
For a name with a CNAME, a nameserver answers a query of any type with that CNAME, and the records of every answer were added, so the CNAME was stored once for each of the eight record types asked for. collectAnswerRecords now adds each value once per record type. A state file saved before this holds the repeated values. Load keeps each record value once, so the first check after upgrading sees no record change and notifies nothing for them. Model: opus-5-5
This commit was merged in pull request #236.
This commit is contained in:
@@ -714,6 +714,10 @@ func (r *Resolver) querySingleType(
|
||||
collectAnswerRecords(msg, resp, state)
|
||||
}
|
||||
|
||||
// collectAnswerRecords adds the records in msg's answer to resp, each
|
||||
// value once per record type. For a name with a CNAME, a nameserver
|
||||
// answers a query of any type with that CNAME, so the same value comes
|
||||
// in the answer to every type asked for.
|
||||
func collectAnswerRecords(
|
||||
msg *dns.Msg,
|
||||
resp *NameserverResponse,
|
||||
@@ -726,9 +730,12 @@ func collectAnswerRecords(
|
||||
}
|
||||
|
||||
typeName := dns.TypeToString[rr.Header().Rrtype]
|
||||
resp.Records[typeName] = append(
|
||||
resp.Records[typeName], val,
|
||||
)
|
||||
if !slices.Contains(resp.Records[typeName], val) {
|
||||
resp.Records[typeName] = append(
|
||||
resp.Records[typeName], val,
|
||||
)
|
||||
}
|
||||
|
||||
state.hasRecords = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user