From nobody Thu Oct 2 21:55:28 2025 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 00FF93168E3; Wed, 10 Sep 2025 23:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757545746; cv=none; b=mmEye7NTlG10VfhCuDtuvKVx0WLBu2EBpWfyjm36T+15fH0ZAF/KtT25K6Oe+DQc1b6yY+PpfZJVr+ljxOUjp8v3fPm20O/LSihX9upVNWcvs3zlMVrQqcOrIXQFnLldrY7Rd2/M0lKgAMdInTS305ray3flYBgaSi5rCNX5Hqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757545746; c=relaxed/simple; bh=6kMrPysvFhVYyAdolkuF1QheVD/lPJPn0VFB/qw9PH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C3r1CDBe2QNrVgZJCbGz/UNGftC5I2HweAAxk7M8GPcfqABFXEdqTqsTEvYNz8PhvoLLjiKSxLdmTxYthRyRuKQeFMlOsd9FqkvBpj2lBmUw/6FJIbYgjqU+47q/Z/2X2r19wVVi058yNTgfd/sipaTmsit6IYfCKdr5SdFr0uU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=W86Ob1A4; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="W86Ob1A4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1757545731; bh=6kMrPysvFhVYyAdolkuF1QheVD/lPJPn0VFB/qw9PH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W86Ob1A4S+GbFW3JBjOBZKocDqdJi0q8nb59vp7FPIFlwiKL+bTnNulRC38BPS9h+ xFml9J0U48uhhxlhCa0VkNxxOBVZKOzcUSXs5zoH8SVgwRhtduKBKxa90t8HN6DGjM lPjvTesFXMxpgLgeG81uB/vzN5JaisB3LrJwJ0PN5PzpPxuQbjMnoqhTDRunl4K4TV hwXI5+eiQ+6HCtmnt0UTHldkTlcU5Esq/7wehIPAMJoovbjxpMN8H2OjPFuRVRlMIr 6iLEgf8FdPORbXqgPXRS47LBUSlhrhRLT2IlPy1SYEIFSBfrC+mcydYoIfXjZX5DWw iJ7DYumsPRpyQ== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id D3DEF6013D; Wed, 10 Sep 2025 23:08:50 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id E0D83202DF2; Wed, 10 Sep 2025 23:08:42 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: "Jason A. Donenfeld" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , Donald Hunter , Simon Horman , Jacob Keller , Andrew Lunn , Sabrina Dubroca , wireguard@lists.zx2c4.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 03/12] tools: ynl-gen: add sub-type check Date: Wed, 10 Sep 2025 23:08:25 +0000 Message-ID: <20250910230841.384545-4-ast@fiberby.net> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250910230841.384545-1-ast@fiberby.net> References: <20250910230841.384545-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a check to verify that the sub-type is "nest", and throw an exception if no policy could be generated, as a guard to prevent against generating a bad policy. This is a trivial patch with no behavioural changes intended. Signed-off-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter Reviewed-by: Jakub Kicinski Reviewed-by: Jacob Keller --- tools/net/ynl/pyynl/ynl_gen_c.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index b7de7f6b1fc7..04c26ed92ca3 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -826,8 +826,10 @@ class TypeArrayNest(Type): return f'.type =3D YNL_PT_U{c_upper(self.sub_type[1:])}, ' elif self.attr['sub-type'] =3D=3D 'binary' and 'exact-len' in self= .checks: return f'.type =3D YNL_PT_BINARY, .len =3D {self.checks["exact= -len"]}, ' - else: + elif self.attr['sub-type'] =3D=3D 'nest': return f'.type =3D YNL_PT_NEST, .nest =3D &{self.nested_render= _name}_nest, ' + else: + raise Exception(f"Typol for ArrayNest sub-type {self.attr['sub= -type']} not supported, yet") =20 def _attr_get(self, ri, var): local_vars =3D ['const struct nlattr *attr2;'] --=20 2.51.0