From: wenxu@ucloud.cn
To: pablo@netfilter.org, fw@strlen.de
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH nf-next v5 1/2] netfilter: nf_flow_offload: add net in offload_ctx
Date: Wed, 21 Aug 2019 12:56:38 +0800 [thread overview]
Message-ID: <1566363399-30976-2-git-send-email-wenxu@ucloud.cn> (raw)
In-Reply-To: <1566363399-30976-1-git-send-email-wenxu@ucloud.cn>
From: wenxu <wenxu@ucloud.cn>
In the offload_ctx, the net can be used for other actions
such as fwd netdev
Signed-off-by: wenxu <wenxu@ucloud.cn>
---
v5: no change
include/net/netfilter/nf_tables_offload.h | 3 ++-
net/netfilter/nf_tables_api.c | 2 +-
net/netfilter/nf_tables_offload.c | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h
index 8a5969d9..71453fd 100644
--- a/include/net/netfilter/nf_tables_offload.h
+++ b/include/net/netfilter/nf_tables_offload.h
@@ -25,6 +25,7 @@ struct nft_offload_ctx {
__be16 l3num;
u8 protonum;
} dep;
+ struct net *net;
unsigned int num_actions;
struct nft_offload_reg regs[NFT_REG32_15 + 1];
};
@@ -61,7 +62,7 @@ struct nft_flow_rule {
#define NFT_OFFLOAD_F_ACTION (1 << 0)
struct nft_rule;
-struct nft_flow_rule *nft_flow_rule_create(const struct nft_rule *rule);
+struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rule *rule);
void nft_flow_rule_destroy(struct nft_flow_rule *flow);
int nft_flow_rule_offload_commit(struct net *net);
void nft_indr_block_get_and_ing_cmd(struct net_device *dev,
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index fe3b7b0..d4f611a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2844,7 +2844,7 @@ static int nf_tables_newrule(struct net *net, struct sock *nlsk,
return nft_table_validate(net, table);
if (chain->flags & NFT_CHAIN_HW_OFFLOAD) {
- flow = nft_flow_rule_create(rule);
+ flow = nft_flow_rule_create(net, rule);
if (IS_ERR(flow))
return PTR_ERR(flow);
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index d3c4c9c..9d9a864 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -28,12 +28,13 @@ static struct nft_flow_rule *nft_flow_rule_alloc(int num_actions)
return flow;
}
-struct nft_flow_rule *nft_flow_rule_create(const struct nft_rule *rule)
+struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rule *rule)
{
struct nft_offload_ctx ctx = {
.dep = {
.type = NFT_OFFLOAD_DEP_UNSPEC,
},
+ .net = net,
};
struct nft_flow_rule *flow;
int num_actions = 0, err;
--
1.8.3.1
next prev parent reply other threads:[~2019-08-21 4:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 4:56 [PATCH nf-next v5 0/2] netfilter: nf_tables_offload: support fwd_netdev offload wenxu
2019-08-21 4:56 ` wenxu [this message]
2019-09-02 6:12 ` [PATCH nf-next v5 1/2] netfilter: nf_flow_offload: add net in offload_ctx wenxu
2019-08-21 4:56 ` [PATCH nf-next v5 2/2] netfilter: nft_fwd_netdev: add fw_netdev action support wenxu
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=1566363399-30976-2-git-send-email-wenxu@ucloud.cn \
--to=wenxu@ucloud.cn \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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).