Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756702AbYH0OlV (ORCPT ); Wed, 27 Aug 2008 10:41:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753779AbYH0OlE (ORCPT ); Wed, 27 Aug 2008 10:41:04 -0400 Received: from postel.suug.ch ([194.88.212.233]:55798 "EHLO postel.suug.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753391AbYH0OlC (ORCPT ); Wed, 27 Aug 2008 10:41:02 -0400 Date: Wed, 27 Aug 2008 16:41:22 +0200 From: Thomas Graf To: Alexander Duyck Cc: Stephen Hemminger , Jeff Kirsher , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Alexander Duyck Subject: Re: [PATCH] IPROUTE: correct nla nested message generated by netem_parse_opt Message-ID: <20080827144122.GT20815@postel.suug.ch> References: <20080822005011.4615.98303.stgit@jtkirshe-mobile.jf.intel.com> <20080821211941.66090862@speedy> <5f2db9d90808211937o1d9b33t9ad933938872e08d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f2db9d90808211937o1d9b33t9ad933938872e08d@mail.gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1986 Lines: 51 * Alexander Duyck 2008-08-21 19:37 > The problem is the current kernel ABI was changed in commit > b9a2f2e450b0f770bb4347ae8d48eb2dea701e24 "netlink: Fix > nla_parse_nested_compat() to call nla_parse() directly" to support a > format that I have only seen generated in netem_parse_opt. The kernel > and prio_parse_opt qdisc both generate the other format which includes > the extra attribute header to contain the nested attributes. This > patch fixes tc so that netem will use the correct nested attribute > order for kernels prior to this commit and once this commit has been > reverted. How was it ever supposed to work? The code looked like the following prior to commit b03f4672007e533c8dbf0965f995182586216bf1 which made it used nla_parse_nested_compat() - /* Handle nested options after initial queue options. - * Should have put all options in nested format but too late now. - */ - if (nla_len(opt) > sizeof(*qopt)) { - struct nlattr *tb[TCA_NETEM_MAX + 1]; - if (nla_parse(tb, TCA_NETEM_MAX, - nla_data(opt) + sizeof(*qopt), - nla_len(opt) - sizeof(*qopt), NULL)) nla_parse_nested_compat() now does exactly what the above code does. So in what way has the kernel ABI changed? There is two ways of sending a fixed struct + attributes inside an attribute: a) (old and outdated method) attr foo fixed struct [nested attr 1] [nested attr 2] This format can be parsed with nla_parse_nested_compat(attr foo) b) (new method) attr foo fixed struct attr container [nested attr 1] [nested attr 2] This format is parsed with nla_parse_nested(attr container) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/