diff --git a/src/relay/dnsrelay/mod.rs b/src/relay/dnsrelay/mod.rs index f215220f..7e6bcbca 100644 --- a/src/relay/dnsrelay/mod.rs +++ b/src/relay/dnsrelay/mod.rs @@ -28,7 +28,10 @@ pub mod upstream; fn should_forward_by_ptr_name(acl: &AccessControl, name: &Name) -> bool { let mut iter = name.iter().rev(); - let mut next = || std::str::from_utf8(iter.next().unwrap_or(&[48])).unwrap_or("*"); + let mut next = || match iter.next() { + Some(label) => std::str::from_utf8(label).unwrap_or("*"), + None => "0", // zero fill the missing labels + }; if !"arpa".eq_ignore_ascii_case(next()) { return acl.is_default_in_proxy_list(); } @@ -141,15 +144,12 @@ fn should_forward_by_response( } } -async fn acl_lookup( +async fn acl_lookup( acl: &Option, local: &upstream::LocalUpstream, remote: Arc, query: &Query -) -> (io::Result, bool) - where - Remote: upstream::Upstream, -{ +) -> (io::Result, bool) { // Start querying name servers debug!( "attempting lookup of {:?} {} with ns {:?} and {:?}",