diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-09-08 15:07:05 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-09-08 15:08:22 +0200 |
commit | d423f0e99a3630a07f622a934f1041d55e8115c0 (patch) | |
tree | 23ab02c0855e121b04519d2cde329aecef212e59 /src | |
parent | 4a39d2d43695d954fda7c4a6de534e8b4b56c63c (diff) |
mnl: do not set NLM_F_CREATE in deletion requests
This flag is not legal there, it only makes sense for addition requests.
This patch has no impact at all in any of the nf_tables kernel versions.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/mnl.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -947,10 +947,13 @@ static int mnl_nft_setelem_batch(struct nftnl_set *nls, if (iter == NULL) memory_allocation_error(); + if (cmd == NFT_MSG_NEWSETELEM) + flags |= NLM_F_CREATE; + while (nftnl_set_elems_iter_cur(iter)) { nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), cmd, nftnl_set_get_u32(nls, NFTNL_SET_FAMILY), - NLM_F_CREATE | flags, seqnum); + flags, seqnum); ret = nftnl_set_elems_nlmsg_build_payload_iter(nlh, iter); mnl_nft_batch_continue(batch); if (ret <= 0) @@ -977,7 +980,7 @@ int mnl_nft_setelem_batch_flush(struct nftnl_set *nls, struct nftnl_batch *batch nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(batch), NFT_MSG_DELSETELEM, nftnl_set_get_u32(nls, NFTNL_SET_FAMILY), - NLM_F_CREATE | flags, seqnum); + flags, seqnum); nftnl_set_elems_nlmsg_build_payload(nlh, nls); mnl_nft_batch_continue(batch); |