aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso2019-10-24 09:47:08 +0200
committerPablo Neira Ayuso2019-10-26 12:36:42 +0200
commit6df5490fbb9c2d48e9f27a7f128032ac38ae5c59 (patch)
tree11f4c612f2d3599c3f5e44e561c3b2dec9314710 /net
parentad88b7a6aa3e6ac94589fc1aaf7c99fe9211cff2 (diff)
netfilter: nf_tables_offload: add nft_chain_offload_cmd()
This patch adds the nft_chain_offload_cmd() helper function. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_tables_offload.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index beeb74f2b47d..70f50d306799 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -316,6 +316,20 @@ static int nft_indr_block_offload_cmd(struct nft_base_chain *chain,
#define FLOW_SETUP_BLOCK TC_SETUP_BLOCK
+static int nft_chain_offload_cmd(struct nft_base_chain *basechain,
+ struct net_device *dev,
+ enum flow_block_command cmd)
+{
+ int err;
+
+ if (dev->netdev_ops->ndo_setup_tc)
+ err = nft_block_offload_cmd(basechain, dev, cmd);
+ else
+ err = nft_indr_block_offload_cmd(basechain, dev, cmd);
+
+ return err;
+}
+
static int nft_flow_block_chain(struct nft_base_chain *basechain,
const struct net_device *this_dev,
enum flow_block_command cmd)
@@ -329,11 +343,7 @@ static int nft_flow_block_chain(struct nft_base_chain *basechain,
if (this_dev && this_dev != dev)
continue;
- if (dev->netdev_ops->ndo_setup_tc)
- err = nft_block_offload_cmd(basechain, dev, cmd);
- else
- err = nft_indr_block_offload_cmd(basechain, dev, cmd);
-
+ err = nft_chain_offload_cmd(basechain, dev, cmd);
if (err < 0)
return err;
}