From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft,v3 4/7] mnl: update mnl_nft_setelem_del() to allow for more reuse
Date: Tue, 1 Mar 2022 21:58:31 +0100 [thread overview]
Message-ID: <20220301205834.290720-5-pablo@netfilter.org> (raw)
In-Reply-To: <20220301205834.290720-1-pablo@netfilter.org>
Pass handle and element list as parameters to allow for code reuse.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/mnl.h | 3 ++-
src/mnl.c | 6 +++---
src/rule.c | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/mnl.h b/include/mnl.h
index a4abe1ae3242..4c701d4ee6dc 100644
--- a/include/mnl.h
+++ b/include/mnl.h
@@ -62,7 +62,8 @@ struct nftnl_set_list *mnl_nft_set_dump(struct netlink_ctx *ctx, int family,
int mnl_nft_setelem_add(struct netlink_ctx *ctx, const struct set *set,
const struct expr *expr, unsigned int flags);
-int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct cmd *cmd);
+int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct handle *h,
+ const struct expr *init);
int mnl_nft_setelem_flush(struct netlink_ctx *ctx, const struct cmd *cmd);
int mnl_nft_setelem_get(struct netlink_ctx *ctx, struct nftnl_set *nls);
struct nftnl_set *mnl_nft_setelem_get_one(struct netlink_ctx *ctx,
diff --git a/src/mnl.c b/src/mnl.c
index 6be991a4827c..1ef124eb9dcf 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -1730,9 +1730,9 @@ int mnl_nft_setelem_flush(struct netlink_ctx *ctx, const struct cmd *cmd)
return 0;
}
-int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct cmd *cmd)
+int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct handle *h,
+ const struct expr *init)
{
- const struct handle *h = &cmd->handle;
struct nftnl_set *nls;
int err;
@@ -1750,7 +1750,7 @@ int mnl_nft_setelem_del(struct netlink_ctx *ctx, const struct cmd *cmd)
netlink_dump_set(nls, ctx);
err = mnl_nft_setelem_batch(nls, ctx->batch, NFT_MSG_DELSETELEM, 0,
- ctx->seqnum, cmd->expr, ctx);
+ ctx->seqnum, init, ctx);
nftnl_set_free(nls);
return err;
diff --git a/src/rule.c b/src/rule.c
index f2ca2621e895..e57e037a9e99 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1598,7 +1598,7 @@ static int do_delete_setelems(struct netlink_ctx *ctx, struct cmd *cmd)
set_to_intervals(set, expr, false) < 0)
return -1;
- if (mnl_nft_setelem_del(ctx, cmd) < 0)
+ if (mnl_nft_setelem_del(ctx, &cmd->handle, cmd->elem.expr) < 0)
return -1;
return 0;
--
2.30.2
next prev parent reply other threads:[~2022-03-01 20:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 20:58 [PATCH nft,v3 0/7] revisit overlap/automerge codebase Pablo Neira Ayuso
2022-03-01 20:58 ` [PATCH nft,v3 1/7] src: add EXPR_F_KERNEL to identify expression in the kernel Pablo Neira Ayuso
2022-03-01 20:58 ` [PATCH nft,v3 2/7] src: replace interval segment tree overlap and automerge Pablo Neira Ayuso
2022-03-01 20:58 ` [PATCH nft,v3 3/7] src: remove rbtree datastructure Pablo Neira Ayuso
2022-03-01 20:58 ` Pablo Neira Ayuso [this message]
2022-03-01 20:58 ` [PATCH nft,v3 5/7] intervals: add support to automerge with kernel elements Pablo Neira Ayuso
2022-03-01 20:58 ` [PATCH nft,v3 6/7] evaluate: allow for zero length ranges Pablo Neira Ayuso
2022-03-01 20:58 ` [PATCH nft,v3 7/7] intervals: support to partial deletion with automerge Pablo Neira Ayuso
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=20220301205834.290720-5-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.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).