]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expr: update EXPR_MAX and add missing comments
authorFlorian Westphal <fw@strlen.de>
Tue, 23 Aug 2022 10:51:52 +0000 (12:51 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 30 Aug 2022 14:38:21 +0000 (16:38 +0200)
WHen flagcmp and catchall expressions got added the EXPR_MAX definition
wasn't changed.

Should have no impact in practice however, this value is only checked to
prevent crash when old nft release is used to list a ruleset generated
by a newer nft release and a unknown 'typeof' expression.

v2: Pablo suggested to add EXPR_MAX into enum so its easier to spot.
Adding __EXPR_MAX + define EXPR_MAX (__EXPR_MAX - 1) causes '__EXPR_MAX
not handled in switch' warnings, hence the 'EXPR_MAX =' solution.

Signed-off-by: Florian Westphal <fw@strlen.de>
include/expression.h

index cf7319b65e0e17c2d1ddd78542045adc947f1be7..3f06a38ae2d377d0c029d90ea727263802e6dd2f 100644 (file)
  * @EXPR_NUMGEN:       number generation expression
  * @EXPR_HASH:         hash expression
  * @EXPR_RT:           routing expression
+ * @EXPR_FIB           forward information base expression
+ * @EXPR_XFRM          XFRM (ipsec) expression
+ * @EXPR_SET_ELEM_CATCHALL catchall element expression
+ * @EXPR_FLAGCMP       flagcmp expression
  */
 enum expr_types {
        EXPR_INVALID,
@@ -73,8 +77,9 @@ enum expr_types {
        EXPR_XFRM,
        EXPR_SET_ELEM_CATCHALL,
        EXPR_FLAGCMP,
+
+       EXPR_MAX = EXPR_FLAGCMP
 };
-#define EXPR_MAX EXPR_XFRM
 
 enum ops {
        OP_INVALID,