这是indexloc提供的服务,不要输入任何密码
Skip to content

Gracefully handle unrecognized options in /etc/resolv.conf #52

@Gautham

Description

@Gautham

Describe the bug
hickory-dns fails fast if it sees an option it does not recognize in /etc/resolv.conf. This behaviour is problematic as this means options cannot be added to a machine unless all resolvers on the system support it.

Ideally, hickory-dns should (optionally) warn about the unrecognized option and proceed. It'd be nice for hickory-dns to support the new option I used as well but in general, being able to gracefully handle new options is the priority here :)

To Reproduce
I added an additional option no-aaaa (introduced here) to /etc/resolv.conf for glibc. This caused cargo to fail installing Rust packages as it internally uses hickory-dns.

Sample /etc/resolf.conf:

gautham@myhost:~$ cat /etc/resolv.conf
nameserver 127.0.0.1
options edns0 no-aaaa
search foo.org

Error encountered: https://github.com/hickory-dns/hickory-dns/blob/dc5627135a916d9c118b11db0c97fb19adcbe908/crates/resolver/src/system_conf/unix.rs#L40

>  INFO resolve:fetch_crate_matched{crate_name="eza" registry_url=https://index.crates.io/ version_req=*}:do_send_request{request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("[index.crates.io](http://index.crates.io/)")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=https://index.crates.io/config.json}: Received timeout error from reqwest. Delay future request by 200ms
> ERROR Fatal error:
>   × For crate eza: could not GET https://index.crates.io/config.json: error sending request
>   ├─▶ could not GET https://index.crates.io/config.json: error sending request
>   ├─▶ error sending request
>   ├─▶ client error (Connect)
>   ├─▶ tunnel error: failed to create underlying connection
>   ├─▶ dns error
>   ╰─▶ proto error: io error: Error parsing resolv.conf: option at line 2 is not recognized

Expected behavior
Since this is unsupported by hickory-dns, this should have printed a warning once and continued to process the request. Printing logs per query will cause spamming.

System:

  • OS: Ubuntu
  • Architecture: ARM
  • Version: Noble

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions