Skip to content

Commit

Permalink
Ignore FQDN when looking up address in hosts file
Browse files Browse the repository at this point in the history
  • Loading branch information
hch12907 committed Mar 11, 2024
1 parent bb157f8 commit 49eb461
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/resolver/src/hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ impl Hosts {
/// Look up the addresses for the given host from the system hosts file.
pub fn lookup_static_host(&self, query: &Query) -> Option<Lookup> {
if !self.by_name.is_empty() {
if let Some(val) = self.by_name.get(query.name()) {
// Ignore FQDN when looking up an address from the system hosts file.
let mut name = query.name().clone();
name.set_fqdn(false);

if let Some(val) = self.by_name.get(&name) {
let result = match query.query_type() {
RecordType::A => val.a.clone(),
RecordType::AAAA => val.aaaa.clone(),
Expand Down

0 comments on commit 49eb461

Please sign in to comment.