Skip to content

Commit

Permalink
bugfix: set address type correctly (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
keepsimple1 authored Oct 11, 2023
1 parent 966a835 commit fef5409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/dns_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,14 @@ impl DnsOutgoing {
)));

for address in intf_addrs {
let t = match address {
IpAddr::V4(_) => TYPE_A,
IpAddr::V6(_) => TYPE_AAAA,
};

self.add_additional_answer(Box::new(DnsAddress::new(
service.get_hostname(),
TYPE_A,
t,
CLASS_IN | CLASS_UNIQUE,
service.get_host_ttl(),
address,
Expand Down Expand Up @@ -1016,7 +1021,7 @@ impl DnsIncoming {
// sanity check.
if self.offset != next_offset {
return Err(Error::Msg(format!(
"read_name: decode offset error for RData type {} record: {:?} offset: {} expected offset: {}",
"read_others: decode offset error for RData type {} record: {:?} offset: {} expected offset: {}",
ty, &rec, self.offset, next_offset,
)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/service_daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl Zeroconf {
error!("Invalid message: not query and not response");
}
}
Err(e) => error!("Invalid incoming message: {}", e),
Err(e) => error!("Invalid incoming DNS message: {}", e),
}

true
Expand Down

0 comments on commit fef5409

Please sign in to comment.