Netfilter fixes for net
Subsystems (3)
Pablo Neira Ayuso
maintainercover Netfilter fixes for net
Hi,
The following batch contains one Netfilter fix:
1) Reject mismatching sum of field_len with set key length which allows to create a set without inconsistent pipapo rule width and set key length.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-25-01-30
Thanks.
----------------------------------------------------------------
The following changes since commit 0a5b8fff01bde1b9908f00004c676f2e2459333b:
selftests: net: Adapt ethtool mq tests to fix in qdisc graft (2025-01-15 09:28:51 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-25-01-30
for you to fetch changes up to 1b9335a8000fb70742f7db10af314104b6ace220:
netfilter: nf_tables: reject mismatching sum of field_len with set key length (2025-01-30 12:26:11 +0100)
----------------------------------------------------------------
netfilter pull request 25-01-30
----------------------------------------------------------------
Pablo Neira Ayuso (1):
netfilter: nf_tables: reject mismatching sum of field_len with set key length
net/netfilter/nf_tables_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: nf_tables: reject mismatching sum of field_len with set key length
The field length description provides the length of each separated key field in the concatenation, each field gets rounded up to 32-bits to calculate the pipapo rule width from pipapo_init(). The set key length provides the total size of the key aligned to 32-bits.
Register-based arithmetics still allows for combining mismatching set key length and field length description, eg. set key length 10 and field description [ 5, 4 ] leading to pipapo width of 12.
--- net/netfilter/nf_tables_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +4 -4
@@ -5065,7 +5065,7 @@ static int nft_set_desc_concat_parse(const struct nlattr *attr,static int nft_set_desc_concat (struct nft_set_desc *desc,const struct nlattr *nla) { -u32 num_regs =0 , key_num_regs =0 ; +u32 len =0 , num_regs;struct nlattr *attr;int rem, err, i;
@@ -5079,12 +5079,12 @@ static int nft_set_desc_concat(struct nft_set_desc *desc, }for (i =0 ; i < desc->field_count; i++) - num_regs +=DIV_ROUND_UP (desc->field_len[i],sizeof (u32)); + len +=round_up (desc->field_len[i],sizeof (u32)); - key_num_regs =DIV_ROUND_UP (desc->klen,sizeof (u32)); -if (key_num_regs != num_regs) +if (len != desc->klen)return -EINVAL ; + num_regs =DIV_ROUND_UP (desc->klen,sizeof (u32));if (num_regs >NFT_REG32_COUNT )return -E2BIG ;
Signature · 1 line
2.30.2
Re: [PATCH net 1/1] netfilter: nf_tables: reject mismatching sum of field_len with set key length
This patch was applied to netdev/net.git (main) by Pablo Neira Ayuso <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Pablo Neira Ayuso <[email protected]>:
Quoted 10 lines · On Thu, 30 Jan 2025 12:33:07 +0100 you wrote:
The field length description provides the length of each separated key field in the concatenation, each field gets rounded up to 32-bits to calculate the pipapo rule width from
pipapo_init(). The set key length provides the total size of the key aligned to 32-bits.Register-based arithmetics still allows for combining mismatching set key length and field length description, eg. set key length 10 and field description [ 5, 4 ] leading to pipapo width of 12.
[...]
Here is the summary with links:
- [net,1/1] netfilter: nf_tables: reject mismatching sum of field_len with set key length
https://git.kernel.org/netdev/net/c/1b9335a8000f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html