Archive Index This month's Index

Subject: gethostbyname reload resolv.conf values

gethostbyname reload resolv.conf values

From: Nayanā Topolsky <nayana.topolsky_at_zoho.com>
Date: Thu, 8 Aug 2019 15:13:54 +0200

Hi all,

I found strange corner case bug and I have fix for it for Linux.
I would like to ask whether it makes sense to try to merge it or it has
to have fix for all the platforms.

The bug is that when one calls ares_init when /etc/resolv.conf is empty
(I have it generated only after network comes up)
and then tries to ares_gethostbyname after it was filled in later, it
does not work (using curl with c-ares).
It tries to use 127.0.0.1 (probably some default) which succeeds for
IPv4 but fails for IPv6.
It fails with Could not resolve host error.

I think that it is the task of c-ares to detect file change and reload
it before the request.
I used stat64 function to check mtime and ctime and also size and ino
values in very similar way as it is done in libc.

I can send a patch (or pull request) with hope that somebody else will
continue the work on it.
Or maybe it would be mergable even in this way.

Nayanā
Received on 2019-08-08