Unit test fails since version 0.999 or windows intel driver duplicates packets
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.6k
- Forks
- 592
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Sending packets with pcap_sendqueue_transmit lead to that on receive these packets with pcap_dispatch the packets are duplicated (default case) or not received at all. The result depends on set value by PacketSetLoopbackBehavior. The issue starts at commit a25b79c28ba7d09bab871b5a0b98909a0085ddaa Emulate WinPcap behavior regarding looped-back packets.
To Reproduce
Running unit test of
https://github.com/klaus0x7c4/Pcap.Net/blob/8b61736a4483a08cf88fd66c7e24826e5610bdd0/PcapDotNet/src/PcapDotNet.Core.Test/PacketSendBufferTests.cs#L19
In case the test is too big, shorten the test just to TestTransmitQueueToLive(10, 60, 0.5, false);.
In case you open wireshark on the adapter, you will see also duplicate packets.
Probably does the unit test of original Pcap.Net also work, but this project is plain C#, the original not.
Expected behavior
loopback Packets are only received once.
Diagnostic information
Windows version from winver Windows 11 Version 22H2, OS Build 22621.2715
Other infos
Just the adding of SendFlags |= NDIS_SEND_FLAGS_CHECK_FOR_LOOPBACK; from a25b79c28ba7d09bab871b5a0b98909a0085ddaa lead to this error.
Wireshark on this PC receives the packet also twice, but checking the other end of the cable via wireshark shows just unique packets.
On a fresh installed Virtual machine Win 10 22H2 / Win 11 22H2 build 22621.1702 / Win 11 22H2 build 22621.4112/ Win11 23H2 the test passes.
After test on multiple PCs with difference network adapter from different vendors, I can say it happens only on intel network drivers, realtek is not affected.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PcapDotNet/src/PcapDotNet.Core.Test/PacketSendBufferTests.cs, especially TestTransmitQueueToLive, and trace pcap_sendqueue_transmit with PacketSetLoopbackBehavior. Compare the behavior introduced by commit a25b79c28ba7d09aa and the SendFlags change on Intel drivers; done means loopback packets are received exactly once without breaking the existing test on supported adapters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, operating-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100