commit 39df2730b9f0640bbb86a37819a67397fdaba02d
parent 97526702a8b41056a7fad5e55a19b7ea34113f5c
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 30 Dec 2025 15:32:45 +0000
send cache-flush when appropriate
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/ecu-esp32/src/wifi.rs b/ecu-esp32/src/wifi.rs
@@ -316,6 +316,22 @@ impl DnsResource {
}
}
+ // Should we send cache-flush with this record? If it's "unique",
+ // which means "all the records with that name, rrtype, and
+ // rrclass are conceptually under the control or ownership of a
+ // single responder". This works out (perhaps by coincidence) to
+ // be everything except the PTR records
+ fn is_unique(&self) -> bool {
+ self.data.ty() != ResourceType::Ptr
+ }
+ fn class(&self) -> u16 {
+ if self.is_unique() {
+ 1 | CACHE_FLUSH
+ } else {
+ 1
+ }
+ }
+
fn to_resource_record(&self) -> ResourceRecord<'_> {
let ttl = match self.data.ty() {
ResourceType::A => 120,
@@ -326,7 +342,7 @@ impl DnsResource {
ResourceRecord::new(
&self.name[..],
self.data.ty(),
- 1,
+ self.class(),
ttl,
&self.data_raw[..]
)