summaryrefslogtreecommitdiffstats
path: root/src/mnl.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-03-07 15:23:33 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-03-07 15:23:52 +0100
commitd2b961353298b26b4e4a1d7eec19ea4ae5d41c47 (patch)
tree5b90788ba61d059b684b24244bb3fb9d54b92fa2 /src/mnl.c
parentfbcb888b311a9386f9e6cf8e36b32a270470e2e7 (diff)
src: remove unused batch support checks
Follow up after cc8c5fd02448 ("netlink: remove non-batching routine"). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/mnl.c')
-rw-r--r--src/mnl.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/mnl.c b/src/mnl.c
index 3d48bc1b..0bd7e552 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -1196,67 +1196,3 @@ int mnl_nft_event_listener(struct mnl_socket *nf_sock, unsigned int debug_mask,
}
return ret;
}
-
-static void nft_mnl_batch_put(char *buf, uint16_t type, uint32_t seqnum)
-{
- struct nlmsghdr *nlh;
- struct nfgenmsg *nfg;
-
- nlh = mnl_nlmsg_put_header(buf);
- nlh->nlmsg_type = type;
- nlh->nlmsg_flags = NLM_F_REQUEST;
- nlh->nlmsg_seq = seqnum;
-
- nfg = mnl_nlmsg_put_extra_header(nlh, sizeof(*nfg));
- nfg->nfgen_family = AF_INET;
- nfg->version = NFNETLINK_V0;
- nfg->res_id = NFNL_SUBSYS_NFTABLES;
-}
-
-bool mnl_batch_supported(struct mnl_socket *nf_sock, uint32_t *seqnum)
-{
- struct mnl_nlmsg_batch *b;
- char buf[MNL_SOCKET_BUFFER_SIZE];
- int ret;
-
- b = mnl_nlmsg_batch_start(buf, sizeof(buf));
-
- nft_mnl_batch_put(mnl_nlmsg_batch_current(b), NFNL_MSG_BATCH_BEGIN,
- mnl_seqnum_alloc(seqnum));
- mnl_nlmsg_batch_next(b);
-
- nftnl_nlmsg_build_hdr(mnl_nlmsg_batch_current(b), NFT_MSG_NEWSET,
- AF_INET, NLM_F_ACK, mnl_seqnum_alloc(seqnum));
- mnl_nlmsg_batch_next(b);
-
- nft_mnl_batch_put(mnl_nlmsg_batch_current(b), NFNL_MSG_BATCH_END,
- mnl_seqnum_alloc(seqnum));
- mnl_nlmsg_batch_next(b);
-
- ret = mnl_socket_sendto(nf_sock, mnl_nlmsg_batch_head(b),
- mnl_nlmsg_batch_size(b));
- if (ret < 0)
- goto err;
-
- mnl_nlmsg_batch_stop(b);
-
- ret = mnl_socket_recvfrom(nf_sock, buf, sizeof(buf));
- while (ret > 0) {
- ret = mnl_cb_run(buf, ret, 0, mnl_socket_get_portid(nf_sock),
- NULL, NULL);
- if (ret <= 0)
- break;
-
- ret = mnl_socket_recvfrom(nf_sock, buf, sizeof(buf));
- }
-
- /* We're sending an incomplete message to see if the kernel supports
- * set messages in batches. EINVAL means that we sent an incomplete
- * message with missing attributes. The kernel just ignores messages
- * that we cannot include in the batch.
- */
- return (ret == -1 && errno == EINVAL) ? true : false;
-err:
- mnl_nlmsg_batch_stop(b);
- return ret;
-}