[Dnsmasq-discuss] No servers after coming back from sleep (was dnsmasq 2.86 crash)

Eloy Paris peloy at chapus.net
Wed Oct 20 16:15:25 UTC 2021

On Wed, Oct 20, 2021 at 11:20:35AM -0400, Eloy Paris wrote:

> Looking at recent changes to add_update_server() I found:
> https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commitdiff;h=eb88eed1fc8ed246e9355531c2715fa2f7738afc
> I have reverted that commit and now bouncing the external interface does
> not cause add_update_server() to leave daemon->servers with NULL, and
> things work.
> I believe there is something wrong with the daemon->servers_tail logic
> introduced by the above commit. I'll try to determine what is wrong with
> the logic but please feel free to beat me to it because it might take me
> a little while.

Unless I am missing something, it seems like the rationale for the above
commit ("Optimize inserting records into server list") is to avoid
traversing the daemon->servers linked list; it does not seem like the
commit is fixing any issues.

I am sure the logic with daemon->servers_tail can be fixed so we can
easily insert a server at the end without walking the linked list, but
why, oh why? It's not like this linked list will have thousands of
elements, and it's not like add_update_server() is being called hundreds
of times per second.

I think we all know what has been said about premature optimization,
plus the way the code was before is probably easier to read and


Eloy Paris.-

More information about the Dnsmasq-discuss mailing list