summaryrefslogtreecommitdiffstats
path: root/src/expr/dynset.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-01-13 16:27:50 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2021-01-13 16:30:12 +0100
commit20503ffb5cbbe75e03b34f0386d24badfd9cb299 (patch)
treecf5ec69c7bed66024897cdc01b9b37f60139766c /src/expr/dynset.c
parent373445dc54eda77fc7b64fddf5e7d35536df51b0 (diff)
dynset: add NFTNL_EXPR_DYNSET_FLAGS
This patch adds support for the dynset flags. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/dynset.c')
-rw-r--r--src/expr/dynset.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/expr/dynset.c b/src/expr/dynset.c
index f349a17..a9b11f2 100644
--- a/src/expr/dynset.c
+++ b/src/expr/dynset.c
@@ -29,6 +29,7 @@ struct nftnl_expr_dynset {
struct list_head expr_list;
char *set_name;
uint32_t set_id;
+ uint32_t dynset_flags;
};
static int
@@ -66,6 +67,9 @@ nftnl_expr_dynset_set(struct nftnl_expr *e, uint16_t type,
expr = (void *)data;
list_add(&expr->head, &dynset->expr_list);
break;
+ case NFTNL_EXPR_DYNSET_FLAGS:
+ memcpy(&dynset->dynset_flags, data, sizeof(dynset->dynset_flags));
+ break;
default:
return -1;
}
@@ -102,6 +106,9 @@ nftnl_expr_dynset_get(const struct nftnl_expr *e, uint16_t type,
list_for_each_entry(expr, &dynset->expr_list, head)
break;
return expr;
+ case NFTNL_EXPR_DYNSET_FLAGS:
+ *data_len = sizeof(dynset->dynset_flags);
+ return &dynset->dynset_flags;
}
return NULL;
}
@@ -119,6 +126,7 @@ static int nftnl_expr_dynset_cb(const struct nlattr *attr, void *data)
case NFTA_DYNSET_SREG_DATA:
case NFTA_DYNSET_SET_ID:
case NFTA_DYNSET_OP:
+ case NFTA_DYNSET_FLAGS:
if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0)
abi_breakage();
break;
@@ -182,6 +190,9 @@ nftnl_expr_dynset_build(struct nlmsghdr *nlh, const struct nftnl_expr *e)
mnl_attr_nest_end(nlh, nest1);
}
}
+ if (e->flags & (1 << NFTNL_EXPR_DYNSET_FLAGS))
+ mnl_attr_put_u32(nlh, NFTA_DYNSET_FLAGS,
+ htonl(dynset->dynset_flags));
}
EXPORT_SYMBOL(nftnl_expr_add_expr);
@@ -270,6 +281,10 @@ nftnl_expr_dynset_parse(struct nftnl_expr *e, struct nlattr *attr)
}
e->flags |= (1 << NFTNL_EXPR_DYNSET_EXPRESSIONS);
}
+ if (tb[NFTA_DYNSET_FLAGS]) {
+ dynset->dynset_flags = ntohl(mnl_attr_get_u32(tb[NFTA_DYNSET_FLAGS]));
+ e->flags |= (1 << NFTNL_EXPR_DYNSET_FLAGS);
+ }
return ret;
out_dynset_expr: