From efdcd31610fe3dd94b93e8204639b00ca67fe992 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 1 Feb 2018 19:33:52 +0100 Subject: examples: do not call nftnl_batch_is_supported() This is only required by Linux kernel <= 3.16.x, that's too old and at that time nft was very limited in term of features, so let's remove this check from example files. Signed-off-by: Pablo Neira Ayuso --- examples/nft-set-add.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'examples/nft-set-add.c') diff --git a/examples/nft-set-add.c b/examples/nft-set-add.c index bdb9373..d8e3e4e 100644 --- a/examples/nft-set-add.c +++ b/examples/nft-set-add.c @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) uint8_t family; char buf[MNL_SOCKET_BUFFER_SIZE]; uint32_t seq = time(NULL); - int ret, batching; + int ret; if (argc != 4) { fprintf(stderr, "Usage: %s \n", argv[0]); @@ -92,18 +92,10 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - batching = nftnl_batch_is_supported(); - if (batching < 0) { - perror("cannot talk to nfnetlink"); - exit(EXIT_FAILURE); - } - batch = mnl_nlmsg_batch_start(buf, sizeof(buf)); - if (batching) { - nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++); - mnl_nlmsg_batch_next(batch); - } + nftnl_batch_begin(mnl_nlmsg_batch_current(batch), seq++); + mnl_nlmsg_batch_next(batch); nlh = nftnl_set_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch), NFT_MSG_NEWSET, family, @@ -113,10 +105,8 @@ int main(int argc, char *argv[]) nftnl_set_free(s); mnl_nlmsg_batch_next(batch); - if (batching) { - nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++); - mnl_nlmsg_batch_next(batch); - } + nftnl_batch_end(mnl_nlmsg_batch_current(batch), seq++); + mnl_nlmsg_batch_next(batch); ret = mnl_socket_sendto(nl, mnl_nlmsg_batch_head(batch), mnl_nlmsg_batch_size(batch)); -- cgit v1.2.3