From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: fw@strlen.de
Subject: [PATCH nft,v6 1/8] src: add EXPR_F_KERNEL to identify expression in the kernel
Date: Wed, 13 Apr 2022 03:49:23 +0200 [thread overview]
Message-ID: <20220413014930.410728-2-pablo@netfilter.org> (raw)
In-Reply-To: <20220413014930.410728-1-pablo@netfilter.org>
This allows to identify the set elements that reside in the kernel.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/expression.h | 2 ++
src/netlink.c | 1 +
src/segtree.c | 5 ++++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/expression.h b/include/expression.h
index 78f788b3c377..ce32e1f3d20c 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -192,6 +192,7 @@ const struct expr_ops *expr_ops_by_type(enum expr_types etype);
* @EXPR_F_INTERVAL_END: set member ends an open interval
* @EXPR_F_BOOLEAN: expression is boolean (set by relational expr on LHS)
* @EXPR_F_INTERVAL: expression describes a interval
+ * @EXPR_F_KERNEL: expression resides in the kernel
*/
enum expr_flags {
EXPR_F_CONSTANT = 0x1,
@@ -200,6 +201,7 @@ enum expr_flags {
EXPR_F_INTERVAL_END = 0x8,
EXPR_F_BOOLEAN = 0x10,
EXPR_F_INTERVAL = 0x20,
+ EXPR_F_KERNEL = 0x40,
};
#include <payload.h>
diff --git a/src/netlink.c b/src/netlink.c
index 775c6f5170e2..24a9ad9852f3 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1286,6 +1286,7 @@ key_end:
}
expr = set_elem_expr_alloc(&netlink_location, key);
+ expr->flags |= EXPR_F_KERNEL;
if (nftnl_set_elem_is_set(nlse, NFTNL_SET_ELEM_TIMEOUT))
expr->timeout = nftnl_set_elem_get_u64(nlse, NFTNL_SET_ELEM_TIMEOUT);
diff --git a/src/segtree.c b/src/segtree.c
index 3ccf5ee129fc..6f7231755927 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -826,6 +826,7 @@ static struct expr *__expr_to_set_elem(struct expr *low, struct expr *expr)
} else {
interval_expr_copy(elem, low);
}
+ elem->flags |= EXPR_F_KERNEL;
return elem;
}
@@ -1192,7 +1193,7 @@ void interval_map_decompose(struct expr *set)
if (!mpz_cmp_ui(range, 0)) {
if (expr_basetype(low)->type == TYPE_STRING)
mpz_switch_byteorder(expr_value(low)->value, low->len / BITS_PER_BYTE);
-
+ low->flags |= EXPR_F_KERNEL;
compound_expr_add(set, expr_get(low));
} else if (range_is_prefix(range) && !mpz_cmp_ui(p, 0)) {
struct expr *expr;
@@ -1239,6 +1240,8 @@ void interval_map_decompose(struct expr *set)
} else {
interval_expr_copy(i, low);
}
+ i->flags |= EXPR_F_KERNEL;
+
expr_free(low);
}
--
2.30.2
next prev parent reply other threads:[~2022-04-13 1:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 1:49 [PATCH nft,v6 0/8] revisit overlap/automerge codebase Pablo Neira Ayuso
2022-04-13 1:49 ` Pablo Neira Ayuso [this message]
2022-04-13 1:49 ` [PATCH nft,v6 2/8] src: replace interval segment tree overlap and automerge Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 3/8] src: remove rbtree datastructure Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 4/8] mnl: update mnl_nft_setelem_del() to allow for more reuse Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 5/8] intervals: add support to automerge with kernel elements Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 6/8] evaluate: allow for zero length ranges Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 7/8] intervals: support to partial deletion with automerge Pablo Neira Ayuso
2022-04-13 1:49 ` [PATCH nft,v6 8/8] src: restore interval sets work with string datatypes 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=20220413014930.410728-2-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--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).