NoCaptureLocal not working

Oct 10, 2012 at 12:29 PM
Edited Oct 10, 2012 at 12:30 PM

Hello,

I have got an assigment in school - to create software switch on two NICs. I have simple code, that receives packet on one interface and sends it to other one. But I have problem with receiving my own generated traffic, resulting in packet loops,... I amo pening devices with Promiscous and NoCaptureLocal flags. But it is ignoring the NoCaptureLocal flag.

 

there are other techniques to solve this (drop first packed after sendind one on the same interface, or checking content,...), but I would like to make it as simple as possible.

any hints? thanks

Tested on .NET 3.5, Pcap.NET 0.6 and .NET 4.0, Pcap.NET 0.10

 

Regards,

Ondrej Galbavy

Coordinator
Oct 12, 2012 at 7:09 AM

Can you write some code?

Note that NoCaptureLocal flag means that only the PacketCommunicator opened with this flag will ignore packets sent with it.

It will not affect any other PacketCommunicators.

Oct 12, 2012 at 8:43 AM
Edited Oct 12, 2012 at 9:18 AM

Thanks for the note. I have two instances of some class that opens
PacketCommunicator for both interfaces. OnPacket handler sends the
packet to the other interface. One instance works one way, so the
second one gets swaped interfaces. So I have two PacketComms for each
interface and as NoCaptureLocal works only for specific instance, it
is no use.

I will rework my hub prototype and report back.

Can you tell me, how NoCaptureLocal works internally? it compares last
sent packet, or some flag from interface? If I use NoCaptureLocal , I
should note in documentation other ways of dealing with own generated
traffic.

Thank you again.

Coordinator
Oct 13, 2012 at 8:50 AM

It basically wrap WinPcap feature.

See http://www.winpcap.org/docs/docs_412/html/group__remote__open__flags.html#ga337712d5c8d26a0d984d6bb702d0118d

Oct 18, 2012 at 9:23 AM

Thank you

Single PacketCommunicator per interface worked well. I've got working two port switch now.