[Dnsmasq-discuss] No servers after coming back from sleep (was dnsmasq 2.86 crash)
Eloy Paris
peloy at chapus.net
Wed Oct 20 09:35:47 UTC 2021
On Tue, Oct 19, 2021 at 01:13:46PM -0400, Eloy Paris wrote:
> I am seeing the new issue happen very often -- the machine goes to sleep
> and when it comes back it seems like dnsmasq does not have upstream
> servers to forward requests to, so the virtual machine that relies on
> dnsmasq for DNS resolution cannot resolve anything.
I've done some troubleshooting of this and my /etc/resolv.conf seems
stable when the machine comes back from sleep and dnsmasq reads it.
However, for some reason the servers there don't seem to be added to
the daemon->servers linked list.
dnsmasq.c:poll_resolv() has:
----------------------------------------------------------------------
if (latest)
{
static int warned = 0;
if (reload_servers(latest->name))
{
my_syslog(LOG_INFO, _("reading %s"), latest->name);
warned = 0;
check_servers(0);
----------------------------------------------------------------------
I instrumented check_servers(), as that is what logs "using nameserver
xyz", and my syslog has this in the working case (before I put the
machine to sleep):
Oct 20 05:16:32 chapilu dnsmasq[167055]: /etc/resolv.conf: search example.com
Oct 20 05:16:32 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.4
Oct 20 05:16:32 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.5
Oct 20 05:16:32 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.6
Oct 20 05:16:32 chapilu dnsmasq[167055]: reading /etc/resolv.conf
Oct 20 05:16:32 chapilu dnsmasq[167055]: check_servers(): Server #1: domain = , interface =
Oct 20 05:16:32 chapilu dnsmasq[167055]: using nameserver 1.2.3.4#53
Oct 20 05:16:32 chapilu dnsmasq[167055]: check_servers(): Server #2: domain = , interface =
Oct 20 05:16:32 chapilu dnsmasq[167055]: using nameserver 1.2.3.5#53
Oct 20 05:16:32 chapilu dnsmasq[167055]: check_servers(): Server #3: domain = , interface =
Oct 20 05:16:32 chapilu dnsmasq[167055]: using nameserver 1.2.3.6#53
Oct 20 05:16:32 chapilu dnsmasq[167055]: check_servers(): 3 servers in daemon->servers
Oct 20 05:16:32 chapilu dnsmasq[167055]: check_servers(): 0 servers in daemon->local_domains
(Doing "touch /etc/resolv.conf" when things are working [before I put
the machine to sleep], produces the above as well.)
However, when I put the machine to sleep, and later resume, I get this:
Oct 20 05:17:26 chapilu dnsmasq[167055]: /etc/resolv.conf: # Generated by NetworkManager
Oct 20 05:17:26 chapilu dnsmasq[167055]: /etc/resolv.conf: search example.com
Oct 20 05:17:26 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.4
Oct 20 05:17:26 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.5
Oct 20 05:17:26 chapilu dnsmasq[167055]: /etc/resolv.conf: nameserver 1.2.3.6
Oct 20 05:17:26 chapilu dnsmasq[167055]: reading /etc/resolv.conf
Oct 20 05:17:26 chapilu dnsmasq[167055]: check_servers(): 0 servers in daemon->servers
Oct 20 05:17:26 chapilu dnsmasq[167055]: check_servers(): 0 servers in daemon->local_domains
So it seems like after the resume from sleep, /etc/resolv.conf is
stable, has the correct upstream DNS servers, but somehow
daemon->servers ends up with nothing; what could cause this?
Cheers,
Eloy Paris.-
More information about the Dnsmasq-discuss
mailing list