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