Skip to contentSkip to conversation

netfilter: nf_tables: Use 32 bit addressing register from nft_type_to_reg()

PATCH New Pablo Neira Ayuso 1 participant 1 message Aug 12, 2015

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: Use 32 bit addressing register from nft_type_to_reg()

nft_type_to_reg() needs to return the register in the new 32 bit addressing, otherwise we hit EINVAL when using mappings.

Fixes 49499c3 ("netfilter: nf_tables: switch registers to 32 bit addressing")
---
 include/net/netfilter/nf_tables.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/netfilter/nf_tables.h +1 -1
index 2a24668..aa8bee7 100644
@@ -125,7 +125,7 @@ static inline enum nft_data_types nft_dreg_to_type(enum nft_registers reg)
 
 static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
 {
-	return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1;
+	return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1 * NFT_REG_SIZE / NFT_REG32_SIZE;
 }
 
 unsigned int nft_parse_register(const struct nlattr *attr);
Signature · 1 line
1.7.10.4