Subject: | icmp - ping failure win32 |
Since the checksum() code has been changed in Ping.pm, the icmp packets don't have the good checksum on my win32 machine.
In ping.pm
If i change the
foreach $short (unpack("n$num_short", $msg)) (of version 2.31)
with
foreach $short (unpack("S$num_short", $msg)) or
foreach $short (unpack("v$num_short", $msg))
of older version (e.g.2.20), it works again .....
With the sniffer, I clearly see that the 2 bytes of checksum are swapped.
My perl version :
-------------------------------------------------------------------
This is perl, v5.8.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail)
Copyright 1987-2003, Larry Wall
Binary build 807 provided by ActiveState Corp. http://www.ActiveState.com ActiveState is a division of Sophos.
Built 18:19:11 Nov 3 2003
-------------------------------------------------------------------
As is don't understand which are the system needs (big-endian ....) I would propose the following patch :
......
my $upkstr = "n$num_short";
if ($^O =~ /Win32/i) {
$upkstr = "v$num_short";
}
foreach $short (unpack($upkstr, $msg))
.......
Thanks for this marvellous module, best regards