netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] expression: add __EXPR_MAX and use it to define EXPR_MAX
@ 2025-03-26 21:16 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2025-03-26 21:16 UTC (permalink / raw)
  To: netfilter-devel; +Cc: fw

EXPR_MAX was never updated to the newest expression, add __EXPR_MAX and
use it to define EXPR_MAX.

Add case to expr_ops() other gcc complains with a warning on the
__EXPR_MAX case is not handled.

Fixes: 347039f64509 ("src: add symbol range expression to further compact intervals")
Suggested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/expression.h | 4 ++--
 src/expression.c     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/expression.h b/include/expression.h
index 8472748621ef..6e8675b0cc1a 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -84,9 +84,9 @@ enum expr_types {
 	EXPR_FLAGCMP,
 	EXPR_RANGE_VALUE,
 	EXPR_RANGE_SYMBOL,
-
-	EXPR_MAX = EXPR_FLAGCMP
+	__EXPR_MAX
 };
+#define EXPR_MAX	(__EXPR_MAX - 1)
 
 enum ops {
 	OP_INVALID,
diff --git a/src/expression.c b/src/expression.c
index 156a66eb37f0..52e4c7d187ac 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -1794,6 +1794,7 @@ static const struct expr_ops *__expr_ops_by_type(enum expr_types etype)
 	case EXPR_FLAGCMP: return &flagcmp_expr_ops;
 	case EXPR_RANGE_VALUE: return &constant_range_expr_ops;
 	case EXPR_RANGE_SYMBOL: return &symbol_range_expr_ops;
+	case __EXPR_MAX: break;
 	}
 
 	return NULL;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-26 21:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 21:16 [PATCH nft] expression: add __EXPR_MAX and use it to define EXPR_MAX Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).