[Dnsmasq-discuss] Patch: Add --ping-timeout option

Simon Kelley simon at thekelleys.org.uk
Thu May 17 14:05:03 BST 2012

On 17/05/12 13:51, Aaron Opfer wrote:
>> Where in the man page does it say that the default wait is 1.5 seconds?
>>  I can't find that. The code which does the waiting is rather
>> susceptible to rounding errors: by staring at it I think it will wait
>> somewhere between 2 and 3.25 seconds for the default value, but I've not
>> done a live test to verify that.
> I actually can't find that anymore. Its possible I just synthesized the
> "fact" out of thin air. :-)


> My understanding of floating point math might be a bit fuzzy; where
> does that rounding error come from?

Nothing to do with floating point. The loop is basically

start = time();

while (time() - start < PING_WAIT)

where time() returns a integer which increases by one each second.
Depending on is the loop starts just after or just before the time()
value ticks over, and with the extra 250ms end delay, that gives me the

>> Under what circumstances is increasing this time useful? Making it
>> longer has definite downsides, since whilst dnsmasq is waiting for a
>> ping reply, it doesn't handle other DHCP requests. If it's too long this
>> risks other clients timing out. Certainly allowing people the ability to
>> tweak this knob risks that they'll inadvertently break things. At the
>> very least PING_CACHE_TIME needs to be increased in proportion with
> I wasn't aware of this limitation, but I see that comment in the code
> now. I think I'll let someone else restructure dnsmasq to fix that...
> In the meantime putting a more sensible maximum value could be a good
> idea. I think only the slowest clients over the slowest possible link
> could miss the ping reply in the default 3 seconds. Maybe, since we
> have the rounding issues, we could put the maximum at 5 seconds. Even
> so, if dnsmasq ran well all this time with that default, maybe only
> lowering the value from the default should be supported.

You can switch is off entirely, which has sufficed until now for the
cases when the default is no good. This is either 1) many simultaneous
clients or 2) a need reduce delay in getting DHCP leases.
> I'm making tweaks to my patch right now to remedy concerns expressed
> over this list.
> And lastly: can someone inform me of the proper way to use this mailing
> list? My responses appear in new threads instead of underneath the
> person I'm responding to, and I can't figure out why. At least I
> figured out the correct word-wrap width, unfortunately by messing it up
> the first time. This webmail client is pretty much a pain to use, I
> only just now got it to put my full name in the from field.

I think you can blame the webmail client: it doesn't seem to be putting
In-reply-to headers in your messages. For sensible clients it's
automatic: reply to a message and you reply joins the correct thread.



> Aaron Opfer

More information about the Dnsmasq-discuss mailing list