Skip to contentSkip to conversation

netfilter: nf_tables: fix wrong datatype in nft_validate_data_load()

PATCH New Pablo Neira Ayuso 1 participant 1 message Dec 27, 2013

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: fix wrong datatype in nft_validate_data_load()

This patch fixes dictionary mappings, eg.

add rule ip filter input meta mark set tcp dport map { 22 => 1, 23 => 2, }

The kernel was returning -EINVAL in nft_validate_data_load() since the type of the set element data that is passed was the real userspace datatype instead of NFT_DATA_VALUE.

---
 net/netfilter/nf_tables_api.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +3 -1
index b2624ed..d80480e 100644
@@ -2434,7 +2434,9 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
 	enum nft_registers dreg;
 
 	dreg = nft_type_to_reg(set->dtype);
-	return nft_validate_data_load(ctx, dreg, &elem->data, set->dtype);
+	return nft_validate_data_load(ctx, dreg, &elem->data,
+				      set->dtype == NFT_DATA_VERDICT ?
+				      NFT_DATA_VERDICT : NFT_DATA_VALUE);
 }
 
 int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
Signature · 1 line
1.7.10.4