From: Thomas Graf Subject: Re: [PATCH 2/3] netlink: nla_parse_nested_compat was not parsing nested attributes Date: Wed, 27 Aug 2008 16:52:42 +0200 Message-ID: <20080827145242.GU20815@postel.suug.ch> References: <20080822005122.4697.26953.stgit@jtkirshe-mobile.jf.intel.com> <20080822005126.4697.16602.stgit@jtkirshe-mobile.jf.intel.com> <20080822.031823.223140487.davem@davemloft.net> <80769D7B14936844A23C0C43D9FBCF0F14E9B94A@orsmsx501.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , "Kirsher, Jeffrey T" , "jeff@garzik.org" , "netdev@vger.kernel.org" , "shemminger@osdl.org" , "kaber@trash.net" To: "Duyck, Alexander H" Return-path: Received: from postel.suug.ch ([194.88.212.233]:56271 "EHLO postel.suug.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753762AbYH0OwX (ORCPT ); Wed, 27 Aug 2008 10:52:23 -0400 Content-Disposition: inline In-Reply-To: <80769D7B14936844A23C0C43D9FBCF0F14E9B94A@orsmsx501.amr.corp.intel.com> Sender: netdev-owner@vger.kernel.org List-ID: * Duyck, Alexander H 2008-08-22 10:40 > I figured I would CC Stephen Hemminger and Patrick McHardy since they also will likely have an interest in this. > > Just to put together a quick history on this issue I will list off how things got to where they are: > > 1. "[NET_SCHED]: sch_netem: use nla_parse_nested_compat" (http://marc.info/?l=linux-netdev&m=120110639320780&w=2) from Patrick McHardy. After this patch netem started reporting "bytes leftover after parsing attributes" errors as it wasn't actually receiving a nested compat attribute. This patch was added around 2.6.25-rc1. > > 2. "[NETLINK]: Fix nla_parse_nested_compat() to call nla_parse() directly" (http://marc.info/?l=linux-netdev&m=121145625328370&w=2) from Thomas Graf. This resolved the errors but in turn any netlink messages that generated correct nested netlink attributes would have those attributes ignored as they would be automatically parsed out as one attribute with a length of all the nested attributes. This patch was added around 2.6.26-rc4. This patch was necessary as patch 1 broke the kernel ABI. It not only resulted in leftover warnings, it resulted in the interpreation of data with a 4 bytes offset which caused random configuration mess. "Correct" nested netlink attributes are not supposed to be parsed using nla_parse_nested_compat(), nla_parse_nested_compat() is exclusively for attributes which contain a list of nested attributes without a container attribute. > Patches 3 & 4 haven't been applied yet and are under review: > > 3. "[PATCH 2/3] netlink: nla_parse_nested_compat was not parsing nested attributes" (http://marc.info/?l=linux-netdev&m=121936623112195&w=2) from me. This reverts patch 2. > > 4. "[PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt" (http://marc.info/?l=linux-netdev&m=121936623112195&w=2) from me. This patch changes iproute2 netem_parse_opt to generate a correctly formatted set of nested compat attributes that can be parsed after the introduction of patch 1. You can't change ABI! What your patches do is to generate new style nested attributes and change nla_parse_nested_compat() to follow the same semantisc as nla_parse_nested(). The _compat() is there for a reason.