From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH libnftnl 2/5] sets: add and use incomplete tag
Date: Mon, 7 Oct 2024 11:49:35 +0200 [thread overview]
Message-ID: <20241007094943.7544-3-fw@strlen.de> (raw)
In-Reply-To: <20241007094943.7544-1-fw@strlen.de>
Like previous patch:
Extend data and set representation to indicate an incomplete
dissection.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/data_reg.h | 1 +
include/set.h | 1 +
src/expr/data_reg.c | 6 ++++++
src/set_elem.c | 5 +++++
4 files changed, 13 insertions(+)
diff --git a/include/data_reg.h b/include/data_reg.h
index 946354dc9881..982e7a5bf2ea 100644
--- a/include/data_reg.h
+++ b/include/data_reg.h
@@ -27,6 +27,7 @@ union nftnl_data_reg {
const char *chain;
uint32_t chain_id;
};
+ bool incomplete;
};
int nftnl_data_reg_snprintf(char *buf, size_t size,
diff --git a/include/set.h b/include/set.h
index 55018b6b9ba9..ea84e511f1f9 100644
--- a/include/set.h
+++ b/include/set.h
@@ -34,6 +34,7 @@ struct nftnl_set {
uint32_t gc_interval;
uint64_t timeout;
struct list_head expr_list;
+ bool incomplete;
};
struct nftnl_set_list;
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index 149d52aea9b4..dbd7b3660c13 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -135,6 +135,9 @@ nftnl_parse_verdict(union nftnl_data_reg *data, const struct nlattr *attr, int *
if (!tb[NFTA_VERDICT_CODE])
return -1;
+ if (tb[NFTA_VERDICT_UNSPEC])
+ data->incomplete = true;
+
data->verdict = ntohl(mnl_attr_get_u32(tb[NFTA_VERDICT_CODE]));
switch(data->verdict) {
@@ -193,6 +196,9 @@ int nftnl_parse_data(union nftnl_data_reg *data, struct nlattr *attr, int *type)
if (mnl_attr_parse_nested(attr, nftnl_data_parse_cb, tb) < 0)
return -1;
+ if (tb[NFTA_DATA_UNSPEC])
+ data->incomplete = true;
+
if (tb[NFTA_DATA_VALUE]) {
if (type)
*type = DATA_VALUE;
diff --git a/src/set_elem.c b/src/set_elem.c
index 9207a0dbd689..3531c0767e16 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -589,6 +589,11 @@ static int nftnl_set_elems_parse2(struct nftnl_set *s, const struct nlattr *nest
e->flags |= (1 << NFTNL_SET_ELEM_OBJREF);
}
+ if (!s->incomplete)
+ s->incomplete = e->key.incomplete ||
+ e->key_end.incomplete ||
+ e->data.incomplete;
+
/* Add this new element to this set */
list_add_tail(&e->head, &s->element_list);
--
2.45.2
next prev parent reply other threads:[~2024-10-07 10:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 9:49 [RFC libnftnl/nft 0/5] nftables: indicate presence of unsupported netlink attributes Florian Westphal
2024-10-07 9:49 ` [PATCH libnftnl 1/5] expr: add and use incomplete tag Florian Westphal
2024-10-08 11:13 ` Pablo Neira Ayuso
2024-10-08 12:17 ` Florian Westphal
2024-10-08 14:43 ` Pablo Neira Ayuso
2024-10-08 16:11 ` Florian Westphal
2024-10-07 9:49 ` Florian Westphal [this message]
2024-10-07 9:49 ` [PATCH libnftnl 3/5] libnftnl: add api to query dissection state Florian Westphal
2024-10-07 9:49 ` [PATCH nft 4/5] netlink: tell user if libnftnl detected unknown attributes/features Florian Westphal
2024-10-07 9:49 ` [PATCH nft 5/5] sets: inform user when set definition contains unknown attributes Florian Westphal
2024-10-16 17:07 ` [RFC libnftnl/nft 0/5] nftables: indicate presence of unsupported netlink attributes Phil Sutter
2024-10-16 18:34 ` Pablo Neira Ayuso
2024-10-16 19:04 ` Phil Sutter
2024-10-16 19:41 ` Jan Engelhardt
2024-10-16 19:28 ` Jan Engelhardt
2024-10-16 20:05 ` Phil Sutter
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=20241007094943.7544-3-fw@strlen.de \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.