Skip Menu |

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

Report information
The Basics
Id: 30745
Status: resolved
Priority: 0/
Queue: Net-Pcap

People
Owner: Nobody in particular
Requestors: derhoermi [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.15



Subject: Test failures on Win32
Date: Thu, 15 Nov 2007 02:39:40 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
Hi, I tried installing the latest Net::Pcap on Win2k3 with WinPcap 4.x and ran into two problems. First, the distribution depends on IO::Interface which does not seem to be available for Win32 (it's only used for the pcapinfo utility so I removed the dependency) and after a successful build it generates many test failures. I've attached those. regards, -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Thu, 15 Nov 2007 04:51:36 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> I tried installing the latest Net::Pcap on Win2k3 with WinPcap > 4.x and > ran into two problems. First, the distribution depends on > IO::Interface > which does not seem to be available for Win32 (it's only used for the > pcapinfo utility so I removed the dependency)
I didn't know IO::Interface wasn't available under Win32. I'll modify Makefile.PL to not install pcapinfo and remove IO::Interface from the prereqs. Show quoted text
> after a successful build it generates many test failures. I've > attached those. > > [...] > # Failed test ' - '\' must be present in the list returned by > findalldevs()' > # in t/02-lookup.t at line 135. > # got: undef > # expected: '1'
This is probably because the interfaces are incorrectly listed for some reason. Could you give me the output of the following commands: perl -wTIblib/lib -Iblib/arch -It -MNet::Pcap -MUtils -le "print join$/,find_network_device()" perl -MNet::Pcap=:functions -le "print join$/,findalldevs(\$err)" ipconfig /all You can hide the IP addresses if you want, what interest me here is the list of interface names. Show quoted text
> t/12-next...........dubious > Test returned status 42 (wstat 10752, 0x2a00) > DIED. FAILED tests 5-16, 18-19, 21-32, 34-35, 37-48, 50-51 > Failed 42/52 tests, 19.23% okay
Hmm, in fact, this test script should be skipped. It's a mistake on my part that it is enabled in the CPAN release. This test script is probably trying to check some of the areas of Net::Pcap where problems may come from bugs in libpcap/WinPcap or from the XS interface. Usually, they can be ignored, especially if the rest of the test suite passes. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Thu, 15 Nov 2007 05:49:31 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>I didn't know IO::Interface wasn't available under Win32. I'll modify >Makefile.PL to not install pcapinfo and remove IO::Interface from the >prereqs.
That is at least my impression, the .xs includes several header files like sys/socket.h, sys/types.h, and sys/ioctl.h which are not part of the Microsoft Platform SDK; it might well build on Cygwin or MingW. Show quoted text
>This is probably because the interfaces are incorrectly listed for >some reason. Could you give me the output of the following commands:
  % perl -wTIblib/lib -Iblib/arch -It -MNet::Pcap -MUtils -le "print join$/,find_network_device()"   \Device\NPF_{C55C9B9E-E5C7-4E87-93C5-733328A284C4}   \Device\NPF_{D91F18B8-42F5-4504-A60F-85ECA2A76275}     % perl -MNet::Pcap=:functions -le "print join$/,findalldevs(\$err)"   \Device\NPF_GenericDialupAdapter   \Device\NPF_{C55C9B9E-E5C7-4E87-93C5-733328A284C4}   \Device\NPF_{D91F18B8-42F5-4504-A60F-85ECA2A76275} The only adapter with TCP/IP bindings is a Microsoft Loopback one, which is called "Ethernet-Adapter LAN-Verbindung 2" which is all `ipconfig /all` would say (this is a german version of Win2k3 btw) unless I misunderstood you. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Mon, 19 Nov 2007 02:15:59 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
>> This is probably because the interfaces are incorrectly listed for >> some reason. Could you give me the output of the following commands:
> > % perl -wTIblib/lib -Iblib/arch -It -MNet::Pcap -MUtils -le > "print join$/,find_network_device()" > \Device\NPF_{C55C9B9E-E5C7-4E87-93C5-733328A284C4} > \Device\NPF_{D91F18B8-42F5-4504-A60F-85ECA2A76275} > > % perl -MNet::Pcap=:functions -le "print join$/,findalldevs(\$err)" > \Device\NPF_GenericDialupAdapter > \Device\NPF_{C55C9B9E-E5C7-4E87-93C5-733328A284C4} > \Device\NPF_{D91F18B8-42F5-4504-A60F-85ECA2A76275} > > The only adapter with TCP/IP bindings is a Microsoft Loopback one, > which is called "Ethernet-Adapter LAN-Verbindung 2" which is all > `ipconfig /all` would say (this is a german version of Win2k3 btw) > unless I misunderstood you.
Ok, it seems that findalldevs() and find_network_device() work as expected. So I guess this is lookupdev() which may return an invalid name. Could you give me the output of the following command: perl -MNet::Pcap=:functions -le "print lookupdev(\$err),$/,qq/err= $err/" -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Mon, 19 Nov 2007 04:32:58 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>Ok, it seems that findalldevs() and find_network_device() work as >expected. So I guess this is lookupdev() which may return an invalid >name. Could you give me the output of the following command: > > perl -MNet::Pcap=:functions -le "print lookupdev(\$err),$/,qq/err= >$err/"
  % perl -MNet::Pcap=:functions -le "print lookupdev(\$err),$/,qq/err=$err/"   \   err= -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 08:32:14 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> Sébastien Aperghis-Tramoni wrote:
>> Ok, it seems that findalldevs() and find_network_device() work as >> expected. So I guess this is lookupdev() which may return an invalid >> name. Could you give me the output of the following command: >> >> perl -MNet::Pcap=:functions -le "print lookupdev(\$err),$/,qq/err= >> $err/"
> > % perl -MNet::Pcap=:functions -le "print lookupdev(\$err),$/,qq/ > err=$err/" > \ > err=
As expected. Now we must check whether the bug is in Net::Pcap or in libpcap. I think it's probably in the WinPcap specific part of the XS function pcap_lookupdev(), but I'd like to be sure. Could you compile the following C code, execute it and give me its output? --- file: lookupdev.c ------ #include <stdio.h> #include <pcap.h> int main(void) { char err[PCAP_ERRBUF_SIZE]; char *dev; dev = pcap_lookupdev(err); printf("dev(%s) err(%s)\n", dev, err); return 0; } ---------------------------- -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 08:47:57 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>As expected. Now we must check whether the bug is in Net::Pcap or in >libpcap. I think it's probably in the WinPcap specific part of the XS >function pcap_lookupdev(), but I'd like to be sure. Could you compile >the following C code, execute it and give me its output? > >--- file: lookupdev.c ------ >#include <stdio.h> >#include <pcap.h> > >int main(void) { > char err[PCAP_ERRBUF_SIZE]; > char *dev; > > dev = pcap_lookupdev(err); > printf("dev(%s) err(%s)\n", dev, err); > > return 0; >} >----------------------------
If I also initialize the err, this prints   % lookupdev   dev(\) err() Otherwise it would print random memory. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 09:34:41 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> Sébastien Aperghis-Tramoni wrote:
>> As expected. Now we must check whether the bug is in Net::Pcap or in >> libpcap. I think it's probably in the WinPcap specific part of the XS >> function pcap_lookupdev(), but I'd like to be sure. Could you compile >> the following C code, execute it and give me its output?
> > If I also initialize the err, this prints > > % lookupdev > dev(\) err() > > Otherwise it would print random memory.
Ah right. But now I realise that the include should have been wpcap.h and not pcap.h. Did you change it or did the pcap.h include work? Anyway, this should mean that the problem is in WinPcap and not in Net::Pcap. They don't seem to have a bug tracker so I guess you should subscribe to the mailing list and report the bug here. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 09:41:22 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>Ah right. But now I realise that the include should have been wpcap.h >and not pcap.h. Did you change it or did the pcap.h include work?
No, there is no wpcap.h, only pcap.h. Show quoted text
>Anyway, this should mean that the problem is in WinPcap and not in >Net::Pcap. They don't seem to have a bug tracker so I guess you >should subscribe to the mailing list and report the bug here.
If you could tell me what you think the bug in WinPcap is? -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 12:07:20 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> Sébastien Aperghis-Tramoni via RT wrote:
> > Ah right. But now I realise that the include should have been wpcap.h > > and not pcap.h. Did you change it or did the pcap.h include work?
> > No, there is no wpcap.h, only pcap.h.
Oh right, pcap.h is still pcap.h in WinPcap. It's libpcap.so which is renamed to wpcap.dll Show quoted text
> > Anyway, this should mean that the problem is in WinPcap and not in > > Net::Pcap. They don't seem to have a bug tracker so I guess you > > should subscribe to the mailing list and report the bug here.
> > If you could tell me what you think the bug in WinPcap is?
Well, pcap_lookupdev() returns "\" on your system, where it should return one the devices given by pcap_findalldevs(), the ones named \Device\NPF_* -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 12:28:38 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>Well, pcap_lookupdev() returns "\" on your system, where it should return >one the devices given by pcap_findalldevs(), the ones named \Device\NPF_*
Okay http://www.winpcap.org/pipermail/winpcap-bugs/2006-May/000220.html says the function returns a wide string with all adapters rather than a normal string with only one device. I also take it this is not going to be changed in WinPcap. Perhaps the function should then be unavailable on Win32? A note in the Net::Pcap documentation about this problem would be nice. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 14:51:12 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> Sébastien Aperghis-Tramoni via RT wrote:
> > Well, pcap_lookupdev() returns "\" on your system, where it should return > > one the devices given by pcap_findalldevs(), the ones named \Device\NPF_*
> > Okay http://www.winpcap.org/pipermail/winpcap-bugs/2006-May/000220.html > says the function returns a wide string with all adapters rather than a > normal string with only one device.
Ok, this is returning a UCS-2 multistring. Very evil. Show quoted text
> I also take it this is not going to > be changed in WinPcap. Perhaps the function should then be unavailable > on Win32? A note in the Net::Pcap documentation about this problem would > be nice.
The strange thing is that there's already code in the XS to handle this: char * pcap_lookupdev(err) [...] #ifdef _WPCAP { int length = lstrlenW((PWSTR)RETVAL) + 2; char *r = safemalloc(length); /* Conversion from Unicode to ANSI */ WideCharToMultiByte(CP_ACP, 0, (PWSTR)RETVAL, -1, r, length, NULL, NULL); lstrcpyA(RETVAL, r); safefree(r); } #endif [...] This code is here since version 0.08, released in october 2005. Maybe the problem is that _WPCAP is not defined.. Hmm.. looking at the Makefile.PL, it seems the macro is defined as "WPCAP" here, and "_WPCAP" in Pcap.xs. This is ungood. Could you give me a capture of your screen when you compile the module (perl Makefile.PL && make) in order to confirm? -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Tue, 20 Nov 2007 15:25:31 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Bjoern Hoehrmann <derhoermi [...] gmx.net>
* Sébastien Aperghis-Tramoni via RT wrote: Show quoted text
>The strange thing is that there's already code in the XS to handle this: > >char * >pcap_lookupdev(err) >[...] >#ifdef _WPCAP > { > int length = lstrlenW((PWSTR)RETVAL) + 2; > char *r = safemalloc(length); /* Conversion from Unicode to ANSI */ > WideCharToMultiByte(CP_ACP, 0, (PWSTR)RETVAL, -1, r, length, NULL, NULL); > lstrcpyA(RETVAL, r); > safefree(r); > } >#endif >[...] > >This code is here since version 0.08, released in october 2005. > >Maybe the problem is that _WPCAP is not defined.. Hmm.. looking at the >Makefile.PL, it seems the macro is defined as "WPCAP" here, and "_WPCAP" >in Pcap.xs. This is ungood. Could you give me a capture of your screen >when you compile the module (perl Makefile.PL && make) in order to confirm?
I added -D_WPCAP to the CFLAGS in the Makefile.PL and it now passes all the tests (not the 12-next ones, and some still unexpectedly succeed) so that indeed seems to be the problem. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Subject: Re: [rt.cpan.org #30745] Test failures on Win32
Date: Fri, 23 Nov 2007 09:03:22 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Bjoern Hoehrmann wrote: Show quoted text
> I added -D_WPCAP to the CFLAGS in the Makefile.PL and it now passes > all > the tests (not the 12-next ones, and some still unexpectedly > succeed) so > that indeed seems to be the problem.
Ok, I've committed a fix in SVN. Thanks for your testing. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.