Hello everyone and thanks in advance for the help,
I am using the WriteFile function (fileapi.h) to send frames to the NDIS driver at Ethernet Layer 2 level, directly between MAC addresses.
The frames are sent correctly, but in any of the tests I did, the frames are sent duplicated. I detected this by capturing the output with WireShark, where the following is represented:
Within the frame I send, I increment a counter on each send. This counter is repeated in two consecutive frames, which have different frame numbers assigned by WireShark. This is not something that happens randomly due to the loss of messages in the network, and the forwarding of messages by another device in the network. It happens on every frame that is sent, they are exactly the same, including the counter which is incremented every two frames.
Questions:
I saw this post, and did as recommended by uninstalling and installing Ncap and WinCap, but it made no difference.
Thank you very much. Best regards.
bSuccess = (BOOLEAN)WriteFile(
Handle,
pWriteBuf,
PacketLength,
&BytesWritten,
NULL);
DWORD err = GetLastError();
printf("ERROR: %i", err);
if (!bSuccess)
{
PRINTF(("DoWriteProc: WriteFile failed on Handle %p\n", Handle));
break;
}
Solved, I answer to my question.
The compilation of the NDIS driver that I am using, comes prepared with the NDIS_SEND_FLAGS_CHECK_FOR_LOOPBACK
flag in the send.c
file.
For this reason, and following the explanations of this page, it is possible to cancel the duplicated messages in the computer of origin, since in the computer of destiny, finally these did not arrive to be an internal loop.
Best regards.