newbie question

Home Forums Discussions Support Portal newbie question

This topic contains 1 reply, has 2 voices, and was last updated by  Vadim Smirnov 11 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4966

    dalgin
    Participant

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

    Basically I would like to have a function:
    int drop_forward(sourceip, sourceport, destip, destport);

    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.

    Can I achieve this using winpkfilter?

    IF so, can you give me some hints?

    Thank you very much.

    #5864

    Vadim Smirnov
    Moderator

    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;

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.