All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: lvxiafei <xiafei_xupt@163.com>,
	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
Subject: Re: [PATCH V6] netfilter: netns nf_conntrack: per-netns net.netfilter.nf_conntrack_max sysctl
Date: Thu, 22 May 2025 21:58:13 +0200	[thread overview]
Message-ID: <aC-B1aSmjDvLEisv@calendula> (raw)
In-Reply-To: <aC97x6CHFleb54i0@strlen.de>

On Thu, May 22, 2025 at 09:32:23PM +0200, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > -        to nf_conntrack_buckets by default.
> > > -        Note that connection tracking entries are added to the table twice -- once
> > > -        for the original direction and once for the reply direction (i.e., with
> > > -        the reversed address). This means that with default settings a maxed-out
> > > -        table will have a average hash chain length of 2, not 1.
> > > +    - 0 - disabled (unlimited)
> > 
> > unlimited is too much, and the number of buckets is also global, how
> > does this work?
> 
> Its an historic wart going back to ip_conntrack - it was never the
> default but you could disable any and all limits even in the original
> version.

Thanks, I was just sitting here clueless.

> Wether its time to disallow 0 is a different topic and not related to this patch.
>
> I would argue: "yes", disallow 0 -- users can still set INT_MAX if they
>  want and that should provide enough rope to strangle yourself.

The question is how to make it without breaking crazy people.

> > > +    The limit of other netns cannot be greater than init_net netns.
> > > +    +----------------+-------------+----------------+
> > > +    | init_net netns | other netns | limit behavior |
> > > +    +----------------+-------------+----------------+
> > > +    | 0              | 0           | unlimited      |
> > > +    +----------------+-------------+----------------+
> > > +    | 0              | not 0       | other          |
> > > +    +----------------+-------------+----------------+
> > > +    | not 0          | 0           | init_net       |

in this case above...

> > > +    +----------------+-------------+----------------+
> > > +    | not 0          | not 0       | min            |

... and this case, init_net value is used as a cap for other netns.
Then, this is basically allowing to specify a maximum that is smaller
than init_netns.

IIUC, that sounds reasonable.

As for how to discontinue the unlimited in other netns, let me know if
you have any suggestions.

> > > +    +----------------+-------------+----------------+
> 
> I think this is fine, it doesn't really change things from init_net
> point of view.

Thanks for explaning.

  reply	other threads:[~2025-05-22 19:58 UTC|newest]

Thread overview: 37+ 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
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 [this message]
2025-05-23  9:21         ` lvxiafei
2025-10-14 13:54           ` Florian Westphal
2025-12-01 11:08             ` lvxiafei

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=aC-B1aSmjDvLEisv@calendula \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.