develooper Front page | perl.perl5.porters | Postings from April 2003

Re: Net::Ping 2.29 udp ping test

Thread Previous
Rob Brown
April 17, 2003 15:39
Re: Net::Ping 2.29 udp ping test
Message ID:

Sorry about that.  There was a bug in the select
code of ping_udp (as well as ping_icmp) which
didn't consider that select actually modifies
its parameters:

355:    $rbits = "";
356:    vec($rbits, $self->{"fh"}->fileno(), 1) = 1;
357:    $ret = 0;                   # Default to unreachable
358:    $done = 0;
359:    $finish_time = time() + $timeout;       # Ping needs to be done by then
360:    while (!$done && $timeout > 0)
361:    {
362:        $nfound = select($rbits, undef, undef, $timeout); # Wait for response
363:        $timeout = $finish_time - time();   # Get remaining time

The while loop is pointless since the $rbits is
trashed to "" after the first select() call.

FYI: This bug has been there for a while
(since Net::Ping 2.02 - Sep 1996 and probably
longer).  I guess that Russell Mosemann guy
never tested it once.  (Or if he got the code
from someone else.)  But when I finally added
a test to the suite (version 2.29), I assumed
it would just work, but instead I expose the
bug.  Oh well, it's better to expose the bug
than to bury it for noone to find.  No use
trying to figure out who to blame.  So I just
fixed it.  Try 2.30:

cvs -z3 -q -d checkout Net-Ping
cd Net-Ping
perl Makefile.PL
make test
make dist

or download tarball

Let me know if it's okay on Cygwin.


Make sure it's okay on your box too:
i686-linux-thread-multi-64int-ld 2.4.20-gentoo-r1

I'll PAUSE the new version if it's okay.

Thank you,


On Thu, 17 Apr 2003, Jarkko Hietaniemi wrote:

> The Net::Ping 2.29 and the 510_udp_ping subtest #2 isn't happy in my
> Cygwin (1.3.22(0.7832)) setup.  The test just fails, with no extra
> information.  The box is definitely networked and networking, it's
> just that the udp ping to isn't working.  If I add
> 	print "# $!\n";
> after the failing test I get
> # Connection reset by peer

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About