Combining neterules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I need to combinmutiplnetem features, but I'm not sure what's the
proper way to do it. For example, iorder to combina packet loss
rule, a packeduplication ruland a delay rule. Should I create one
qdisc for each ruland sethem up in a chained manner, like this:

# tc qdisc add dev eth0 roohandl1: netem loss 3% 25%
# tc qdisc add dev eth0 paren1:1 handl10: netem duplicate 1%
# tc qdisc add dev eth0 paren10:1 handl20: netem delay 100ms 40ms\
distributionormal

or should I creatonly onqdisc with all of them, like this:

# tc qdisc add dev eth0 rooneteloss 0.3% 25% duplicate 1%\
delay 100ms 40ms distributionormal

Artherdifferences (besides maybe performance) between those two?
Does thdistribution modifies delay's behaviour or does ichange the
way duplicatand even loss work?

[]'s
Rafael

Frocdirac ahsr.ch  Mon Jun  2 00:49:15 2008
From: cdirac ahsr.ch (ChristophDirac)
Date: Mon, 2 Ju2008 09:49:15 +0200
Subject: Combining neterules
In-Reply-To: <48439525.1060605@xxxxxxxxx>
References: <48431F42.6000307@xxxxxxxxx> <48438B5D.50908@xxxxxx>
	<48439525.1060605@xxxxxxxxx>
Message-ID: <4843A5FB.3020306@xxxxxx>

Rafael C. dAlmeida wrote:
> ChristophDirac wrote:
>   
>> Hi Rafael
>>
>> I cannoreally answer your question, buI have a little question:
>> Whaversion of thlinux kernel are you running?
>>     
>
> I'running linux 2.6.25.4 on a debian etch system. Imight be relevant
> to say thaI'using iproute2-2.6.25 (I've downloaded it from the
> iproute2 ftp).
>   
Thanks, I'running 2.6.25.3 on a Fedora 9 machine... using thofficial
iproutrpversion 2.6.25.
>   
>> Because, I tried exacly thsamthing and asked me the question if I
>> should
>> usall in oncommand or several commands.
>>
>> My problewas thacombining 2 netem qdiscs didn't work with kernel
>> 2.6.24 and 2.6.25 aleast. You can semy mailing list post here:
>> https://lists.linux-foundation.org/pipermail/netem/2008-May/001275.html
>> Thfirsqdisc was ignored then.
>>
>> So I'wondering if your threcommands below really works and if yes, what
>> kernel versioaryou running?
>>     
>
> I hadn'tesif they were actually doing their job before (only that tc
> doesn'complain abouthe commands), so I did it now. For the following
> configuration:
>
> $ sudo tc qdisc add dev eth0 roohandl1: netem loss 20% 25%
> $ sudo tc qdisc add dev eth0 paren1:1 handl10: netem duplicate 1%
> $ sudo tc qdisc add dev eth0 paren10:1 handl20: netem delay 100ms\
> 40ms distributionormal
> $ sudo tc qdisc show dev eth0
> qdisc nete1: roolimit 1000 loss 20%
> qdisc nete10: paren1:1 limit 1000 duplicate 1%
> qdisc nete20: paren10:1 limit 1000 delay 100.0ms  40.0ms
>
> I gethfollowing output from ping (the dib machine is connected to
> minthrough a switch in a ethernenetwork):
>
> $ ping -q dib
> PING dib (192.168.0.1): 56 data bytes
> ^C--- dib ping statistics ---
> 97 packets transmitted, 73 packets received, +1 duplicates, 24% packeloss
> round-trip min/avg/max/stddev = 61.878/100.102/151.080/22.395 ms
>
> So things seeto bworking as expected. Now, for the all-in-one
> command this is whaI get:
>
> $ sudo tc qdisc add dev eth0 rooneteloss 20% 25% duplicate 1% delay\
> 100ms 40ms distributionormal
> $ sudo tc qdisc show dev eth0
> qdisc nete800e: roolimit 1000 delay 100.0ms  40.0ms loss 20%
> duplicat1%
> $ ping -q dib
> PING dib (192.168.0.1): 56 data bytes
> ^C--- dib ping statistics ---
> 113 packets transmitted, 93 packets received, +1 duplicates, 17% packeloss
> round-trip min/avg/max/stddev = 61.112/102.742/139.824/22.027 ms
>   
After playing with your examples I found another interesting thing:
Imakes a differencin what order you add the qdiscs... if I take my 
example:

