From: Paul Blakey <paulb@mellanox.com>
To: Paul Blakey <paulb@mellanox.com>, Oz Shlomo <ozsh@mellanox.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Roi Dayan <roid@mellanox.com>,
netdev@vger.kernel.org, Saeed Mahameed <saeedm@mellanox.com>
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH net] netfilter: flowtable: Fix expired flow not being deleted from software
Date: Wed, 6 May 2020 14:27:29 +0300 [thread overview]
Message-ID: <1588764449-12706-1-git-send-email-paulb@mellanox.com> (raw)
Once a flow is considered expired, it is marked as DYING, and
scheduled a delete from hardware. The flow will be deleted from
software, in the next gc_step after hardware deletes the flow
(and flow is marked DEAD). Till that happens, the flow's timeout
might be updated from a previous scheduled stats, or software packets
(refresh). This will cause the gc_step to no longer consider the flow
expired, and it will not be deleted from software.
Fix that by looking at the DYING flag as in deciding
a flow should be deleted from software.
Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
net/netfilter/nf_flow_table_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index c0cb7949..b0e9f7a 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -362,7 +362,8 @@ static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
struct nf_flowtable *flow_table = data;
if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct) ||
- test_bit(NF_FLOW_TEARDOWN, &flow->flags)) {
+ test_bit(NF_FLOW_TEARDOWN, &flow->flags) ||
+ test_bit(NF_FLOW_HW_DYING, &flow->flags)) {
if (test_bit(NF_FLOW_HW, &flow->flags)) {
if (!test_bit(NF_FLOW_HW_DYING, &flow->flags))
nf_flow_offload_del(flow_table, flow);
--
1.8.3.1
next reply other threads:[~2020-05-06 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-06 11:27 Paul Blakey [this message]
2020-05-10 22:26 ` [PATCH net] netfilter: flowtable: Fix expired flow not being deleted from software Pablo Neira Ayuso
2020-05-11 7:24 ` Paul Blakey
2020-05-11 8:42 ` Pablo Neira Ayuso
2020-05-11 9:50 ` Paul Blakey
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=1588764449-12706-1-git-send-email-paulb@mellanox.com \
--to=paulb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=ozsh@mellanox.com \
--cc=pablo@netfilter.org \
--cc=roid@mellanox.com \
--cc=saeedm@mellanox.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).