Hi Michal,

the program looks ok and it compiled and ran on my sparc debian printing
"callback" on each packet (i had to use eth0 as the interface, but it
should not matter).
maybe you could recompile libpcap with your current libc and make certain
that gcc finds the new libpcap, i.e. set LD_LIBRARY_PATH, if necessary?

good luck,

-alexm
13:54 29/09/2005

On Thu, 29 Sep 2005, Michal Kepien wrote:

> Hi all,
>
> I don't know whether this is the right place to post, but unfortunately nobody
> on the usenet was able to help me with this issue. I came across this while
> I was writing a simple libpcap-based program. The problem is, after I call any
> packet capturing function (pcap_next(), pcap_loop() etc.), I'm getting serious
> memory errors after trying to allocate or free some memory - "*** glibc 
> detected
> *** malloc(): memory corruption" or "*** glibc detected *** free(): invalid
> next size (fast)" to name just two. The problem is weird because if I allocate
> or free the memory _before_ calling pcap_next(), pcap_loop() etc., everything
> works fine. I suppose there may be something wrong with my glibc, I'm using
> Slackware 10.1, but I've updated my glibc a couple of times - right now it's
> version 2.3.5-4. However, other programs in my system work just fine and never
> produce such errors, so I suppose it may be the question of my 
> misunderstanding
> of libpcap, bad coding style or whatever else. Here is an example program 
> which
> gives the above mentioned errors on my box:
>
> http://kempniu.no-ip.com/files/glibc_pcap_error.c
>
> It's compiled traditionally with:
>
> $ gcc -o glibc_pcap_error glibc_pcap_error.c -lpcap
>
> For the program to work, you need a ppp0 interface in your system and there 
> has
> to be some network traffic going through it (even 1 packet is good enough
> actually). I'd be grateful if anyone could test it and tell me about the 
> results
> - it would be easier for me to determine the source of those errors. If
> everything's OK, the program should write the text "callback" to stdout each
> time it captures a packet.
>
> Thanks in advance for any kind of support,
> Michal Kepien
> -
> This is the tcpdump-workers list.
> Visit https://lists.sandelman.ca/ to unsubscribe.
>

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.

Reply via email to