public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug•ch>
To: Stephen Hemminger <shemminger@vyatta•com>
Cc: Dave Jones <davej@codemonkey•org.uk>, netdev@vger•kernel.org
Subject: Re: Fwd: [Bug 447812] New: Netlink messages from "tc"  to sch_netem module are not interpreted correctly
Date: Thu, 22 May 2008 02:21:55 +0200	[thread overview]
Message-ID: <20080522002155.GP20815@postel.suug.ch> (raw)
In-Reply-To: <20080521151021.3d47a3d8@extreme>

* Stephen Hemminger <shemminger@vyatta•com> 2008-05-21 15:10
> /sbin/tc qdisc del dev eth1 root
> /sbin/tc qdisc del dev eth1 ingress
> /sbin/tc qdisc add dev eth1 root handle 1: prio bands 5 priomap 4 4 4 4 
> 4 4 4 4 4 4 4 4 4 4 4 4
> /sbin/tc qdisc add dev eth1 parent 1:1 handle 10: netem
> /sbin/tc qdisc add dev eth1 parent 10:1 handle 100: tbf rate 2147483647 
> burst 1600 latency 2000000 mpu 64
> /sbin/tc qdisc change dev eth1 parent 1:1 handle 10: netem delay 50ms 
> 5ms 10% corrupt 8%
> 
> It also generates the warning if the last line of the above is simply:
> 
> /sbin/tc qdisc change dev eth1 parent 1:1 handle 10: netem delay 50ms 
> 5ms 10%
> 
> But not if that last line is (i.e. with the correlation part dropped.)
> 
> /sbin/tc qdisc change dev eth1 parent 1:1 handle 10: netem delay 50ms 5ms
> 
> So, all in all, it seems to me that a bug has crept into the kernel 
> interpretation of the netem netlink messages.

Could you try this patch?

Index: net-2.6/include/net/netlink.h
===================================================================
--- net-2.6.orig/include/net/netlink.h	2008-05-22 02:12:48.000000000 +0200
+++ net-2.6/include/net/netlink.h	2008-05-22 02:15:25.000000000 +0200
@@ -772,12 +772,13 @@
 					    const struct nla_policy *policy,
 					    int len)
 {
-	if (nla_len(nla) < len)
+	int nested_len = nla_len(nla) - NLA_ALIGN(len);
+
+	if (nested_len < 0)
 		return -1;
-	if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(struct nlattr))
-		return nla_parse_nested(tb, maxtype,
-					nla_data(nla) + NLA_ALIGN(len),
-					policy);
+	if (nested_len >= nla_attr_size(0))
+		return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
+				 nested_len, policy);
 	memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
 	return 0;
 }

  reply	other threads:[~2008-05-22  0:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 21:45 Fwd: [Bug 447812] New: Netlink messages from "tc" to sch_netem module are not interpreted correctly Dave Jones
2008-05-21 22:10 ` Stephen Hemminger
2008-05-22  0:21   ` Thomas Graf [this message]
2008-05-22  0:57     ` Rick Jones
2008-05-22 11:18       ` Thomas Graf
2008-05-22 16:32         ` Rick Jones
2008-05-22 11:37     ` [NETLINK]: Fix nla_parse_nested_compat() to call nla_parse() directly Thomas Graf
2008-05-22 12:45       ` Patrick McHardy
2008-05-22 17:49         ` David Miller
2008-05-22 18:02           ` Stephen Hemminger
2008-05-22 18:11             ` David Miller
2008-05-21 22:16 ` Fwd: [Bug 447812] New: Netlink messages from "tc" to sch_netem module are not interpreted correctly Rick Jones
2008-05-21 22:36   ` Rick Jones

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=20080522002155.GP20815@postel.suug.ch \
    --to=tgraf@suug$(echo .)ch \
    --cc=davej@codemonkey$(echo .)org.uk \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shemminger@vyatta$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox