From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DE932E417; Thu, 26 Oct 2023 14:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iMZ2PNok" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4561A2; Thu, 26 Oct 2023 07:11:19 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id D8A043200949; Thu, 26 Oct 2023 10:11:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 26 Oct 2023 10:11:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698329475; x=1698415875; bh=icAvO3Qd0Syql JN8OcKoRqpnDG3ni8FEKMVwrdoDRp4=; b=iMZ2PNokvbqQmcXrCAS4KxPS3uTxo 0384DHXfJVdOxS0LOMDBur2GxBhs6iofAncqW1wJLB6DPJJrRMh9WW55ef+P9E3c 5h/EqMwfkzLoHVejnkOm2FSut1WGwcA4Nz8WMs786N/o1EGEqTi517gvinsI/mzV wo4V1vODy2QdyNPuhumr3wP59w/AID8gHvB/7wJg8xut6QsKP1Ui/pPHkyxsYeBZ 68jRYo1S1b56dtWoDMnjC31dzq65pExUuOggzan4tC2D0oNjCoJuyK9qXcXNnMts teJVb3Q2g4RDqnCtFhNV6Wer4biBZaPPJ+v/e8dRo/WJi29ww2UIbErLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrledvgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkfhggtggujgesthdtre dttddtvdenucfhrhhomhepkfguohcuufgthhhimhhmvghluceoihguohhstghhsehiugho shgthhdrohhrgheqnecuggftrfgrthhtvghrnhepvddufeevkeehueegfedtvdevfefgud eifeduieefgfelkeehgeelgeejjeeggefhnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Oct 2023 10:11:13 -0400 (EDT) Date: Thu, 26 Oct 2023 17:11:09 +0300 From: Ido Schimmel To: Nikolay Aleksandrov Cc: bpf@vger.kernel.org, jiri@resnulli.us, netdev@vger.kernel.org, martin.lau@linux.dev, ast@kernel.org, andrii@kernel.org, john.fastabend@gmail.com, kuba@kernel.org, andrew@lunn.ch, toke@kernel.org, toke@redhat.com, sdf@google.com, daniel@iogearbox.net Subject: Re: [PATCH bpf-next 2/2] netkit: use netlink policy for mode and policy attributes validation Message-ID: References: <20231026094106.1505892-1-razor@blackwall.org> <20231026094106.1505892-3-razor@blackwall.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231026094106.1505892-3-razor@blackwall.org> On Thu, Oct 26, 2023 at 12:41:06PM +0300, Nikolay Aleksandrov wrote: > static const struct nla_policy netkit_policy[IFLA_NETKIT_MAX + 1] = { > [IFLA_NETKIT_PEER_INFO] = { .len = sizeof(struct ifinfomsg) }, > - [IFLA_NETKIT_POLICY] = { .type = NLA_U32 }, > - [IFLA_NETKIT_MODE] = { .type = NLA_U32 }, > - [IFLA_NETKIT_PEER_POLICY] = { .type = NLA_U32 }, > + [IFLA_NETKIT_POLICY] = NLA_POLICY_VALIDATE_FN(NLA_U32, > + netkit_check_policy), Nik, it's problematic to use NLA_POLICY_VALIDATE_FN() with anything other than NLA_BINARY. See commit 9e17f99220d1 ("net/sched: act_mpls: Fix warning during failed attribute validation"). > + [IFLA_NETKIT_MODE] = NLA_POLICY_VALIDATE_FN(NLA_U32, > + netkit_check_mode), > + [IFLA_NETKIT_PEER_POLICY] = NLA_POLICY_VALIDATE_FN(NLA_U32, > + netkit_check_policy), > [IFLA_NETKIT_PRIMARY] = { .type = NLA_REJECT, > .reject_message = "Primary attribute is read-only" }, > }; > -- > 2.38.1 > >