Skip Menu |

This queue is for tickets about the Net-Ping CPAN distribution.

Report information
The Basics
Id: 17408
Status: resolved
Priority: 0/
Queue: Net-Ping

People
Owner: Nobody in particular
Requestors: bergonz [...] labs.it
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.31
Fixed in: (no value)



Subject: Net-Ping 2.31 fails to verify source address
I use Net::Ping 2.31, as downloaded from CPAN, to ping several hosts with ICMP. By the way I use it, I end up with the very same seq number in each packet. Version 2.31 does not verify the source address of the response. This leads me to "phantom" ping, where a device which is switched of and in my drawer sometimes appears to answer, due to previous answers from different hosts. This is frequent when there are large RTTs. The patch I use is a trivial one-liner almost completely taken from a previous version: root@spock:~# diff -c t /usr/lib/perl5/5.8.7/Net/Ping.pm *** t 2006-02-01 10:15:20.000000000 +0100 --- /usr/lib/perl5/5.8.7/Net/Ping.pm 2006-02-01 10:30:49.000000000 +0100 *************** *** 477,482 **** --- 477,483 ---- $self->{"from_type"} = $from_type; $self->{"from_subcode"} = $from_subcode; if (($from_pid == $self->{"pid"}) && # Does the packet check out? + (! $source_verify || (inet_ntoa($from_ip) eq inet_ntoa($ip))) && ($from_seq == $self->{"seq"})) { if ($from_type == ICMP_ECHOREPLY){ $ret = 1; Since I believe this to be the correct behaviour, I humbly suggest that you include it in the next release. Best regards, Bergonz
On Wed Feb 01 04:58:04 2006, guest wrote: Show quoted text
> I use Net::Ping 2.31, as downloaded from CPAN, to ping several hosts > with ICMP. By the way I use it, I end up with the very same seq number > in each packet. > > Version 2.31 does not verify the source address of the response. This > leads me to "phantom" ping, where a device which is switched of and in > my drawer sometimes appears to answer, due to previous answers from > different hosts. This is frequent when there are large RTTs. > > The patch I use is a trivial one-liner almost completely taken from a > previous version: > > root@spock:~# diff -c t /usr/lib/perl5/5.8.7/Net/Ping.pm > *** t 2006-02-01 10:15:20.000000000 +0100 > --- /usr/lib/perl5/5.8.7/Net/Ping.pm 2006-02-01 10:30:49.000000000
+0100 Show quoted text
> *************** > *** 477,482 **** > --- 477,483 ---- > $self->{"from_type"} = $from_type; > $self->{"from_subcode"} = $from_subcode; > if (($from_pid == $self->{"pid"}) && # Does the packet check out? > + (! $source_verify || (inet_ntoa($from_ip) eq
inet_ntoa($ip))) && Show quoted text
> ($from_seq == $self->{"seq"})) { > if ($from_type == ICMP_ECHOREPLY){ > $ret = 1; > > Since I believe this to be the correct behaviour, I humbly suggest that > you include it in the next release. > > Best regards, > Bergonz
Excellent! This appears to solve the problems with using Net::Ping multi-threaded too! Thanks much for this fix which will be in the next release.
On Tue Jul 31 11:37:44 2007, SMPETERS wrote: Show quoted text
> On Wed Feb 01 04:58:04 2006, guest wrote:
> > I use Net::Ping 2.31, as downloaded from CPAN, to ping several hosts > > with ICMP. By the way I use it, I end up with the very same seq number > > in each packet. > > > > Version 2.31 does not verify the source address of the response. This > > leads me to "phantom" ping, where a device which is switched of and in > > my drawer sometimes appears to answer, due to previous answers from > > different hosts. This is frequent when there are large RTTs. > > > > The patch I use is a trivial one-liner almost completely taken from a > > previous version: > > > > root@spock:~# diff -c t /usr/lib/perl5/5.8.7/Net/Ping.pm > > *** t 2006-02-01 10:15:20.000000000 +0100 > > --- /usr/lib/perl5/5.8.7/Net/Ping.pm 2006-02-01 10:30:49.000000000
> +0100
> > *************** > > *** 477,482 **** > > --- 477,483 ---- > > $self->{"from_type"} = $from_type; > > $self->{"from_subcode"} = $from_subcode; > > if (($from_pid == $self->{"pid"}) && # Does the packet check
out? Show quoted text
> > + (! $source_verify || (inet_ntoa($from_ip) eq
> inet_ntoa($ip))) &&
> > ($from_seq == $self->{"seq"})) { > > if ($from_type == ICMP_ECHOREPLY){ > > $ret = 1; > > > > Since I believe this to be the correct behaviour, I humbly suggest that > > you include it in the next release. > > > > Best regards, > > Bergonz
> > > Excellent! This appears to solve the problems with using Net::Ping > multi-threaded too! Thanks much for this fix which will be in the next > release.
This patch was included in version 2.33. Thanks!