tcpdump mailing list archives

Re: Debugging an issue with pcap_compile/pcap_setfilter


From: Adayadil Thomas <adayadil.thomas () gmail com>
Date: Fri, 30 Oct 2009 15:30:16 -0400

The filter I was using is "tcp[13]&7!=0"

Thanks

On Fri, Oct 30, 2009 at 1:50 AM, Gianluca Varenni
<gianluca.varenni () cacetech com> wrote:
What is the value of filter?

GV

----- Original Message ----- From: "Adayadil Thomas"
<adayadil.thomas () gmail com>
To: <tcpdump-workers () lists tcpdump org>
Sent: Thursday, October 29, 2009 8:23 AM
Subject: [tcpdump-workers] Debugging an issue with
pcap_compile/pcap_setfilter


Hi All,

I have a program that uses libpcap to read and analyze packets.
Libpcap version: 0.9.4

The pseudo code of my program looks like this

PacketFunc()
{

  pd = pcap_open_live( ifname, snaplen, 1, 10, errorbuf);
  if ( !pd ) {
      //error out
  }

  if(pcap_compile(pd, &fcode, filter, 1, netmask) < 0)
  {
      //error out
  }

  if(pcap_setfilter(pd, &fcode) < 0)
  {
      //error out
  }

  if(pcap_loop(pd, -1, (pcap_handler) analyze, (u_char *)&args) < 0) {
    //error out
  }

}



I get a seg fault with the following dump -


Program terminated with signal 11, Segmentation fault.
[New process 9556]
[New process 9555]
[New process 9551]
#0 0xb761807c in ?? ()
(gdb) bt
#0 0xb761807c in ?? ()
#1 0xb7fb308a in _dl_signal_error () from /lib/ld-linux.so.2
#2 0xb7fb313a in _dl_signal_cerror () from /lib/ld-linux.so.2
#3 0xb7faf3ee in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
#4 0xb7fb2cc8 in _dl_fixup () from /lib/ld-linux.so.2
#5 0xb7fb84d0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
#6 0xb7f7da78 in pcap_compile () from /usr/lib/libpcap.so.0.9.4
#7 0x0804bbe5 in PacketFunc (t_id=0x1) at program.c:959
#8 0xb7f6449b in start_thread () from /lib/libpthread.so.0
#9 0xb7eec42e in clone () from /lib/libc.so.6

The following message was found in log file :

symbol lookup error: /usr/lib/libpcap.so.0.9.4: undefined symbol:
lex_cleanup



Any ideas or pointers to what the issue may be?

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

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

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


Current thread: