Skip to contentSkip to conversation

Netfilter fixes for net

PATCH Applied Pablo Neira Ayuso 2 participants 6 messages Apr 25, 2022

Subsystems (4)
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) Fix incorrect printing of memory size of IPVS connection hash table, from Pengcheng Yang.

2) Fix spurious EEXIST errors in nft_set_rbtree.

3) Remove leftover empty flowtable file, from Rongguang Wei.

4) Fix ip6_route_me_harder() with vrf driver, from Martin Willi.

Please, pull these changes from:

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

Thanks.

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

The following changes since commit 4cf35a2b627a020fe1a6b6fc7a6a12394644e474:

net: mscc: ocelot: fix broken IP multicast flooding (2022-04-19 10:33:33 +0200)

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 8ddffdb9442a9d60b4a6e679ac48d7d21403a674:

netfilter: Update ip6_route_me_harder to consider L3 domain (2022-04-25 11:09:20 +0200)

----------------------------------------------------------------
Martin Willi (1):
netfilter: Update ip6_route_me_harder to consider L3 domain

Pablo Neira Ayuso (1):
netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion

Pengcheng Yang (1):
ipvs: correctly print the memory size of ip_vs_conn_tab

Rongguang Wei (1):
netfilter: flowtable: Remove the empty file

 net/ipv4/netfilter/nf_flow_table_ipv4.c |  0
 net/ipv6/netfilter.c                    | 10 ++++++++--
 net/netfilter/ipvs/ip_vs_conn.c         |  2 +-
 net/netfilter/nft_set_rbtree.c          |  6 +++++-
 4 files changed, 14 insertions(+), 4 deletions(-)
 delete mode 100644 net/ipv4/netfilter/nf_flow_table_ipv4.c
author maintainer
#1 lore raw

PATCH 1/4 ipvs: correctly print the memory size of ip_vs_conn_tab

From: Pengcheng Yang <[email protected]>

The memory size of ip_vs_conn_tab changed after we use hlist instead of list.

Fixes 731109e78415 ("ipvs: use hlist instead of list")
---
 net/netfilter/ipvs/ip_vs_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_conn.c +1 -1
index 2c467c422dc6..fb67f1ca2495 100644
@@ -1495,7 +1495,7 @@ int __init ip_vs_conn_init(void)
 	pr_info("Connection hash table configured "
 		"(size=%d, memory=%ldKbytes)\n",
 		ip_vs_conn_tab_size,
-		(long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024);
+		(long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024);
 	IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n",
 		  sizeof(struct ip_vs_conn));
 
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH net 1/4] ipvs: correctly print the memory size of ip_vs_conn_tab

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

Hello:

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

Quoted 5 lines · On Mon, 25 Apr 2022 11:16:28 +0200 you wrote:

From: Pengcheng Yang <[email protected]>

The memory size of ip_vs_conn_tab changed after we use hlist instead of list.

Quoted 7 lines
Fixes 731109e78415 ("ipvs: use hlist instead of list")

[...]

Here is the summary with links:
- [net,1/4] ipvs: correctly print the memory size of ip_vs_conn_tab

    https://git.kernel.org/netdev/net/c/eba1a872cb73
  - [net,2/4] netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
    https://git.kernel.org/netdev/net/c/babc3dc9524f
  - [net,3/4] netfilter: flowtable: Remove the empty file
    https://git.kernel.org/netdev/net/c/b9b1e0da5800
  - [net,4/4] netfilter: Update ip6_route_me_harder to consider L3 domain
    https://git.kernel.org/netdev/net/c/8ddffdb9442a

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_set_rbtree: overlap detection with element re-addition after deletion

In reply to Pablo Neira Ayuso

This patch fixes spurious EEXIST errors.

Extend d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion") to deal with elements with same end flags in the same transation.

Reset the overlap flag as described by 7c84d41416d8 ("netfilter:
nft_set_rbtree: Detect partial overlaps on insertion").

Fixes 7c84d41416d8 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion")
Fixes d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion")
---
 net/netfilter/nft_set_rbtree.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/nft_set_rbtree.c +5 -1
index d600a566da32..7325bee7d144 100644
@@ -349,7 +349,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
 				*ext = &rbe->ext;
 				return -EEXIST;
 			} else {
-				p = &parent->rb_left;
+				overlap = false;
+				if (nft_rbtree_interval_end(rbe))
+					p = &parent->rb_left;
+				else
+					p = &parent->rb_right;
 			}
 		}
 
Signature · 1 line
2.30.2
author maintainer
#4 lore raw

PATCH 3/4 netfilter: flowtable: Remove the empty file

In reply to Pablo Neira Ayuso

From: Rongguang Wei <[email protected]>

CONFIG_NF_FLOW_TABLE_IPV4 is already removed and the real user is also removed(nf_flow_table_ipv4.c is empty).

Fixes c42ba4290b2147aa ("netfilter: flowtable: remove ipv4/ipv6 modules")
---
 net/ipv4/netfilter/nf_flow_table_ipv4.c | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 net/ipv4/netfilter/nf_flow_table_ipv4.c
net/ipv4/netfilter/nf_flow_table_ipv4.c deleted +0 -0
deleted file mode 100644
index e69de29bb2d1..000000000000
Signature · 1 line
2.30.2
author maintainer
#5 lore raw

PATCH 4/4 netfilter: Update ip6_route_me_harder to consider L3 domain

In reply to Pablo Neira Ayuso

From: Martin Willi <[email protected]>

The commit referenced below fixed packet re-routing if Netfilter mangles a routing key property of a packet and the packet is routed in a VRF L3 domain. The fix, however, addressed IPv4 re-routing, only.

This commit applies the same behavior for IPv6. While at it, untangle the nested ternary operator to make the code more readable.

Fixes 6d8b49c3a3a3 ("netfilter: Update ip_route_me_harder to consider L3 domain")
---
 net/ipv6/netfilter.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
net/ipv6/netfilter.c +8 -2
index 1da332450d98..8ce60ab89015 100644
@@ -24,14 +24,13 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff
 {
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
 	struct sock *sk = sk_to_full_sk(sk_partial);
+	struct net_device *dev = skb_dst(skb)->dev;
 	struct flow_keys flkeys;
 	unsigned int hh_len;
 	struct dst_entry *dst;
 	int strict = (ipv6_addr_type(&iph->daddr) &
 		      (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
 	struct flowi6 fl6 = {
-		.flowi6_oif = sk && sk->sk_bound_dev_if ? sk->sk_bound_dev_if :
-			strict ? skb_dst(skb)->dev->ifindex : 0,
 		.flowi6_mark = skb->mark,
 		.flowi6_uid = sock_net_uid(net, sk),
 		.daddr = iph->daddr,
@@ -39,6 +38,13 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff
 	};
 	int err;
 
+	if (sk && sk->sk_bound_dev_if)
+		fl6.flowi6_oif = sk->sk_bound_dev_if;
+	else if (strict)
+		fl6.flowi6_oif = dev->ifindex;
+	else
+		fl6.flowi6_oif = l3mdev_master_ifindex(dev);
+
 	fib6_rules_early_flow_dissect(net, skb, &fl6, &flkeys);
 	dst = ip6_route_output(net, sk, &fl6);
 	err = dst->error;
Signature · 1 line
2.30.2