summaryrefslogtreecommitdiffstats
path: root/iptables/nft.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-08-21 00:28:21 +0200
committerPhil Sutter <phil@nwl.cc>2019-09-26 10:26:04 +0200
commit1b148f23cd0ccb0f0eafef92761a98cf6b8b1396 (patch)
treeb8676df3ea7afed7cf954bf4156021c9f1668969 /iptables/nft.c
parent344603d4cfe9e98f6203d4577ee6d15873897845 (diff)
nft: Get rid of NFT_COMPAT_EXPR_MAX define
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>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r--iptables/nft.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 90bb0c63..a2c43e83 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -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;
}