* want to randomly drop packets based on percent
@ 2006-04-17 7:38 George Nychis
2006-04-17 14:21 ` Jan Engelhardt
2006-04-17 16:19 ` Stephen Hemminger
0 siblings, 2 replies; 10+ messages in thread
From: George Nychis @ 2006-04-17 7:38 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 7:38 want to randomly drop packets based on percent George Nychis
@ 2006-04-17 14:21 ` Jan Engelhardt
2006-04-17 16:19 ` Stephen Hemminger
1 sibling, 0 replies; 10+ messages in thread
From: Jan Engelhardt @ 2006-04-17 14:21 UTC (permalink / raw)
To: George Nychis; +Cc: linux-kernel, netdev
>
> 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%
You could just use the 'random' match module from netfilter/POMng, but I
doubt it will compile out-of-the-box on 2.4.32. It would then be as simple
as
iptables -t mangle -I PREROUTING -m random --average 1 -j DROP
> 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.
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 7:38 want to randomly drop packets based on percent George Nychis
2006-04-17 14:21 ` Jan Engelhardt
@ 2006-04-17 16:19 ` Stephen Hemminger
2006-04-17 22:30 ` George Nychis
1 sibling, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2006-04-17 16:19 UTC (permalink / raw)
To: George Nychis; +Cc: linux-kernel, netdev
On Mon, 17 Apr 2006 03:38:33 -0400
George Nychis <gnychis@cmu.edu> wrote:
> 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%
Most likely, you the version of the kernel you are running was not
configured with netem enabled.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 16:19 ` Stephen Hemminger
@ 2006-04-17 22:30 ` George Nychis
2006-04-17 16:46 ` Stephen Hemminger
0 siblings, 1 reply; 10+ messages in thread
From: George Nychis @ 2006-04-17 22:30 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-kernel, netdev, matt.keenan
Stephen Hemminger wrote:
>On Mon, 17 Apr 2006 03:38:33 -0400
>George Nychis <gnychis@cmu.edu> wrote:
>
>
>
>>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%
>>
>>
>
>Most likely, you the version of the kernel you are running was not
>configured with netem enabled.
>
>
>
Hey Stephen,
I have netem enabled in the kernel... I've checked this numerous times.
I enabled it under Networking Options -> QoS -> Network emulator. I
even did a make clean, make mrproper, and rebuilt from scratch.
Maybe I'll try compiling it as a module and see if anything changes.
Any other ideas?
----
In response to Matt:
Thank you!
One last question, if I take this route, what is the easiest way to
allow me to change the packet loss without hard coding a percent into
the kernel?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 22:30 ` George Nychis
@ 2006-04-17 16:46 ` Stephen Hemminger
2006-04-17 17:05 ` George Nychis
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2006-04-17 16:46 UTC (permalink / raw)
To: George Nychis; +Cc: linux-kernel, netdev, matt.keenan
On Mon, 17 Apr 2006 18:30:51 -0400
George Nychis <gnychis@cmu.edu> wrote:
>
>
> Stephen Hemminger wrote:
>
> >On Mon, 17 Apr 2006 03:38:33 -0400
> >George Nychis <gnychis@cmu.edu> wrote:
> >
> >
> >
> >>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%
^^^^^^
You need to do add not change. Add will set the queue discipline
to netem (default is pfifo_fast). Change is for changing netem parameters
after it is loaded.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: want to randomly drop packets based on percent
2006-04-17 16:46 ` Stephen Hemminger
@ 2006-04-17 17:05 ` George Nychis
2006-04-17 17:32 ` Stephen Hemminger
0 siblings, 1 reply; 10+ messages in thread
From: George Nychis @ 2006-04-17 17:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-kernel, netdev
Stephen Hemminger wrote:
>On Mon, 17 Apr 2006 18:30:51 -0400
>George Nychis <gnychis@cmu.edu> wrote:
>
>
>
>>Stephen Hemminger wrote:
>>
>>
>>
>>>On Mon, 17 Apr 2006 03:38:33 -0400
>>>George Nychis <gnychis@cmu.edu> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>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%
>>>>
>>>>
> ^^^^^^
>
>You need to do add not change. Add will set the queue discipline
>to netem (default is pfifo_fast). Change is for changing netem parameters
>after it is loaded.
>
>
>
bahhh I see... the wiki has "change" instead of add. Now i'm running
into another problem, I have an XCP qdisc that I have already added via:
tc qdisc add dev ath0 root xcp capacity 54Mbit size 500
therefore when I also try to incorperate loss:
tcq disc add dev ath0 root netem loss .1%
I get:
RTNETLINK answers: File exists
Is it possible to use two qdiscs on the same interface?
Thanks!
George
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
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
0 siblings, 2 replies; 10+ messages in thread
From: Stephen Hemminger @ 2006-04-17 17:32 UTC (permalink / raw)
To: George Nychis; +Cc: linux-kernel, netdev
O
> >>>>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%
> >>>>
> >>>>
> > ^^^^^^
> >
> >You need to do add not change. Add will set the queue discipline
> >to netem (default is pfifo_fast). Change is for changing netem parameters
> >after it is loaded.
> >
> >
> >
> bahhh I see... the wiki has "change" instead of add. Now i'm running
> into another problem, I have an XCP qdisc that I have already added via:
> tc qdisc add dev ath0 root xcp capacity 54Mbit size 500
>
Wiki reads as a set of examples. First uses, "add" after that "change".
> therefore when I also try to incorperate loss:
> tcq disc add dev ath0 root netem loss .1%
>
> I get:
> RTNETLINK answers: File exists
>
> Is it possible to use two qdiscs on the same interface?
>
No, but netem is "classful" so you can put xcp inside netem.
Look at the token bucket example on the wiki.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 17:32 ` Stephen Hemminger
@ 2006-04-17 23:04 ` George Nychis
2006-04-17 23:08 ` George Nychis
1 sibling, 0 replies; 10+ messages in thread
From: George Nychis @ 2006-04-17 23:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-kernel, netdev
Stephen Hemminger wrote:
>O
>
>
>>>>>>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%
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>> ^^^^^^
>>>
>>>You need to do add not change. Add will set the queue discipline
>>>to netem (default is pfifo_fast). Change is for changing netem parameters
>>>after it is loaded.
>>>
>>>
>>>
>>>
>>>
>>bahhh I see... the wiki has "change" instead of add. Now i'm running
>>into another problem, I have an XCP qdisc that I have already added via:
>>tc qdisc add dev ath0 root xcp capacity 54Mbit size 500
>>
>>
>>
>
>Wiki reads as a set of examples. First uses, "add" after that "change".
>
>
>
>
>>therefore when I also try to incorperate loss:
>>tcq disc add dev ath0 root netem loss .1%
>>
>>I get:
>>RTNETLINK answers: File exists
>>
>>Is it possible to use two qdiscs on the same interface?
>>
>>
>>
>
>No, but netem is "classful" so you can put xcp inside netem.
>Look at the token bucket example on the wiki.
>
>
>
Okay I'm slightly confused... I would like to have the traffic traverse
both the XCP qdisc and the netem qdisc... looking through the wiki it
shows me how to classify two sets of traffic, but how do i push all
traffic through both?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: want to randomly drop packets based on percent
2006-04-17 17:32 ` Stephen Hemminger
2006-04-17 23:04 ` George Nychis
@ 2006-04-17 23:08 ` George Nychis
1 sibling, 0 replies; 10+ messages in thread
From: George Nychis @ 2006-04-17 23:08 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-kernel, netdev
Stephen Hemminger wrote:
>O
>
>
>>>>>>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%
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>> ^^^^^^
>>>
>>>You need to do add not change. Add will set the queue discipline
>>>to netem (default is pfifo_fast). Change is for changing netem parameters
>>>after it is loaded.
>>>
>>>
>>>
>>>
>>>
>>bahhh I see... the wiki has "change" instead of add. Now i'm running
>>into another problem, I have an XCP qdisc that I have already added via:
>>tc qdisc add dev ath0 root xcp capacity 54Mbit size 500
>>
>>
>>
>
>Wiki reads as a set of examples. First uses, "add" after that "change".
>
>
>
>
>>therefore when I also try to incorperate loss:
>>tcq disc add dev ath0 root netem loss .1%
>>
>>I get:
>>RTNETLINK answers: File exists
>>
>>Is it possible to use two qdiscs on the same interface?
>>
>>
>>
>
>No, but netem is "classful" so you can put xcp inside netem.
>Look at the token bucket example on the wiki.
>
>
>
Sorry, I was looking at the LARTC guide, completely skipped over the
blatently obvious block of commands you were pointing me too :P
Thanks!
George
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <62wv1-U5-1@gated-at.bofh.it>]
* Re: want to randomly drop packets based on percent
[not found] <62wv1-U5-1@gated-at.bofh.it>
@ 2006-04-17 10:45 ` Bodo Eggert
0 siblings, 0 replies; 10+ messages in thread
From: Bodo Eggert @ 2006-04-17 10:45 UTC (permalink / raw)
To: George Nychis, netdev, linux-kernel
George Nychis <gnychis@cmu.edu> wrote:
> 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?
You seed the random generator once, not each time you use it.
--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-04-17 23:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 7:38 want to randomly drop packets based on percent George Nychis
2006-04-17 14:21 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).