From: Florian Westphal <fw@strlen.de>
To: lvxiafei <xiafei_xupt@163.com>
Cc: fw@strlen.de, coreteam@netfilter.org, davem@davemloft.net,
edumazet@google.com, horms@kernel.org, kadlec@netfilter.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
lvxiafei@sensetime.com, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, pabeni@redhat.com,
pablo@netfilter.org
Subject: Re: [PATCH V2] netfilter: netns nf_conntrack: per-netns net.netfilter.nf_conntrack_max sysctl
Date: Tue, 8 Apr 2025 15:28:54 +0200 [thread overview]
Message-ID: <20250408132854.GA5425@breakpoint.cc> (raw)
In-Reply-To: <20250408123908.3608-1-xiafei_xupt@163.com>
lvxiafei <xiafei_xupt@163.com> wrote:
> This modification can make nf_conntrack_max support
> the netns level to set the size of the connection
> tracking table, and more flexibly limit the connection
> tracking of each netns. For example, the initial user ns
> has a default value (=max_factor*nf_conntrack_htable_size).
> The nf_conntrack_max when netns 1 and netns 2 are created
> is the same as the nf_conntrack_max in the initial user ns.
> You can set it to netns 1 1k and netns 2 2k without
> affecting each other.
Netns 2 can also set it to 2**31 and cause machine go OOM.
> If you are worried that different netns may exceed the
> initial user limit and memory limit when setting,
> apply max = min(init_net->max, net->max), the value in
> netns is not greater than init_net->max, and the new
> maximum memory consumption <= the original maximum memory
> consumption, which limits memory consumption to a certain
> extent.
That was one of the suggestions that I see how one could have
tunable pernet variable without allowing netns2 go haywire.
> However, this will bring several problems:
>
> 1. Do not allow nf_conntrack_max in other netns to be greater
> than nf_conntrack_max of the initial user. For example, when
> other netns carry north-south traffic, the actual number of
> connection tracking is greater than that of the initial user.
Sure.
> 2. If nf_conntrack_max of the initial user is increased, the
> maximum memory consumption will inevitably increase by n copies
How is that different to current state of affairs?
> 3. If nf_conntrack_max of the initial user is reduced, will
> the existing connections in other netns be affected?
No, but new ones will be blocked until its below init_net limit again.
next prev parent reply other threads:[~2025-04-08 14:01 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 9:50 [PATCH] netfilter: netns nf_conntrack: per-netns net.netfilter.nf_conntrack_max sysctl lvxiafei
2025-04-07 10:13 ` Florian Westphal
2025-04-07 10:56 ` Jan Engelhardt
2025-04-08 8:27 ` lvxiafei
2025-04-08 8:38 ` lvxiafei
2025-04-08 8:17 ` lvxiafei
2025-04-08 9:03 ` [PATCH V2] " lvxiafei
2025-04-08 9:58 ` Florian Westphal
2025-04-08 12:39 ` lvxiafei
2025-04-08 13:28 ` Florian Westphal [this message]
2025-04-09 4:14 ` lvxiafei
2025-04-09 4:25 ` [PATCH V3] " lvxiafei
2025-04-09 7:20 ` Florian Westphal
2025-04-09 9:13 ` lvxiafei
2025-04-09 9:42 ` Florian Westphal
2025-04-10 10:02 ` lvxiafei
2025-04-10 10:53 ` Florian Westphal
2025-04-10 13:05 ` lvxiafei
2025-04-10 13:17 ` Florian Westphal
2025-04-10 14:16 ` Florian Westphal
2025-04-11 4:09 ` lvxiafei
2025-04-12 14:37 ` [PATCH V4] " lvxiafei
2025-04-12 17:26 ` [PATCH V5] " lvxiafei
2025-04-12 17:30 ` lvxiafei
2025-04-12 21:16 ` Jakub Kicinski
2025-04-13 1:14 ` lvxiafei
2025-04-13 9:07 ` Florian Westphal
2025-04-14 3:04 ` lvxiafei
2025-04-15 9:08 ` [PATCH V6] " lvxiafei
2025-04-27 8:14 ` lvxiafei
2025-04-28 9:40 ` Pablo Neira Ayuso
2025-05-22 19:24 ` Pablo Neira Ayuso
2025-05-22 19:32 ` Florian Westphal
2025-05-22 19:58 ` Pablo Neira Ayuso
2025-05-23 9:21 ` lvxiafei
2025-10-14 13:54 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250408132854.GA5425@breakpoint.cc \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvxiafei@sensetime.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=xiafei_xupt@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).