Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp180290ybi; Tue, 2 Jul 2019 18:39:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXVaPbcvG0jVrTh+oizMbjog8lELlJWF7xlNu9lwLx9kMPpvb+RF0JHODmx7Nnht9seYHg X-Received: by 2002:a17:902:e211:: with SMTP id ce17mr38423642plb.193.1562117959590; Tue, 02 Jul 2019 18:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562117959; cv=none; d=google.com; s=arc-20160816; b=letsV0/Vzv5hqiyFru2DwSu6JB3qXpbd9RURSJx8eGmQKNwMbxzjqGSMiwpYJYK6pn H/uwAhC49ZNEOKo6EKbnIJHN4W+BMHQsKT0guksf5UiyGKJw661o0p60/n/J2Wosycrn 3jHzE+lO1gfJzhee4/vfvkPcwWqhF0mSwaaKMWbpdI0I2rh4J7+rFVyF4vkHprKsSeg5 rulk2/uzeIfB4T0I9dsKf/les2u5bysBmOFtldn3PrE/JISjTXYwlUTkXh+ib229LXmK axK1Xva/7G1bMCmPOIucCWKbFAsxIxIzmHzmcZKwcqZ/XclzK8Ja1yc+C57ZWPlrtz1u H9bw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=itC4RfMamo4nBUphW+p9hF/96GAi0A3uCODUBRvJI84=; b=XjfpLS9d7kq2oS6NyRlJbERea/5WKU5rl7FGn7nodSWaOqAL8qgWa85dI/HMIqWCcQ fn5466XKu3a2XIRAbgbYexNipiRoQcvGaBnVrNdN2WQACi5Zhq7McSNM93iDoV+Fj4yB avQYDMOuVM9tjI6OiJFqu/U9WikRGvlTc/wcs5pMmhep3aQnitv7IJFZi21SO3FNHiwk ZnICZbc+srIxrvakEo4FVv+NjDemajsejQaOLYMQC2jSlKXamlZpyX9wBn8RypKAoNi4 vHg0U+erbF8eMtmHklpd5hyed6C10rDDgvsKkL8uRh99yEbxbkVF16aa2Cbnzwa6XHBo FntQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=TMhO5cgS; 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 v16si280843pjb.91.2019.07.02.18.39.04; Tue, 02 Jul 2019 18:39:19 -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; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=TMhO5cgS; 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 S1727435AbfGCBhb (ORCPT + 99 others); Tue, 2 Jul 2019 21:37:31 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:34025 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbfGCBhb (ORCPT ); Tue, 2 Jul 2019 21:37:31 -0400 Received: by mail-qk1-f194.google.com with SMTP id t8so572057qkt.1 for ; Tue, 02 Jul 2019 18:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=itC4RfMamo4nBUphW+p9hF/96GAi0A3uCODUBRvJI84=; b=TMhO5cgS+76xq5nHpxySpbIhABSRUywM4yxx2+y9FXTrvyuMrU3Cp2feNwPsOeRsKW DwKwJWsXiHOYGDICseJdVlYxguntHUvsU6MrtNgLZzUMElpHNBXa/6Jjn0/xtQMqMIB8 Li6ad1O97GJAVS+d57FQzz6F3TMcNdl9iVk4T74Lx6hRRdmkPYI4UUEoAioE0m+84vvk DeVz4JERwD1PMdQMjQ3gICjK8PxsLEGU3AUM9Lg9AWg6DAaTXRItWMCoZYyHLuxDhIsD OpmqLVAEODV5QsCL8faaQnLfHa0ajB/20e6HjUrjqvxAQtCeJhPZL1UO8W1JyqkAll4C 8i3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=itC4RfMamo4nBUphW+p9hF/96GAi0A3uCODUBRvJI84=; b=qXPu8fl0As2APfWh3HCnFo1KcLgE8WE+WnVr1h0XBmWe59ieXPSeiDtrDcY6Yz4EyN I1DpnWgSwDXJc6W+gKelHa0mO5ggElEyNJ4FFhD8L3/RneYVsKXVXQDIv9NhHvyerpGq 0S6pf2jiX0ZwHB1Po2xxyYo0YgNhBgHVGrEJNwZuI5LO9kwxNU69ol5zB9j9sDWdG39W DMAY6P+ZF6fbZPBfyXy2xJ7iQns5ndkxlPllSsBwOtNB5O11Sf8gtqU6xEtyqM+/DEa+ RqW8V1x+5ksadZ9oKjqPEs9suXNYgPYdnFthhrFXiYvdi9thincBlE/eb+67Fy7506gI 5Qpg== X-Gm-Message-State: APjAAAXuF5xZWhO1dOGPv4T3CFUb/kabxI/ec1qXFlLI5Gg6ft+vhITW 7YZX+hJc/5kpNvIiK8PSKwFlEQ== X-Received: by 2002:a37:f511:: with SMTP id l17mr25845461qkk.99.1562117850182; Tue, 02 Jul 2019 18:37:30 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id n3sm280989qkk.54.2019.07.02.18.37.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 18:37:30 -0700 (PDT) Date: Tue, 2 Jul 2019 18:37:24 -0700 From: Jakub Kicinski To: Michal Kubecek Cc: David Miller , netdev@vger.kernel.org, Jiri Pirko , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v6 05/15] ethtool: helper functions for netlink interface Message-ID: <20190702183724.423e3b1e@cakuba.netronome.com> In-Reply-To: <44957b13e8edbced71aca893908d184eb9e57341.1562067622.git.mkubecek@suse.cz> References: <44957b13e8edbced71aca893908d184eb9e57341.1562067622.git.mkubecek@suse.cz> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Jul 2019 13:50:04 +0200 (CEST), Michal Kubecek wrote: > Add common request/reply header definition and helpers to parse request > header and fill reply header. Provide ethnl_update_* helpers to update > structure members from request attributes (to be used for *_SET requests). > > Signed-off-by: Michal Kubecek > diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c > index 3c98b41f04e5..e13f29bbd625 100644 > --- a/net/ethtool/netlink.c > +++ b/net/ethtool/netlink.c > @@ -1,8 +1,181 @@ > // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note > > +#include > #include > #include "netlink.h" > > +static struct genl_family ethtool_genl_family; > + > +static const struct nla_policy dflt_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { > + [ETHTOOL_A_HEADER_UNSPEC] = { .type = NLA_REJECT }, I think we want strict checking on all new netlink interfaces, and unfortunately that feature is opt-in.. so you need to add: .strict_start_type = ETHTOOL_A_HEADER_UNSPEC + 1 To the first attr. > + [ETHTOOL_A_HEADER_DEV_INDEX] = { .type = NLA_U32 }, > + [ETHTOOL_A_HEADER_DEV_NAME] = { .type = NLA_NUL_STRING, > + .len = IFNAMSIZ - 1 }, > + [ETHTOOL_A_HEADER_INFOMASK] = { .type = NLA_U32 }, > + [ETHTOOL_A_HEADER_GFLAGS] = { .type = NLA_U32 }, > + [ETHTOOL_A_HEADER_RFLAGS] = { .type = NLA_U32 }, > +};