From nobody Fri Oct 3 06:37:18 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 E17512DF715; Thu, 4 Sep 2025 22:03:29 +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=1757023412; cv=none; b=J2+qIOuwPQbcGVKDNbwRfUF+GmsdTI+mb3kQWMh5fWBnzGR4Vu8eUk75IAIYE6YsFHQoxb0lWkVOsa+BgXgKusiywOJ1vDiQtMGhBXE5DecLlS7eUbjcrUF9iUlwLSgN8Mw3z/tp505GyFU6JFsiXwPa+MRaXIewNeci8AFCvxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757023412; c=relaxed/simple; bh=7mPaZYp6IBm/oj1/oMkLKS5KcOMTq2FZ1vUvfx3mqLc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qyX6zLmHkozTM8cKGftwpOR5CWes+SIwFyVSlurnMLKz2YSTm+OEkJOP8PTGbTFy4j+DY65KRprz4sMXDHnoN96eaDXUasZeBcFlTRQlL6JIQiV9UfIk78gX496srJbCQu4kmVVqz5VBbUAdY1obsU6JkAlahXwR+4ol6prUJzw= 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=Q08+1KNc; 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="Q08+1KNc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1757023398; bh=7mPaZYp6IBm/oj1/oMkLKS5KcOMTq2FZ1vUvfx3mqLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q08+1KNcfP0JSDXoY2eORt544YehFndoOuLJxAAvx+JPDINNxVOuU8sJZu0wGSXug tJ/4k0dxxd71ZzD4oG/NDL+7Sd4S4P0PMcPsU2H8OeCEMdHo8pjhIBVJqQl4QLB/Tc D53xrnNKZuU4sVHanNuKlqHiyh2o0k9pCIbuf6ZC54EcH3TwvMojywQUjtIOMSKZij fSgEtA7ZCE+ZRvyylUc5ox73KqTLoga9lQupfnF7TElineIV4T/LkD6XwkWJ++OEz0 qiZkXRZg5ryGWxRwoiwQH0MErs0yuAIpVgwW0iU0wAEgJBFFKxvxDW+cA2LkLQmMB8 TzJZPXZV4DAHw== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 481F360137; Thu, 4 Sep 2025 22:03:18 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 9E68D202231; Thu, 04 Sep 2025 22:02:09 +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 , wireguard@lists.zx2c4.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/11] tools: ynl-gen: add sub-type check Date: Thu, 4 Sep 2025 22:01:26 +0000 Message-ID: <20250904220156.1006541-3-ast@fiberby.net> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904-wg-ynl-prep@fiberby.net> References: <20250904-wg-ynl-prep@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: Jacob Keller Reviewed-by: Jakub Kicinski --- 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