[Dnsmasq-discuss] Dnsmasq with Gigantic hosts file

Preston Crow pc-dnsmasq at crowcastle.net
Sun Jan 22 01:12:22 GMT 2012


On 01/11/12 10:09, Simon Kelley wrote:
> Try commenting out the code around line 650 in cache.c which starts with
> a big comment block explaining the tweak I mention above, starting
>
> /* Ensure there is only one address -> name mapping (first one trumps)
>
> If goes fast then I've guessed right. Assuming I have, there are various
> solutions: add hashing for by-adddress cache lookups, stipulate that big
> hostfiles should be sorted by address so that we can rely on the
> adjacent-line test without falling back to the slow exhaustive search,
> abandon the "first-appearance-of-address is used for reverse lookups"
> semantics, declare it a non-problem.
>
> We can argue about that once we know it's the correct issue.

Yup, that causes my hosts file to be read instantly.

I attached the patch that I applied.  I left the check verses the 
previous entry intact.

In my case, this is perfect, as I clean up the hosts file from NIS a bit 
with a script (it's a mess), then sort it.  So one approach would be to 
remove that code, and add a sort of the hosts file before processing it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dnsmasq259_no_dup_ip_check.bin
Type: application/octet-stream
Size: 439 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20120121/3219a819/attachment.bin>


More information about the Dnsmasq-discuss mailing list