tcpdump mailing list archives

pcap_setdirection not working anymore?


From: Doktor Bernd <doktorbernd () hotmail com>
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.


Current thread: