From: Vlad Buslov <vladbu@nvidia.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<pablo@netfilter.org>
Cc: <netdev@vger.kernel.org>, <netfilter-devel@vger.kernel.org>,
<jhs@mojatatu.com>, <xiyou.wangcong@gmail.com>,
<jiri@resnulli.us>, <ozsh@nvidia.com>,
<marcelo.leitner@gmail.com>, <simon.horman@corigine.com>,
Vlad Buslov <vladbu@nvidia.com>
Subject: [PATCH net-next v1 5/7] net/sched: act_ct: set ctinfo in meta action depending on ct state
Date: Tue, 10 Jan 2023 14:30:21 +0100 [thread overview]
Message-ID: <20230110133023.2366381-6-vladbu@nvidia.com> (raw)
In-Reply-To: <20230110133023.2366381-1-vladbu@nvidia.com>
Currently tcf_ct_flow_table_add_action_meta() function assumes that only
established connections can be offloaded and always sets ctinfo to either
IP_CT_ESTABLISHED or IP_CT_ESTABLISHED_REPLY strictly based on direction
without checking actual connection state. To enable UDP NEW connection
offload set the ctinfo and metadata cookie based on ct->status value.
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
---
net/sched/act_ct.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index 515577f913a3..bfddb462d2bc 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -182,8 +182,11 @@ static void tcf_ct_flow_table_add_action_meta(struct nf_conn *ct,
#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK)
entry->ct_metadata.mark = READ_ONCE(ct->mark);
#endif
- ctinfo = dir == IP_CT_DIR_ORIGINAL ? IP_CT_ESTABLISHED :
- IP_CT_ESTABLISHED_REPLY;
+ if (dir == IP_CT_DIR_ORIGINAL)
+ ctinfo = test_bit(IPS_SEEN_REPLY_BIT, &ct->status) ?
+ IP_CT_ESTABLISHED : IP_CT_NEW;
+ else
+ ctinfo = IP_CT_ESTABLISHED_REPLY;
/* aligns with the CT reference on the SKB nf_ct_set */
entry->ct_metadata.cookie = (unsigned long)ct | ctinfo;
entry->ct_metadata.orig_dir = dir == IP_CT_DIR_ORIGINAL;
--
2.38.1
next prev parent reply other threads:[~2023-01-10 13:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 13:30 [PATCH net-next v1 0/7] Allow offloading of UDP NEW connections via act_ct Vlad Buslov
2023-01-10 13:30 ` [PATCH net-next v1 1/7] net: flow_offload: provision conntrack info in ct_metadata Vlad Buslov
2023-01-10 15:14 ` kernel test robot
2023-01-10 20:27 ` kernel test robot
2023-01-10 20:37 ` kernel test robot
2023-01-10 20:47 ` kernel test robot
2023-01-13 9:12 ` Simon Horman
2023-01-13 16:15 ` Vlad Buslov
2023-01-17 7:55 ` Simon Horman
2023-01-10 13:30 ` [PATCH net-next v1 2/7] netfilter: flowtable: fixup UDP timeout depending on ct state Vlad Buslov
2023-01-10 13:30 ` [PATCH net-next v1 3/7] netfilter: flowtable: allow unidirectional rules Vlad Buslov
2023-01-10 13:30 ` [PATCH net-next v1 4/7] netfilter: flowtable: allow updating offloaded rules asynchronously Vlad Buslov
2023-01-10 13:30 ` Vlad Buslov [this message]
2023-01-10 13:30 ` [PATCH net-next v1 6/7] net/sched: act_ct: offload UDP NEW connections Vlad Buslov
2023-01-10 13:30 ` [PATCH net-next v1 7/7] netfilter: nf_conntrack: allow early drop of offloaded UDP conns Vlad Buslov
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=20230110133023.2366381-6-vladbu@nvidia.com \
--to=vladbu@nvidia.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=ozsh@nvidia.com \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=simon.horman@corigine.com \
--cc=xiyou.wangcong@gmail.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).