]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Get rid of NFT_COMPAT_EXPR_MAX define
authorPhil Sutter <phil@nwl.cc>
Tue, 20 Aug 2019 22:28:21 +0000 (00:28 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 26 Sep 2019 08:26:04 +0000 (10:26 +0200)
Instead simply use ARRAY_SIZE() macro to not overstep supported_exprs
array.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c

index 90bb0c63c025ac09d494c7e7a7f35352af950dc7..a2c43e83cabe126749e9a12dea6c6a1061321403 100644 (file)
@@ -3332,9 +3332,7 @@ uint32_t nft_invflags2cmp(uint32_t invflags, uint32_t flag)
        return NFT_CMP_EQ;
 }
 
-#define NFT_COMPAT_EXPR_MAX     8
-
-static const char *supported_exprs[NFT_COMPAT_EXPR_MAX] = {
+static const char *supported_exprs[] = {
        "match",
        "target",
        "payload",
@@ -3351,7 +3349,7 @@ static int nft_is_expr_compatible(struct nftnl_expr *expr, void *data)
        const char *name = nftnl_expr_get_str(expr, NFTNL_EXPR_NAME);
        int i;
 
-       for (i = 0; i < NFT_COMPAT_EXPR_MAX; i++) {
+       for (i = 0; i < ARRAY_SIZE(supported_exprs); i++) {
                if (strcmp(supported_exprs[i], name) == 0)
                        return 0;
        }