From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Roi Dayan <roid@nvidia.com>
Cc: netdev@vger.kernel.org, Paul Blakey <paulb@nvidia.com>,
Oz Shlomo <ozsh@nvidia.com>,
fw@strlen.de
Subject: Re: [PATCH net 1/1] netfilter: conntrack: Check offload bit on table dump
Date: Mon, 1 Feb 2021 04:08:53 +0100 [thread overview]
Message-ID: <20210201030853.GA19878@salvia> (raw)
In-Reply-To: <997cbda4-acd1-a000-1408-269bc5c3abf3@nvidia.com>
Hi Roi,
On Sun, Jan 31, 2021 at 03:18:34PM +0200, Roi Dayan wrote:
[...]
> Hi Pablo,
>
> We did more tests with just updating the timeout in the 2 callers
> and it's not enough. We reproduce the issue of rules being timed
> out just now frim different place.
Thanks for giving it a try to my suggestion, it was not correct.
> There is a 3rd caller nf_ct_gc_expired() which being called by 3
> other callers:
> ____nf_conntrack_find()
> nf_conntrack_tuple_taken()
> early_drop_list()
Hm. I'm not sure yet what path is triggering this bug.
Florian came up with the idea of setting a very large timeout for
offloaded flows (that are refreshed by the garbage collector) to avoid
the extra check from the packet path, so those 3 functions above never
hit the garbage collection path. This also applies for the ctnetlink
(conntrack -L) and the /proc/net/nf_conntrack sysctl paths that the
patch describes, those should not ever see an offloaded flow with a
small timeout.
nf_ct_offload_timeout() is called from:
#1 flow_offload_add() to set a very large timer.
#2 the garbage collector path, to refresh the timeout the very large
offload timer.
Probably there is a race between setting the IPS_OFFLOAD and when
flow_offload_add() is called? Garbage collector gets in between and
zaps the connection. Is a newly offloaded connection that you observed
that is being removed?
> only early_drop_list() has a check to skip conns with offload bit
> but without extending the timeout.
> I didnt do a dump but the issue could be from the other 2 calls.
>
> With current commit as is I didn't need to check more callers as I made
> sure all callers will skip the non-offload gc.
>
> Instead of updating more callers and there might be more callers
> later why current commit is not enough?
> We skip offloaded flows and soon gc_worker() will hit and will update
> the timeout anyway.
Another possibility would be to check for the offload bit from
nf_ct_is_expired(), which is coming slighty before nf_ct_should_gc().
But this is also in the ____nf_conntrack_find() path.
Florian?
next prev parent reply other threads:[~2021-02-01 3:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 7:40 [PATCH net 1/1] netfilter: conntrack: Check offload bit on table dump Roi Dayan
2021-01-30 12:01 ` Pablo Neira Ayuso
[not found] ` <3a29e9b5-7bf8-5c00-3ede-738f9b4725bf@nvidia.com>
[not found] ` <997cbda4-acd1-a000-1408-269bc5c3abf3@nvidia.com>
2021-02-01 3:08 ` Pablo Neira Ayuso [this message]
2021-02-01 7:53 ` Roi Dayan
2021-02-01 11:50 ` Florian Westphal
2021-02-01 15:04 ` Roi Dayan
2021-02-01 15:25 ` Florian Westphal
2021-02-02 17:08 ` Roi Dayan
2021-02-03 12:50 ` Florian Westphal
2021-02-07 8:38 ` Roi Dayan
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=20210201030853.GA19878@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=ozsh@nvidia.com \
--cc=paulb@nvidia.com \
--cc=roid@nvidia.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).