diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-27 23:34:53 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-01-03 14:21:53 +0100 |
commit | 4d38878b39be44ea3d6a146a7dd678c269a9804a (patch) | |
tree | 9eb1a2feeb21d5772c965dd49088a330e19db294 /src/mnl.c | |
parent | 4756d92e517ae1f7d662c0ed083b54d8dc822e4a (diff) |
src: add/create/delete stateful objects
This patch allows you to add and to delete objects, eg.
# nft add quota filter test 1234567 bytes
# nft list quotas
table ip filter {
quota test {
1234567 bytes
}
}
# nft delete quota filter test
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/mnl.c')
-rw-r--r-- | src/mnl.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -796,6 +796,36 @@ err: return NULL; } +int mnl_nft_obj_batch_add(struct nftnl_obj *nln, unsigned int flags, + uint32_t seqnum) +{ + struct nlmsghdr *nlh; + + nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), + NFT_MSG_NEWOBJ, + nftnl_obj_get_u32(nln, NFTNL_OBJ_FAMILY), + NLM_F_CREATE | flags, seqnum); + nftnl_obj_nlmsg_build_payload(nlh, nln); + mnl_nft_batch_continue(); + + return 0; +} + +int mnl_nft_obj_batch_del(struct nftnl_obj *nln, unsigned int flags, + uint32_t seqnum) +{ + struct nlmsghdr *nlh; + + nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), + NFT_MSG_DELOBJ, + nftnl_obj_get_u32(nln, NFTNL_OBJ_FAMILY), + flags, seqnum); + nftnl_obj_nlmsg_build_payload(nlh, nln); + mnl_nft_batch_continue(); + + return 0; +} + static int obj_cb(const struct nlmsghdr *nlh, void *data) { struct nftnl_obj_list *nln_list = data; |