Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp549297yba; Fri, 26 Apr 2019 04:57:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNDHq9+QoUMolb4Jc0BSQUY2e/vBKWiSqCq7b6opzN9XiRIvmwIOVEBDL+64SboKsM+TeH X-Received: by 2002:a62:4d44:: with SMTP id a65mr7731328pfb.150.1556279856234; Fri, 26 Apr 2019 04:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556279856; cv=none; d=google.com; s=arc-20160816; b=bbaCLDDBrOqwUZDrs4mcSQ/pj8LuTPFrCfhvIfYnytw3+VkrWI5k88ir66RUSIootH Zz3XAOkjzhjK9K9WTwHQK2dxw5yO+auA5EM645+aP8s9vzEfOcl9k5Ehui17AA2QiYnD R3j43YcOVKNbkVK6AB21FW3yGj67annVbpGsn+4DgaxinnCIKaNlFOStlYK0iwYMVNmL /ntyThFd/AOKaZoKZPvVdE13hzOUprca7EKZu77rHsD4yywFMTqvVpNkgvCR1LtlWZwE 4+36D3ChLKATxu+jqfPv2a7hV0x1550aaNTcJwd0RkIUM779emf9/Oy6ZVPwPWxk7lVr NhUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Ep1x1vPNjevFbesNwPkum6lA8oA7HSCmJevrbwkz/k8=; b=IVL/6FEFZX7xF/ekP4w4zla/oy+UsOC68+tltekO43sM0QL8/swQ67eDIMmdZ+9QeG Qj1lkoIJb6pGgwcfQgHbH26eifLOF9PVAjFq4KKWq9u0rnDl65p8WnW0zc6aHwRUQYCR PichYArNwYU9VMafGweO/OZMkZHWT0j8bbqS+nI5KO8G6tb7rH2jCuGpZrAmm40PL5t3 G1shiadajDkp/E2yiOivmo0ixvyvaaKVm4XqA90kdWC8og3aTP4cGSWSznsXuGcnF5zm wDOIvOsI6ei4dTQxgrBXiiw4xzFgd2dLVTK/4EOH1rQ3eUtp/SCMGbMXXfFFyZcPo7BM IxjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si26757858plo.300.2019.04.26.04.57.21; Fri, 26 Apr 2019 04:57:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbfDZL4c (ORCPT + 99 others); Fri, 26 Apr 2019 07:56:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:56314 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725877AbfDZL4b (ORCPT ); Fri, 26 Apr 2019 07:56:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 511C2AD21; Fri, 26 Apr 2019 11:56:30 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id B46D1E0143; Fri, 26 Apr 2019 13:56:29 +0200 (CEST) Date: Fri, 26 Apr 2019 13:56:29 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Johannes Berg , "David S. Miller" , David Ahern , Jiri Pirko , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "netfilter-devel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net-next 0/3] make nla_nest_start() add NLA_F_NESTED flag Message-ID: <20190426115629.GH26549@unicorn.suse.cz> References: <1dcb87486a96785e3b9e6f337392aa904d977a0d.camel@sipsolutions.net> <20190426111954.GG26549@unicorn.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 01:23:46PM +0200, Johannes Berg wrote: > On Fri, 2019-04-26 at 13:19 +0200, Michal Kubecek wrote: > > On Fri, Apr 26, 2019 at 11:24:15AM +0200, Johannes Berg wrote: > > > On Fri, 2019-04-26 at 09:13 +0000, Michal Kubecek wrote: > > > > > > > Another observation was that even if NLA_F_NESTED flag was introduced in > > > > 2007, only few netlink based interfaces set it in kernel generated messages > > > > and even many recently added APIs omit it. That is unfortunate as without > > > > the flag, message parsers not familiar with attribute semantics cannot > > > > recognize nested attributes and do not see message structure; this affects > > > > e.g. wireshark dissector or mnl_nlmsg_fprintf() from libmnl. > > > > > > Indeed. > > > > > > I wonder if we should also (start) enforcing that the userspace sender > > > side sets this, if the policy is strict? > > > > I suppose we should, at least the part that attribute with NLA_NESTED > > policy has NLA_F_NESTED flag. I'm not so sure about the opposite (i.e. > > that attributes with other policies do not have the flag) as when I was > > checking where kernel accesses nlattr::nla_type directly rather than > > with nla_type(), I stumbled upon an attribute NL80211_ATTR_VENDOR_DATA > > which has policy NLA_BINARY but is sometimes a nest, AFAICS. > > I guess anyway we can only do it for *new* things, not really for all > existing attributes. Right... but what I wanted to say is that if there is already (at least) one attribute which may or may not be a nest, depending on a context, we should expect there may be also new attributes like that in the future. Michal