From patchwork Fri Nov 4 19:13:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13032492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6DCDC433FE for ; Fri, 4 Nov 2022 19:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiKDTNv (ORCPT ); Fri, 4 Nov 2022 15:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiKDTNt (ORCPT ); Fri, 4 Nov 2022 15:13:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE14D4732F for ; Fri, 4 Nov 2022 12:13:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4ECC1622F7 for ; Fri, 4 Nov 2022 19:13:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 394F6C433C1; Fri, 4 Nov 2022 19:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667589226; bh=tw5Uo/AfumbMGE+YtXYqISnviyjEVund7wtAP38znZM=; h=From:To:Cc:Subject:Date:From; b=C83Y7S5Oy4tCcW0EuW47/Ln0mU8RySZM+yajHfZFshCTUyam1TiJT0FPAwI2t3K56 b1HjxFsbByQzS8II3INQiJrjbHDD9Qk6EBt3BIou0RPUzzoV1473Grewp1J5wqm/Iy z8D5709WR8xaOyxkNMaCGTl5gZAoYfDyUoLKAKbmn4FRXctMs4wARGgyivNW0CzzYP /P66ySj7IVGuiu1it54TTHBbPn+98YWOKTy8nO1GpbwuGWg6oPV+rLtWsM9sttAtMY +hNfNxZm2txmgqPoEIFpdu26uZIYaeKBg4JBQTvOj0RQF2iut2adZyKO1XA0aYPkjj sQXdGdMMYkjxw== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, jiri@resnulli.us, razor@blackwall.org, nicolas.dichtel@6wind.com, gnault@redhat.com, jacob.e.keller@intel.com, fw@strlen.de, Jakub Kicinski Subject: [PATCH net-next v3 00/13] genetlink: support per op type policies Date: Fri, 4 Nov 2022 12:13:30 -0700 Message-Id: <20221104191343.690543-1-kuba@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org While writing new genetlink families I was increasingly annoyed by the fact that we don't support different policies for do and dump callbacks. This makes it hard to do proper input validation for dumps which usually have a lot more narrow range of accepted attributes. There is also a minor inconvenience of not supporting different per_doit and post_doit callbacks per op. This series addresses those problems by introducing another op format. v3: - minor fixes to patch 12 after I took it for a spin with a real family - adjust commit msg in patch 8 v2: https://lore.kernel.org/all/20221102213338.194672-1-kuba@kernel.org/ - wait for net changes to propagate - restore the missing comment in patch 1 - drop extra space in patch 3 - improve commit message in patch 4 v1: https://lore.kernel.org/all/20221018230728.1039524-1-kuba@kernel.org/ Jakub Kicinski (13): genetlink: refactor the cmd <> policy mapping dump genetlink: move the private fields in struct genl_family genetlink: introduce split op representation genetlink: load policy based on validation flags genetlink: check for callback type at op load time genetlink: add policies for both doit and dumpit in ctrl_dumppolicy_start() genetlink: support split policies in ctrl_dumppolicy_put_op() genetlink: inline genl_get_cmd() genetlink: add iterator for walking family ops genetlink: use iterator in the op to policy map dumping genetlink: inline old iteration helpers genetlink: allow families to use split ops directly genetlink: convert control family to split ops include/net/genetlink.h | 76 +++++- net/batman-adv/netlink.c | 6 +- net/core/devlink.c | 4 +- net/core/drop_monitor.c | 4 +- net/ieee802154/nl802154.c | 6 +- net/netlink/genetlink.c | 485 ++++++++++++++++++++++++++++---------- net/wireless/nl80211.c | 6 +- 7 files changed, 445 insertions(+), 142 deletions(-)