Skip Menu |

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

Report information
The Basics
Id: 24143
Status: open
Priority: 0/
Queue: Net-Pcap

People
Owner: SAPER [...] cpan.org
Requestors: alex-cpan [...] digriz.org.uk
Cc:
AdminCc:

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



Subject: next_ex woes
Date: Fri, 29 Dec 2006 18:09:57 +0000
To: bug-Net-Pcap [...] rt.cpan.org
From: Alexander Clouter <alex-cpan [...] digriz.org.uk>
Hi, I am running into a problem using Net::Pcap::next_ex() not returning the actual packet payload. I have stared at the sourcecode with no success to see if I can fix it myself but not knowing a thing about Perl XS I unsurprisingly did not get too far :) I have attached an example script, which might show if I am doing something wrong, and implemented what the manpage tells me to do. %header is correctly populated and if I extend the header by adding: hv_store(hv, "data", strlen("data"), newSVpv(data, header->caplen), 0); I get the correct payload accessible perfectly. Its bizarre to me why pkt_data seem to be undefined when using the 'traditional' route. Throwing in a couple of printf's/SvPV_nolen()'s after its been set tell me pkt_data is empty. :-/ I am using libpcap0.8(-dev) {Debian 'unstable' package version 0.9.5-1}[1] and have tried Net::Pcap version 0.14 and 0.15_01. I have also tried both: * gcc version 3.4.6 (Debian 3.4.6-4) * gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) In addition I cannot get next_ex() to timeout (with a $ret==0) after no packet activity, but that's another bug I'll report later. :) Any ideas? Cheers Alex [1] as libpcap0.7 does not support next_ex, or so it tells me in the pcap manpage -- Show quoted text
________________________________________ / May you have warm words on a cold \ | evening, a full mooon on a dark night, | | and a smooth road all the way to your | \ door. / ---------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

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

Subject: Re: [rt.cpan.org #24143] next_ex woes
Date: Mon, 22 Jan 2007 00:16:39 +0100
To: bug-Net-Pcap [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Show quoted text
> Hi,
Hello, Sorry for the long delay before answering. Show quoted text
> I am running into a problem using Net::Pcap::next_ex() not > returning the > actual packet payload. I have stared at the sourcecode with no > success to > see if I can fix it myself but not knowing a thing about Perl XS I > unsurprisingly did not get too far :)
The funny thing is, I barely understand XS as well :-) Show quoted text
> I have attached an example script, which might show if I am doing > something > wrong, and implemented what the manpage tells me to do.
Using your script, I can confirm the problem on Linux x86 and OSX PowerPC. Show quoted text
> %header is correctly populated and if I extend the header by adding: > > hv_store(hv, "data", strlen("data"), newSVpv(data, header->caplen), > 0); > > I get the correct payload accessible perfectly. Its bizarre to me why > pkt_data seem to be undefined when using the 'traditional' route.
I confirm this as well, but I have no idea of the reason why this is happening. I'll probably ask on the Perl XS mailing list for some help. Show quoted text
> Throwing in a couple of printf's/SvPV_nolen()'s after its been set > tell me > pkt_data is empty. :-/ > > I am using libpcap0.8(-dev) {Debian 'unstable' package version > 0.9.5-1}[1] > and have tried Net::Pcap version 0.14 and 0.15_01. I have also > tried both: > * gcc version 3.4.6 (Debian 3.4.6-4) > * gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) > > In addition I cannot get next_ex() to timeout (with a $ret==0) > after no > packet activity, but that's another bug I'll report later. :)
I can't reproduce this bug. Printing time() before and after the next_ex() call, and with no network traffic, I have the following output: $ make && sudo perl -Mblib rt-24143.pl time: 1169418558 time: 1169418559 $VAR1 = 0; $VAR1 = undef; $VAR1 = {}; which looks like the 1000 ms timeout is working. On both OSX and Linux. Show quoted text
> [1] as libpcap0.7 does not support next_ex, or so it tells me in > the pcap manpage
Welcome in the pcap hell: the Unix versions doesn't provide all the functions that the Windows version does, and there wasn't a pcap_lib_version() function before 0.8... But to answer your question, no, pcap_next_ex() seems to be one of the functions that were added in 0.8.x. 0.9.x seems to have at least the pcap_sendpacket() functions and similar. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.