Skip to content

Commit 52f758d

Browse files
authored
fix(dns): parsing of /etc/resolv.conf by manually updating resolv-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
1 parent 32c330d commit 52f758d

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

Cargo.lock

+16-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tokio = { version = "0.2", features = ["rt-core", "sync"] }
3333
trust-dns-resolver = "0.18.1"
3434
async-trait = "0.1.21"
3535
unicode-width = "0.1.8"
36+
resolv-conf = "0.6.3"
3637

3738
[target.'cfg(target_os="windows")'.dependencies]
3839
netstat2 = "0.9.0"
@@ -51,3 +52,6 @@ regex = "1"
5152
[target.'cfg(target_os="windows")'.build-dependencies]
5253
http_req = "0.7.0"
5354
zip = "0.5.6"
55+
56+
[patch.crates-io]
57+
resolv-conf = { git = 'https://github.com/tailhook/resolv-conf', rev = '83c0f25ebcb0615550488692c5213ca1ae4acd8f' }

src/os/shared.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ pub fn get_input(
238238
let mut runtime = Runtime::new()?;
239239
let resolver = match runtime.block_on(dns::Resolver::new(runtime.handle().clone())) {
240240
Ok(resolver) => resolver,
241-
Err(_) => failure::bail!("Could not initialize the DNS resolver. Are you offline?"),
241+
Err(err) => failure::bail!(
242+
"Could not initialize the DNS resolver. Are you offline?\n\nReason: {:?}",
243+
err
244+
),
242245
};
243246
let dns_client = dns::Client::new(resolver, runtime)?;
244247
Some(dns_client)

0 commit comments

Comments
 (0)