tcpdump mailing list archives

Re: pcap_setdirection not working anymore?


From: Doktor Bernd <doktorbernd () hotmail com>
Date: Wed, 20 Oct 2010 15:31:32 +0000


Ok, my problem is solved.

The libpcap from Ubuntu (version 1.0. something) was interfering with my self compiled libpcap 1.1.1.
Now I have removed the Ubuntu compiled version and everything is fine.
So I think pcap_setdirection is not working in the Ubuntu packaged version, but compiling my own package is fine for me.

Bernd

From: doktorbernd () hotmail com
To: tcpdump-workers () lists tcpdump org
Subject: Re: [tcpdump-workers] pcap_setdirection not working anymore?
Date: Tue, 19 Oct 2010 14:00:13 +0000


Hi again,

I noticed that for pcap_setdirection HAVE_PF_PACKET_SOCKETS must be defined. But it is not defined for my build.
What do I need for HAVE_PF_PACKET_SOCKETS to be defined when I compile libpcap on my own?

Bernd


From: doktorbernd () hotmail com
To: tcpdump-workers () lists tcpdump org
Subject: [tcpdump-workers] pcap_setdirection not working anymore?
Date: Tue, 19 Oct 2010 12:46:54 +0000


Hi,

I have a software that captures packets from an interface and also injects packets on the same interface.
When I wrote the software I was using Ubuntu 8.10 with pcap 0.9 something.
Today I wanted to use it again and tried to run it on Ubuntu 10.04 with pcap 1.1.1, but the software now captures 
the injected packets.

This is my statement for setting the capture direction, which seem to get executed without error.

    #ifdef __LINUX__
    //capture direction is not available on windows
    if(pcap_setdirection(sniffhandle, PCAP_D_IN)==-1)
    {
        std::strcpy(errormessage, pcap_geterr(sniffhandle));
        throw std::runtime_error(getErrormessage().c_str());
    }
    #endif

To check what happens I print a CRC for each captured and injected packet which e.g. results in:

Captured CRC: 3a112bb
Injected CRC: 3a112bb
Captured CRC: 3a112bb
Injected CRC: 3a112bb
Captured CRC: 3a112bb
Captured CRC: 3a112bb
Injected CRC: 3a112bb
Captured CRC: 3a112bb
Injected CRC: 3a112bb
Captured CRC: 3a112bb
...

So the software captures its own packets and gets stuck in a loop.

Has there been a change to this part of pcap?
How can I prevent the software from capturing its own packets? (using filter rules will not work in my case, 
because the packets look all the same)

Thanks for reading,
Bernd
                                      -
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: