Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp522234yba; Fri, 26 Apr 2019 04:25:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzr8Ilq8lt/XFtwPDyj2zZkmuyRwGnuzxNhIHYNLJKe1fRCCqW+zxNq/p+X/DS+l9wcJRIl X-Received: by 2002:a63:1446:: with SMTP id 6mr33903445pgu.227.1556277941791; Fri, 26 Apr 2019 04:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556277941; cv=none; d=google.com; s=arc-20160816; b=h6l9AuIGKgwTiKskSHyc293yj5f7/K2I+0c58BrcEfQPVj7LMCvUQs13rf8RAukLO+ y0lI27Pc5hVMzccS+KGb96R9f2E3utYQvjZM+heCpLgzf8DK/d7OevDyX9Rdy9LAup9u vouQAtTKUozeuEPuhI7zAUGIoRwEyR21sEYq+ZR4oDBv1zor+ibqlrS66+2/UwSOvuVD WwtuyeVk9fsMOLlHuDwlVwxbqFlw//FeqvUS1IPVGxtr2wCpl4CY2c/J44CSe+psgwCX JnYY0KJmiRHVbgLSDO54+sgr/ttRK/b+wV66wKJemKAcVLaKa5HeEqZCkScWlIEqRXHr LQLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=0NuD6XyhE8qKiLE/EiUvDULhYsUdKxb5C5pp0dtS0ao=; b=wCVr7Ese6AA9OwZUHrJTslg/X6hsDVfqtPKznJu9IjevCmF38ag2BNRvtwcY+eeMK8 3KNgPlf+N1F6uQXK/BhH2a3sHwH4T63Cy5SkHmjhDa6pcZ2SpD0/8sQoCUhEn8Qqhu5h lMDWRivLyp4NAT5nVSk7V99MVFMSO0S3DOAigdZXp8r3pwO2Ns6VQixCVqPEmZJ9N/TU RwVovBeqK2XPG95IxDEpi+iuj/BJaFQ97/ElDEK+zLxctMOVyYWix1dgqOQ5BmkQSMMz zvV5wTkgUlRkRTECFMCqoje6TSZbqy2T970V344HE22Qdk8IeVjMTh/MZZ6NxZMcXiZv 5sBA== 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 gn11si24924146plb.205.2019.04.26.04.25.26; Fri, 26 Apr 2019 04:25:41 -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 S1726255AbfDZLX4 (ORCPT + 99 others); Fri, 26 Apr 2019 07:23:56 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:56896 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZLXz (ORCPT ); Fri, 26 Apr 2019 07:23:55 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hJyxH-0002uu-8G; Fri, 26 Apr 2019 13:23:47 +0200 Message-ID: Subject: Re: [PATCH net-next 0/3] make nla_nest_start() add NLA_F_NESTED flag From: Johannes Berg To: Michal Kubecek , netdev@vger.kernel.org Cc: "David S. Miller" , David Ahern , Jiri Pirko , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "netfilter-devel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Fri, 26 Apr 2019 13:23:46 +0200 In-Reply-To: <20190426111954.GG26549@unicorn.suse.cz> References: <1dcb87486a96785e3b9e6f337392aa904d977a0d.camel@sipsolutions.net> <20190426111954.GG26549@unicorn.suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regarding that attribute - I guess we'd have to come up with a policy flag saying "may or may not be nested" (if it was a new one) or so? johannes