diff --git a/src/dns_parser.rs b/src/dns_parser.rs index f53340b..4f4194d 100644 --- a/src/dns_parser.rs +++ b/src/dns_parser.rs @@ -167,6 +167,10 @@ pub(crate) trait DnsRecordExt: fmt::Debug { /// Returns whether `other` record is considered the same except TTL. fn matches(&self, other: &dyn DnsRecordExt) -> bool; + fn get_class(&self) -> u16 { + self.get_record().entry.class + } + fn get_cache_flush(&self) -> bool { self.get_record().entry.cache_flush } diff --git a/src/service_daemon.rs b/src/service_daemon.rs index 617e372..c05245f 100644 --- a/src/service_daemon.rs +++ b/src/service_daemon.rs @@ -2363,7 +2363,7 @@ impl DnsCache { // When cache flush is asked, we set expire date to 1 second in the future // if created more than 1 second ago // Ref: RFC 6762 Section 10.2 - if now > r.get_created() + 1000 { + if incoming.get_class() == r.get_class() && now > r.get_created() + 1000 { r.set_expire(now + 1000); } }); @@ -2673,7 +2673,6 @@ mod tests { FLAGS_QR_RESPONSE, TYPE_PTR, TYPE_TXT, }, service_daemon::check_hostname, - service_info::IntoTxtProperties, }; use std::{collections::HashMap, net::SocketAddr, net::SocketAddrV4, time::Duration};