[smokeping-users] non-uniqe DNS IDs with SmokePing and AnotherDNS

Niko Tyni ntyni+smokeping-users at mappi.helsinki.fi
Wed Oct 24 19:47:31 CEST 2012

On Wed, Oct 24, 2012 at 07:07:18PM +0200, Gert Doering wrote:
> Specifically, every DNS probe SmokePing sends carries the very same
> Query ID - which it shouldn't do from a DNS PoV, but even from staring
> at the code involved, this should not happen (I have traces from various
> versions of SmokePing and perl on FreeBSD and Linux that show this, so 
> I claim it's not my local installation that is borked).

I think I see the problem. The main SmokePing process forks the probe
subprocesses, which first call srand() in Smokeping::make_kid() to
initialize the random number generator.  The AnotherDNS probe then
starts one subprocess for each ping, but all of those inherit the state
of the RNG.

Does the attached (untested) patch fix it for you? 

% perl -le 'srand; fork; print "pid $$ => " . rand()'
pid 5039 => 0.712492274426953
pid 5040 => 0.712492274426953

% perl -le 'fork; srand; print "pid $$ => " . rand()'
pid 5250 => 0.967728406264545
pid 5251 => 0.62419137808411

Niko Tyni   ntyni at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Reseed-the-random-number-generator-for-each-pinger-p.patch
Type: text/x-diff
Size: 1230 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20121024/2fd7a8a5/attachment.patch 

More information about the smokeping-users mailing list