Skip to content

Commit

Permalink
fix(dns): parsing of /etc/resolv.conf by manually updating `resolv-…
Browse files Browse the repository at this point in the history
…conf` crate (#184)

* Show the error cause if initializing a DNS resolver fails

* Manually bump `resolv-conf` to `master` at rev `83c0f25`

This fixes the parsing of `/etc/resolv.conf` with `options trust-ad`
which is e.g. used in `systemd-resolved-v246`[1].

Refs #166

[1] systemd/systemd@a742f98
  • Loading branch information
Ma27 authored Sep 11, 2020
1 parent 32c330d commit 52f758d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
33 changes: 16 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tokio = { version = "0.2", features = ["rt-core", "sync"] }
trust-dns-resolver = "0.18.1"
async-trait = "0.1.21"
unicode-width = "0.1.8"
resolv-conf = "0.6.3"

[target.'cfg(target_os="windows")'.dependencies]
netstat2 = "0.9.0"
Expand All @@ -51,3 +52,6 @@ regex = "1"
[target.'cfg(target_os="windows")'.build-dependencies]
http_req = "0.7.0"
zip = "0.5.6"

[patch.crates-io]
resolv-conf = { git = 'https://github.com/tailhook/resolv-conf', rev = '83c0f25ebcb0615550488692c5213ca1ae4acd8f' }
5 changes: 4 additions & 1 deletion src/os/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ pub fn get_input(
let mut runtime = Runtime::new()?;
let resolver = match runtime.block_on(dns::Resolver::new(runtime.handle().clone())) {
Ok(resolver) => resolver,
Err(_) => failure::bail!("Could not initialize the DNS resolver. Are you offline?"),
Err(err) => failure::bail!(
"Could not initialize the DNS resolver. Are you offline?\n\nReason: {:?}",
err
),
};
let dns_client = dns::Client::new(resolver, runtime)?;
Some(dns_client)
Expand Down

0 comments on commit 52f758d

Please sign in to comment.