bandwhich
bandwhich copied to clipboard
rDNS might not work on latest macos
sudo bandwhich
Password:
Error: Could not initialize the DNS resolver. Are you offline?
bandwhich
Error:
lo0: No such file or directory (os error 2)
en5: No such file or directory (os error 2)
en0: No such file or directory (os error 2)
awdl0: No such file or directory (os error 2)
llw0: No such file or directory (os error 2)
utun0: No such file or directory (os error 2)
utun1: No such file or directory (os error 2)
utun2: No such file or directory (os error 2)
utun3: No such file or directory (os error 2)
uname -a
Darwin RMBP.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
bandwhich -V
bandwhich 0.13.0
Installed via homebrew
Hey, thanks for reporting this. That's quite odd. Would you mind helping me out with a little bit of debugging to find the issue? (I don't have access to a mac)
If you run bandwhich with the -n flag like this sudo bandwhich -n does it work? Do you see traffic? (This turns off the reverse DNS resolution, which is what's failing here).
That works!
Hey @richstokes, so if you use the same terminal window from which you run bandwhich (when it doesn't work, without the -n flag) in order to do a ping github.com, does it work for you?
This error essentially means that bandwhich failed to contact your DNS server, and I'm wondering why?
Yep, DNS works fine for other apps;
sudo bandwhich
Password:
Error: Could not initialize the DNS resolver. Are you offline?
nslookup google.com
Server: 9.9.9.9
Address: 9.9.9.9#53
Non-authoritative answer:
Name: google.com
Address: 172.217.0.46
Hum... just for debugging, would you be willing to try setting your dns server to 1.1.1.1 and seeing if it works out (with both bandwhich and nslookup)?
Sure. Switched DNS to 1.1.1.1, cleared cache, retried, same error.
Thanks! I'd like to give you a debug branch that'll give us a more verbose error in this case with a quick hack. Would you be comfortable running such a branch from this repo? I can provide some instructions if you're unfamiliar with rust.
Can do when I have a few moments spare - not used Rust so would need info on how to compile/run
Same error here on Arch Linux, Could not initialize the DNS resolver, using systemd-resolved and googles DNS, 8.8.8.8, the -n flag works tho.
@richstokes @DianaNites any chance you're running systemd-networkd at v246? It seems as the resolv-conf doesn't support the trust-ad option in /etc/resolv.conf at version 0.6.2 (which is the one we're using here).
The problem gets fixed on master (https://github.com/tailhook/resolv-conf/commit/83c0f25ebcb0615550488692c5213ca1ae4acd8f), so it should be possible to fix this issue by updating the resolv-conf crate to this revision.
I stumbled upon this issue after my latest OS update (which included systemd-246) which uses options trust-ad in their /etc/resolv.conf-stub for resolvectl. See https://github.com/systemd/systemd/commit/a742f9828ea73d9c2c9bafe701c10fe60f058012.
@imsnif I only confirmed that resolv-conf master fixes the issue. I'll try to fix the dependency for bandwhich and open a PR then :)
Thanks very much for finding this @Ma27, and for the quick fix. My apologies for not finding the time for debugging this myself.
Hmm I'm actually realizing now that the reporter has the issue on macos, so I don't if they have the same issue. However my patch fixes the issue for me.
At the very least we'll get clearer errors after your patch on this.
FWIW I was seeing this on an ubuntu install (rolling rhino, thieir kinda rolling release) and installing from git with the patch for resolv.conf actually did fix it for me
@Ma27 I'm on Arch Linux, which indeed uses systemd-networkd 246.
The latest bandwhich version, 0.19.0, does not fix it for me, though the error is now more detailed.
Error: Could not initialize the DNS resolver. Are you offline?
Reason: ResolveError { inner: Custom { kind: Other, error: "Error parsing resolv.conf: InvalidOption(17)" }
io error }
/etc/resolv.conf looks like this
nameserver 127.0.0.53
options edns0 trust-ad
Hey @DianaNites (and others experiencing this issue),
I added a feature that would allow users to explicitly specify a dns server to use for the rDNS lookups as a workaround. Something like bandwhich --dns-server 1.1.1.1
I'm going to release a new version with it in the next few days (I'm waiting on another fix I'd like to see in that version too). Thanks for your patience. :)
New version released. Starting from version 0.20.0, you can now use the --dns-server flag eg. bandwhich -d 1.1.1.1 to manually specify a DNS server as a workaround for this issue.
Closing this issue as completed. If you disagree please comment/reopen.