Like previous patch: Extend data and set representation to indicate an incomplete dissection. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- 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