All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Nychis <gnychis@cmu.edu>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Subject: want to randomly drop packets based on percent
Date: Mon, 17 Apr 2006 03:38:33 -0400	[thread overview]
Message-ID: <444345F9.4090100@cmu.edu> (raw)

Hey,

I'm using the 2.4.32 kernel with madwifi and iproute2 version 
2-2.6.16-060323.tar.gz

I wanted to insert artificial packet loss based on a percent so i found:
network emulab qdisc could do it, so i compiled support into the kernel 
and tried:
tc qdisc change dev eth0 root netem loss .1%

however i keep getting the error
RTNETLINK answer: Invalid argument

I am not sure how to go about solving this problem for now, so if anyone 
has any suggestions i'd greatly appreciate it.

I really only need to drop random packets being forwarded through 
ip_forward ... however randomly dropping any packet based on a % is 
sufficient so I figured netem would be great.

So in the meantime I figured I would try to insert packet loss in 
ip_forward.c by generating a random number and dropping based on that. 
I could goto drop; depending on the number in the function int 
ip_forward(struct sk_buff *skb)

But then I ran into the problem of properly seeding the random number 
generator... srand(time(0)) is one way... however time() returns 
seconds, therefore i would drop multiple packets in a single second if I 
used this method which is very undesirable.  What is the proper way to 
generate a random number here?

Thanks!
George

             reply	other threads:[~2006-04-17  7:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17  7:38 George Nychis [this message]
2006-04-17 14:21 ` want to randomly drop packets based on percent Jan Engelhardt
2006-04-17 16:19 ` Stephen Hemminger
2006-04-17 22:30   ` George Nychis
2006-04-17 16:46     ` Stephen Hemminger
2006-04-17 17:05       ` George Nychis
2006-04-17 17:32         ` Stephen Hemminger
2006-04-17 23:04           ` George Nychis
2006-04-17 23:08           ` George Nychis
     [not found] <62wv1-U5-1@gated-at.bofh.it>
2006-04-17 10:45 ` Bodo Eggert
2006-04-17 10:45   ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444345F9.4090100@cmu.edu \
    --to=gnychis@cmu.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.