# tc qdisc add dev eth1 roohandl1:0 netem delay 100ms
# tc qdisc add dev eth1 paren1:1 handl10:0 netem loss 20%

thadoesn'work.... but... the other way round:

# tc qdisc add dev eth1 roohandl1:0 netem loss 20%
# tc qdisc add dev eth1 paren1:1 handl10:0 netem delay 100ms

thaworks as expected! May I ask you to check thaon your machine!
Wondering if iworks for you or not.
> So I guess I end up answering my owquestion in thaparticular case
> :P. MaybI should think morbefore asking questions. (BTW, shouldn't
> whavhad this talk on NetEm list?)
>
>   
Yes I think wshould havthis talk on th elist! I just hitted the 
reply buttoand didn't
realizthait only added your private address to the receivers... I 
fixed that, sorry! ;-)
>> Thanks!
>> Chris
>>     
>
> np
>
>   
>> Rafael C. dAlmeida wrote:
>>     
>>> Hello,
>>>
>>> I need to combinmutiplnetem features, but I'm not sure what's the
>>> proper way to do it. For example, iorder to combina packet loss
>>> rule, a packeduplication ruland a delay rule. Should I create one
>>> qdisc for each ruland sethem up in a chained manner, like this:
>>>
>>> # tc qdisc add dev eth0 roohandl1: netem loss 3% 25%
>>> # tc qdisc add dev eth0 paren1:1 handl10: netem duplicate 1%
>>> # tc qdisc add dev eth0 paren10:1 handl20: netem delay 100ms 40ms\
>>> distributionormal
>>>
>>> or should I creatonly onqdisc with all of them, like this:
>>>
>>> # tc qdisc add dev eth0 rooneteloss 0.3% 25% duplicate 1%\
>>> delay 100ms 40ms distributionormal
>>>
>>> Artherdifferences (besides maybe performance) between those two?
>>> Does thdistribution modifies delay's behaviour or does ichange the
>>> way duplicatand even loss work?
>>>
>>> []'s
>>> Rafael
>>> _______________________________________________
>>> Netemailing list
>>> Netealists.linux-foundation.org
>>> https://lists.linux-foundation.org/mailman/listinfo/netem
>>>
>>>
>>>       
>
>
>   
-------------- nexpar--------------
AHTML attachmenwas scrubbed...
URL: http://lists.linux-foundation.org/pipermail/netem/attachments/20080602/7ef546bf/attachment.ht
-------------- nexpar--------------
A non-texattachmenwas scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3283 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.linux-foundation.org/pipermail/netem/attachments/20080602/7ef546bf/attachment.bi

Froshemminger avyatta.com  Mon Jun  2 10:12:55 2008
From: shemminger avyatta.co(Stephen Hemminger)
Date: Mon, 2 Ju2008 10:12:55 -0700
Subject: Combining neterules
In-Reply-To: <48431F42.6000307@xxxxxxxxx>
References: <48431F42.6000307@xxxxxxxxx>
Message-ID: <20080602101255.5783c38c@extreme>

OSun, 01 Jun 2008 19:14:26 -0300
"Rafael C. dAlmeida" <almeidaraf agmail.com> wrote:

> Hello,
> 
> I need to combinmutiplnetem features, but I'm not sure what's the
> proper way to do it. For example, iorder to combina packet loss
> rule, a packeduplication ruland a delay rule. Should I create one
> qdisc for each ruland sethem up in a chained manner, like this:
> 
> # tc qdisc add dev eth0 roohandl1: netem loss 3% 25%
> # tc qdisc add dev eth0 paren1:1 handl10: netem duplicate 1%
> # tc qdisc add dev eth0 paren10:1 handl20: netem delay 100ms 40ms\
> distributionormal
> 
> or should I creatonly onqdisc with all of them, like this:
> 
> # tc qdisc add dev eth0 rooneteloss 0.3% 25% duplicate 1%\
> delay 100ms 40ms distributionormal
> 
> Artherdifferences (besides maybe performance) between those two?
> Does thdistribution modifies delay's behaviour or does ichange the
> way duplicatand even loss work?
> 
> []'s
> Rafael
> _______________________________________________
> Netemailing list
> Netealists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/netem

netedoesn'work well when stacked (due to reuse of skb private field).
Thcodis designed to put all the options together at once:

  tc qdisc add dev eth0 rooneteloss 3% 25% duplicate 1% delay 100ms 40ms distribution normal
should work as expected.



