Reply To: newbie question

Home Forums Discussions Support Portal newbie question Reply To: newbie question


Vadim Smirnov

Can I use Winpkfltr to look at the ip header and make a decision on to drop/forward the packet?

Yes. You can take PassThru sample as a base. If you decide to drop the packet just don’t reinject it into the stack (by calling SendPacketToAdapter or SendPacketToMstcp).

This function should be able to drop or forward the packet based on some criteria. But here is the problem:
I dont want to drop all packets going to certain ip and port. For the same ip and port, I only want to drop say 10% of the packets and for some other ip/port, drop 20% of the packets.

You can use kind of random generator, like C run time rand() routine.

An example, 20% chance of drop may look like:
if (rand() < RAND_MAX/5) bDrop = TRUE;