Skip Menu |

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

Report information
The Basics
Id: 5269
Status: stalled
Priority: 0/
Queue: Net-Ping

People
Owner: Nobody in particular
Requestors: philippe.simonet [...] swisscom.com
Cc:
AdminCc:

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



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
On Mon Feb 09 07:08:15 2004, guest wrote: Show quoted text
> 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
I looked again at this code. The checksum must really be calculated in the network ordered 16bit short ints. As done in the module. Wonder what caught your error then, but now it works on Windows. Maybe an older Windows had a wrong network stack (which is unlikely, they just took it from BSD). -- Reini Urban