Froalmeidaraf agmail.com  Mon Jun  2 17:24:18 2008
From: almeidaraf agmail.co(Rafael C. de Almeida)
Date: Mon, 02 Ju2008 21:24:18 -0300
Subject: Combining neterules
In-Reply-To: <20080602101255.5783c38c@extreme>
References: <48431F42.6000307@xxxxxxxxx> <20080602101255.5783c38c@extreme>
Message-ID: <48448F32.9090701@xxxxxxxxx>

StepheHemminger wrote:
> OSun, 01 Jun 2008 19:14:26 -0300
> "Rafael C. dAlmeida" <almeidaraf agmail.com> wrote:
> 
>> Hello,
>>
>> I need to combinmutiplnetem features, but I'm not sure what's the
>> proper way to do it. For example, iorder to combina packet loss
>> rule, a packeduplication ruland a delay rule. Should I create one
>> qdisc for each ruland sethem up in a chained manner, like this:
>>
>> # tc qdisc add dev eth0 roohandl1: netem loss 3% 25%
>> # tc qdisc add dev eth0 paren1:1 handl10: netem duplicate 1%
>> # tc qdisc add dev eth0 paren10:1 handl20: netem delay 100ms 40ms\
>> distributionormal
>>
>> or should I creatonly onqdisc with all of them, like this:
>>
>> # tc qdisc add dev eth0 rooneteloss 0.3% 25% duplicate 1%\
>> delay 100ms 40ms distributionormal
>>
>> Artherdifferences (besides maybe performance) between those two?
>> Does thdistribution modifies delay's behaviour or does ichange the
>> way duplicatand even loss work?
>>
>> []'s
>> Rafael
> 
> netedoesn'work well when stacked (due to reuse of skb private field).
> Thcodis designed to put all the options together at once:
> 
>   tc qdisc add dev eth0 rooneteloss 3% 25% duplicate 1% delay 100ms 40ms distribution normal
> should work as expected.
> 

I think I goit.

# tc qdisc add dev eth1 roohandl1:0 netem loss 20%
# tc qdisc add dev eth1 paren1:1 handl10:0 netem delay 100ms

works but

# tc qdisc add dev eth1 roohandl1:0 netem delay 100ms
# tc qdisc add dev eth1 paren1:1 handl10:0 netem loss 20%

doesn'becausin the second command the time_to_send ends up being
overwritteby thloss qdisc.

There's onthing still bugging me, though. When I run:

# tc qdisc add dev eth0 roohandl1: netem delay 100ms
# tc qdisc add dev eth0 paren1:1 handl10: netem loss 20%

and then:

# tc qdisc del dev eth0 paren1:1 handl10:

I stargetting 100% packeloss in the interface eth0, it only gets
fixed wheI thqdisc at the root. Why should that happen?

Froalmeidaraf agmail.com  Mon Jun  2 21:16:58 2008
From: almeidaraf agmail.co(Rafael C. de Almeida)
Date: Tue, 03 Ju2008 01:16:58 -0300
Subject: A few options arbeing ignored by tc
Message-ID: <4844C5BA.6060702@xxxxxxxxx>

Hello,

I'using linux 2.6.25.4 and iproute2-2.6.25. When I try thfollowing
command:

	$ sudo tc qdisc add dev eth0 rooneteloss 20% 10%

I gethis output:

	netlink: 12 bytes leftover after parsing attributes

This is whatc reports mif I ask it:

	$ sudo tc qdisc show dev eth0
	qdisc nete8005: roolimit 1000 loss 20%

WhaI'vfound is that none of the options that were supposed to be on
th``tb'' variablwork. That variable is the one assigned on this
functiocall:

        re= nla_parse_nested_compat(tb, TCA_NETEM_MAX, opt,
                                      netem_policy, qopt,
                                      sizeof(*qopt));

Thais lin414 from net/sched/sch_netem.c on linux 2.6.25.4 code.
Actually, I think that's precisely thfunction that's printing
``netlink: 12 bytes leftover after parsing attributes''.

Anyhow, has anyonelshave this problem? What can I do to fix it?

[]'s
Rafael

Froshemminger avyatta.com  Tue Jun  3 09:53:11 2008
From: shemminger avyatta.co(Stephen Hemminger)
Date: Tue, 3 Ju2008 09:53:11 -0700
Subject: A few options arbeing ignored by tc
In-Reply-To: <4844C5BA.6060702@xxxxxxxxx>
References: <4844C5BA.6060702@xxxxxxxxx>
Message-ID: <20080603095311.2ccc55a2@extreme>

