All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org, richard@nod.at
Subject: Re: [PATCH nf-next,RFC 1/3] netfilter: nf_conntrack: add 64-bit conntrack ID extension
Date: Tue, 28 Nov 2017 21:43:01 +0100	[thread overview]
Message-ID: <20171128204301.GB16528@breakpoint.cc> (raw)
In-Reply-To: <20171128154401.GA1444@salvia>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > ID assignment is lockless: this patch divides the 64-bit space between
> > 
> > Why do we need an id in the first place?
> > Can you elaborate?
> 
> It's a userspace thing, for statistics and manipulation via ctnetlink,
> eg. delete an entry. To make sure you refer to the same conntrack
> entry when polling for statistics and also for events, in case of
> event loss, you keep context around in case tear-down and re-creation
> happens in little time.

Hmm.  I think for that use case (e.g. do not delete an entry unless
it is the one we initally saw via NEW in case we missed a DELETE in
between even my jhash based patch in patch work is good enough.

However, in most realistic cases there never was such a gurantee, see
below.

> > As far as I know there is no need for this ID at all,
> > the netlink attribute is only provided for backwards compat.
> > 
> > And for that the suggested approach (hash of tuple and memory
> > addresses) will work just fine.
> 
> It's still possible to land a conntrack with exactly the same tuple on
> the same memory address.

Sure, but the chances are already pretty much close to 0.
Remember that we can have connection re-use while conntrack object
remains unchanged (e.g. new SYN while contrack is in TW).

The ID doesn't change in this case even with the old approach.

ANd what are the chances of a full tuple reuse *right* at the moment
of expiry (i.e. before any other new allocation)?

And why would we treat it differently than syn-in-tw case?

> I can just keep this patchset back and push the one that randomizes
> what we dump to userspace (ie. 3/3), I don't need this now, it's just
> a patchset that it's been stuck in my tree for a while.

I am fine with 3/3.  You might want to use hash_ptr anyway just in case
though (and perhaps include ct->ext).

  reply	other threads:[~2017-11-28 20:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  2:13 [PATCH nf-next,RFC 1/3] netfilter: nf_conntrack: add 64-bit conntrack ID extension Pablo Neira Ayuso
2017-11-28  2:13 ` [PATCH nf-next,RFC 2/3] netfilter: ctnetlink: use 64-bit conntrack ID Pablo Neira Ayuso
2017-11-28 12:12   ` Florian Westphal
2017-11-28 15:45     ` Pablo Neira Ayuso
2017-11-28 20:27       ` Florian Westphal
2017-11-28  2:13 ` [PATCH nf-next,RFC 3/3] netfilter: ctnetlink: randomize 32-bit ID Pablo Neira Ayuso
2017-11-28 12:18   ` Florian Westphal
2017-11-28 15:46     ` Pablo Neira Ayuso
2017-11-28 10:54 ` [PATCH nf-next,RFC 1/3] netfilter: nf_conntrack: add 64-bit conntrack ID extension Florian Westphal
2017-11-28 15:44   ` Pablo Neira Ayuso
2017-11-28 20:43     ` Florian Westphal [this message]
2017-11-28 12:16 ` Florian Westphal
2017-11-28 15:57   ` Pablo Neira Ayuso
2017-11-28 20:44     ` 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=20171128204301.GB16528@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=richard@nod.at \
    /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.