Skip to contentSkip to conversation

Netfilter fixes for net

PATCH Applied Pablo Neira Ayuso 3 participants 8 messages Mar 9, 2023 – Mar 11, 2023

Subsystems (3)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

cover Netfilter fixes for net

Hi,

The following patchset contains Netfilter fixes for net:

1) nft_parse_register_load() gets an incorrect datatype size as input, from Jeremy Sowden.

2) incorrect maximum netlink attribute in nft_redir, also from Jeremy.

Please, pull these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git

Thanks.

----------------------------------------------------------------

The following changes since commit 37d9df224d1eec1b434fe9ffa40104c756478c29:

ynl: re-license uniformly under GPL-2.0 OR BSD-3-Clause (2023-03-07 13:44:30 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git HEAD

for you to fetch changes up to 493924519b1fe3faab13ee621a43b0d0939abab1:

netfilter: nft_redir: correct value of inet type .maxattrs (2023-03-08 12:26:42 +0100)

----------------------------------------------------------------
Jeremy Sowden (4):
netfilter: nft_nat: correct length for loading protocol registers
netfilter: nft_masq: correct length for loading protocol registers
netfilter: nft_redir: correct length for loading protocol registers
netfilter: nft_redir: correct value of inet type .maxattrs

 net/netfilter/nft_masq.c  | 2 +-
 net/netfilter/nft_nat.c   | 2 +-
 net/netfilter/nft_redir.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 netfilter: nft_nat: correct length for loading protocol registers

From: Jeremy Sowden <[email protected]>

The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a union nf_inet_addr. Change it to use the (correct) size of a union nf_conntrack_man_proto instead.

Fixes d07db9884a5f ("netfilter: nf_tables: introduce nft_validate_register_load()")
---
 net/netfilter/nft_nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_nat.c +1 -1
index 047999150390..5c29915ab028 100644
@@ -226,7 +226,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 		priv->flags |= NF_NAT_RANGE_MAP_IPS;
 	}
 
-	plen = sizeof_field(struct nf_nat_range, min_addr.all);
+	plen = sizeof_field(struct nf_nat_range, min_proto.all);
 	if (tb[NFTA_NAT_REG_PROTO_MIN]) {
 		err = nft_parse_register_load(tb[NFTA_NAT_REG_PROTO_MIN],
 					      &priv->sreg_proto_min, plen);
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH net 1/4] netfilter: nft_nat: correct length for loading protocol registers

This series was applied to netdev/net.git (main) by Pablo Neira Ayuso <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <[email protected]>:

Quoted 8 lines · On Thu, 9 Mar 2023 18:46:52 +0100 you wrote:

From: Jeremy Sowden <[email protected]>

The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a union nf_inet_addr. Change it to use the (correct) size of a union nf_conntrack_man_proto instead.

[...]

Here is the summary with links:
- [net,1/4] netfilter: nft_nat: correct length for loading protocol registers

    https://git.kernel.org/netdev/net/c/068d82e75d53
  - [net,2/4] netfilter: nft_masq: correct length for loading protocol registers
    https://git.kernel.org/netdev/net/c/ec2c5917eb85
  - [net,3/4] netfilter: nft_redir: correct length for loading protocol registers
    https://git.kernel.org/netdev/net/c/1f617b6b4c7a
  - [net,4/4] netfilter: nft_redir: correct value of inet type `.maxattrs`
    https://git.kernel.org/netdev/net/c/493924519b1f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author maintainer
#3 lore raw

PATCH 2/4 netfilter: nft_masq: correct length for loading protocol registers

In reply to Pablo Neira Ayuso

From: Jeremy Sowden <[email protected]>

The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a union nf_inet_addr. Change it to use the (correct) size of a union nf_conntrack_man_proto instead.

Fixes 8a6bf5da1aef ("netfilter: nft_masq: support port range")
---
 net/netfilter/nft_masq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_masq.c +1 -1
index e55e455275c4..9544c2f16998 100644
@@ -43,7 +43,7 @@ static int nft_masq_init(const struct nft_ctx *ctx,
 			 const struct nft_expr *expr,
 			 const struct nlattr * const tb[])
 {
-	u32 plen = sizeof_field(struct nf_nat_range, min_addr.all);
+	u32 plen = sizeof_field(struct nf_nat_range, min_proto.all);
 	struct nft_masq *priv = nft_expr_priv(expr);
 	int err;
 
Signature · 1 line
2.30.2
author maintainer
#4 lore raw

PATCH 3/4 netfilter: nft_redir: correct length for loading protocol registers

In reply to Pablo Neira Ayuso

From: Jeremy Sowden <[email protected]>

The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a union nf_inet_addr. Change it to use the (correct) size of a union nf_conntrack_man_proto instead.

Fixes d07db9884a5f ("netfilter: nf_tables: introduce nft_validate_register_load()")
---
 net/netfilter/nft_redir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_redir.c +1 -1
index 5f7739987559..dbc642f5d32a 100644
@@ -48,7 +48,7 @@ static int nft_redir_init(const struct nft_ctx *ctx,
 	unsigned int plen;
 	int err;
 
-	plen = sizeof_field(struct nf_nat_range, min_addr.all);
+	plen = sizeof_field(struct nf_nat_range, min_proto.all);
 	if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
 		err = nft_parse_register_load(tb[NFTA_REDIR_REG_PROTO_MIN],
 					      &priv->sreg_proto_min, plen);
Signature · 1 line
2.30.2
author maintainer
#5 lore raw

PATCH 4/4 netfilter: nft_redir: correct value of inet type `.maxattrs`

In reply to Pablo Neira Ayuso

From: Jeremy Sowden <[email protected]>

nft_redir_inet_type.maxattrs was being set, presumably because of a cut-and-paste error, to NFTA_MASQ_MAX, instead of NFTA_REDIR_MAX.

Fixes 63ce3940f3ab ("netfilter: nft_redir: add inet support")
---
 net/netfilter/nft_redir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_redir.c +1 -1
index dbc642f5d32a..67cec56bc84a 100644
@@ -236,7 +236,7 @@ static struct nft_expr_type nft_redir_inet_type __read_mostly = {
 	.name		= "redir",
 	.ops		= &nft_redir_inet_ops,
 	.policy		= nft_redir_policy,
-	.maxattr	= NFTA_MASQ_MAX,
+	.maxattr	= NFTA_REDIR_MAX,
 	.owner		= THIS_MODULE,
 };
 
Signature · 1 line
2.30.2
#6 lore raw
In reply to Pablo Neira Ayuso
Quoted 11 lines · Pablo Neira Ayuso

The following patchset contains Netfilter fixes for net:

1) nft_parse_register_load() gets an incorrect datatype size as input, from Jeremy Sowden.

2) incorrect maximum netlink attribute in nft_redir, also from Jeremy.

Please, pull these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git

Have you actually pushed these changes to nf.git? Can't see them. :)

J.

author maintainer
#7 lore raw
Quoted 6 lines · Jeremy Sowden
Quoted 5 lines · Pablo Neira Ayuso

The following patchset contains Netfilter fixes for net:

1) nft_parse_register_load() gets an incorrect datatype size as input, from Jeremy Sowden.

Quoted 8 lines
Quoted 6 lines

2) incorrect maximum netlink attribute in nft_redir, also from Jeremy.

Please, pull these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git

Have you actually pushed these changes to nf.git? Can't see them. :)

Oh, I pushed out to master, not main...