]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expression: add __EXPR_MAX and use it to define EXPR_MAX
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 26 Mar 2025 20:54:01 +0000 (21:54 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 27 Mar 2025 20:39:03 +0000 (21:39 +0100)
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
src/expression.c

index 8472748621ef78dab37051de38fe91c97e43f206..6e8675b0cc1a1fbc86b6c2ac40735231d111672b 100644 (file)
@@ -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,
index 156a66eb37f01fb120029b2cbd90c37151899184..52e4c7d187ac1435a05464648220cf53fc2e3079 100644 (file)
@@ -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;