Subject: Proposed fix for #220 (configurability for resolv.conf file path)

Proposed fix for #220 (configurability for resolv.conf file path)

From: Sarat Chandra Addepalli <>
Date: Tue, 4 Sep 2018 22:50:50 +0530

Hi Team,

Please find attached a preliminary attempt at resolving the issue #220
on GitHub, the PR has been raised on GitHub as well (#221).

Following the helpful comments on the GitHub issue, I have attempted
to address it by extending the `ares_options` and `ares_channeldata`
structs, and the attendant `ares_init_options`, `ares_save_options`,
`init_by_resol_conf` functions.

I still have a couple of doubts, though:

1) If the user sets options->resolconf_path to an invalid or a non
existent path, I'm still falling back to the current set of fallback
paths (`/etc/resolv.conf`, `/etc/nsswitch.conf`, `/etc/host.conf`,
2) ARES_OPT_RESOLVCONF now becomes 1 << 17, which no longer fits into
a 16 bit int. This might break any 16 bit machines that we may have
been supporting until now, I'm not completely sure.
3) I have added no support for any other types of archs except *nix
(such as Android, Windows, etc.), as I have no idea how.

With the caveats that Travis CI seems to pass for all other builds
except coverage on windows, and that my C and C++ is a bit rusty,
please review and let me know what needs to be improved. I will be
adding documentation, once the code fixes seem good to merge.

Thanks and regards,
Sarat Addepalli

Received on 2018-09-04