Add a function to remove expression from the rule list. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- include/libnftnl/rule.h | 1 + src/libnftnl.map | 1 + src/rule.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h index e5d1ca0534b7..b6b93c62b840 100644 --- a/include/libnftnl/rule.h +++ b/include/libnftnl/rule.h @@ -51,6 +51,7 @@ uint32_t nftnl_rule_get_u32(const struct nftnl_rule *r, uint16_t attr); uint64_t nftnl_rule_get_u64(const struct nftnl_rule *r, uint16_t attr); void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr); +void nftnl_rule_del_expr(struct nftnl_expr *expr); struct nlmsghdr; diff --git a/src/libnftnl.map b/src/libnftnl.map index 7937e05b669d..2d35ace0355b 100644 --- a/src/libnftnl.map +++ b/src/libnftnl.map @@ -372,4 +372,5 @@ LIBNFTNL_14 { LIBNFTNL_15 { nftnl_obj_get_data; nftnl_expr_build_payload; + nftnl_rule_del_expr; } LIBNFTNL_14; diff --git a/src/rule.c b/src/rule.c index 8d7e0681cb42..480afc8ffc1b 100644 --- a/src/rule.c +++ b/src/rule.c @@ -330,6 +330,12 @@ void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr) list_add_tail(&expr->head, &r->expr_list); } +EXPORT_SYMBOL(nftnl_rule_del_expr); +void nftnl_rule_del_expr(struct nftnl_expr *expr) +{ + list_del(&expr->head); +} + static int nftnl_rule_parse_attr_cb(const struct nlattr *attr, void *data) { const struct nlattr **tb = data; -- 2.20.1