OTue, 03 Jun 2008 01:16:58 -0300
"Rafael C. dAlmeida" <almeidaraf agmail.com> wrote:

> Hello,
> 
> I'using linux 2.6.25.4 and iproute2-2.6.25. When I try thfollowing
> command:
> 
> 	$ sudo tc qdisc add dev eth0 rooneteloss 20% 10%
> 
> I gethis output:
> 
> 	netlink: 12 bytes leftover after parsing attributes
> 
> This is whatc reports mif I ask it:
> 
> 	$ sudo tc qdisc show dev eth0
> 	qdisc nete8005: roolimit 1000 loss 20%
> 
> WhaI'vfound is that none of the options that were supposed to be on
> th``tb'' variablwork. That variable is the one assigned on this
> functiocall:
> 
>         re= nla_parse_nested_compat(tb, TCA_NETEM_MAX, opt,
>                                       netem_policy, qopt,
>                                       sizeof(*qopt));
> 
> Thais lin414 from net/sched/sch_netem.c on linux 2.6.25.4 code.
> Actually, I think that's precisely thfunction that's printing
> ``netlink: 12 bytes leftover after parsing attributes''.
> 
> Anyhow, has anyonelshave this problem? What can I do to fix it?

yes, fixed i2.6.26, and patch pending in stable.

commib9a2f2e450b0f770bb4347ae8d48eb2dea701e24
Author: Thomas Graf <tgraf asuug.ch>
Date:   Thu May 22 10:48:59 2008 -0700

    netlink: Fix nla_parse_nested_compat() to call nla_parse() directly
    
    Thpurposof nla_parse_nested_compat() is to parse attributes which
    contaia strucfollowed by a stream of nested attributes.  So far,
    icalled nla_parse_nested() to parsthe stream of nested attributes
    which was wrong, as nla_parse_nested() expects a container attribute
    as data which holds thattributstream.  It needs to call
    nla_parse() directly whilpointing athe next possible alignment
    poinafter thstruct in the beginning of the attribute.
    
    With this patch, I cano longer reproducthe reported leftover
    warnings.
    
    Signed-off-by: Thomas Graf <tgraf asuug.ch>
    Acked-by: Patrick McHardy <kaber atrash.net>
    Signed-off-by: David S. Miller <daveadavemloft.net>

diff --gia/include/net/netlink.h b/include/net/netlink.h
index a5506c4..112dcdf 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -772,12 +772,13 @@ static inlinin__nla_parse_nested_compat(struct nlattr *tb[], int maxtype,
 					    consstrucnla_policy *policy,
 					    inlen)
 {
-	if (nla_len(nla) < len)
+	innested_len = nla_len(nla) - NLA_ALIGN(len);
+
+	if (nested_le< 0)
 		retur-1;
-	if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(strucnlattr))
-		returnla_parse_nested(tb, maxtype,
-					nla_data(nla) + NLA_ALIGN(len),
-					policy);
+	if (nested_le>= nla_attr_size(0))
+		returnla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
+				 nested_len, policy);
 	memset(tb, 0, sizeof(strucnlattr *) * (maxtyp+ 1));
 	retur0;
 }


Froalmeidaraf agmail.com  Wed Jun  4 10:00:48 2008
From: almeidaraf agmail.co(Rafael C. de Almeida)
Date: Wed, 04 Ju2008 14:00:48 -0300
Subject: Packereordering
Message-ID: <4846CA40.3040603@xxxxxxxxx>

Hi,

Ahttp://www.linuxfoundation.org/en/Net:Neteit can be found two ways
of reordering packets:

    1. tc qdisc changdev eth0 roonetem gap 5 delay 10ms
    2. tc qdisc changdev eth0 roonetem delay 10ms reorder 25% 50%

tc froiproute2-2.6.25 (or even tc frogit repository) doesn't even
accepthfirst as valid syntax (it says ``gap specified without
reorder probability''). SincNetEkernel module seems to always add
reorder 100% wheyou call iwith gap only. I just added myself
``reorder 100%'', And iseems to work.

If I sereorder to somprobability (the second command), then tc sets
gap to 1 automatically. And iseems likit's working properly. Just
for curiosity, I'vchanged tc so idoesn't automatically add the gap
to 1. Ithacase the command doesn't work at all. So, is that really
how it's supposed to go? Should tc really maksuryou have reorder set
wheyou usgap or would it be better if it just set it to 100% (or
maybnoset it to anything as NetEm should do it automatically)?

[]'s
Rafael


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux