Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp518535yba; Fri, 26 Apr 2019 04:21:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3nZTxSsmUyJIkvkdusMq9SXbg6PQfu0t3z6IUl0HI+yP1JqRY9EEGAautQ7H1U5likVoC X-Received: by 2002:a17:902:bb0d:: with SMTP id l13mr45215212pls.141.1556277686633; Fri, 26 Apr 2019 04:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556277686; cv=none; d=google.com; s=arc-20160816; b=yexR0wCIzn363EO4UQUTPucuZZMPw7dqqW96OiLJ7cu0pINyT4VOO5cO3ctFAVl4Xf O97oZYFkORFY+uxNHYsdOMzNjnrGS669RYt5vVcrVL+upvtvx5wke7cNGlk/U7o9482G qNwfDts7URrel+YAOMPODYA/bUIhAzglYrK04rIpLmJ+kXQQEYO/d89Wdrnz28VEuaVL AwwXh+85s10llJtnkmqLbmGuZMN6d5XW0JqYSbuTd3FrNJc/OryyymFmZ5aZjZU4NnDr cAaPBgogJae2ozYs1nhjL9I5KatF3ShZC7J7TOUKcqtwDbAr3PtmYnJyMsN5xM3CSzLz ds9w== 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=g1VK6hqEYqUL1bjOFtJujS5z1PxZ3B6Fy4EID5tKhJM=; b=JmPejH/rTta+e1W05+aaO7XRTishedJSjlmtEEkFP9CMTsM8qMsZl4PdwoR29FdcL5 sUgWBo+Tzap1JEkb5F4XWMK42H/j7NBSgMAx/Ipkw9lpsHsU8jcbReHtp0+QQonzlMaJ 0sKutklXISyNlrZuLFFjvx1ZH7y8jbN/3AWgriNPe/MneLUo7JDp++QX7sgYfOEDBLC9 8F0bZ8MQSWItIdAwGvTAqF5tCZN6n6LwMjJRugUGjEmPuMesQ3uYluuAsbjr5NT8TGrM bUmAL2mrhmU4UgDfDy6CP1znmt9MNPxCIUFrwYKDMX9V4QKA0dNdaSQwL3AVq0Fo/Mmi aFzw== 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 o24si23894946pgh.260.2019.04.26.04.21.11; Fri, 26 Apr 2019 04:21:26 -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 S1726189AbfDZLT5 (ORCPT + 99 others); Fri, 26 Apr 2019 07:19:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:49562 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725901AbfDZLT5 (ORCPT ); Fri, 26 Apr 2019 07:19:57 -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 96AA3AC10; Fri, 26 Apr 2019 11:19:55 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 9F67EE0143; Fri, 26 Apr 2019 13:19:54 +0200 (CEST) Date: Fri, 26 Apr 2019 13:19:54 +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: <20190426111954.GG26549@unicorn.suse.cz> References: <1dcb87486a96785e3b9e6f337392aa904d977a0d.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1dcb87486a96785e3b9e6f337392aa904d977a0d.camel@sipsolutions.net> 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 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. Michal