Skip to content

Commit

Permalink
On querytype:All - return all records instead of just hostname record
Browse files Browse the repository at this point in the history
  • Loading branch information
angelybo committed Feb 6, 2023
1 parent b80c575 commit 701951e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/fsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,27 @@ impl<AF: AddressFamily> FSM<AF> {
let services = self.services.read().unwrap();

match question.qtype {
QueryType::A | QueryType::AAAA | QueryType::All
QueryType::A | QueryType::AAAA
if question.qname == *services.get_hostname() =>
{
builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL);
},
QueryType::All => {
// A / AAAA
builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL);
// PTR
builder = Self::handle_service_type_enumeration(question, services.into_iter(), builder);
for svc in services.find_by_type(&question.qname) {
builder = svc.add_ptr_rr(builder, DEFAULT_TTL);
builder = svc.add_srv_rr(services.get_hostname(), builder, DEFAULT_TTL);
builder = svc.add_txt_rr(builder, DEFAULT_TTL);
builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL);
}
// SRV
if let Some(svc) = services.find_by_name(&question.qname) {
builder = svc.add_srv_rr(services.get_hostname(), builder, DEFAULT_TTL);
builder = self.add_ip_rr(services.get_hostname(), builder, DEFAULT_TTL);
}
}
QueryType::PTR => {
builder =
Expand Down

0 comments on commit 701951e

Please sign in to comment.