[Dnsmasq-discuss] Why is dnsmasq handing out the same IP to different MACs?

richardvoigt at gmail.com richardvoigt at gmail.com
Mon Apr 12 21:46:25 BST 2010


> for (j = 0, i = 0; i < hw_len; i++)
>    j += i * hwaddr[i] + (hwaddr[i] << 8) + (hwaddr[i] << 16);

Now i == 0 has no contribution whatsoever to the low bits of j.

Maybe

for (j = 0, i = 0; i < hw_len; i++)
   j += i * hwaddr[i] + (hwaddr[i] << i) + (hwaddr[i] << 16);

But since Paul has the test environment that reproduces the problem,
it's really up to him to evaluate different methods.

But I really think the "hash didn't find a free address" case is the
most promising.  Is there a rand() function available on all dnsmasq
platforms?  Starting the linear search from a random location in the
pool instead of from the MAC-hash-associated address should avoid the
ugly corner case of multi-way hash collision.



More information about the Dnsmasq-discuss mailing list