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-table-upd.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'examples/nft-table-upd.c') diff --git a/examples/nft-table-upd.c b/examples/nft-table-upd.c index 9b960bb..586d84c 100644 --- a/examples/nft-table-upd.c +++ b/examples/nft-table-upd.c @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) uint32_t portid, seq, table_seq, family, flags; struct nftnl_table *t = NULL; struct mnl_nlmsg_batch *batch; - int ret, batching; + int ret; if (argc != 4) { fprintf(stderr, "%s \n", argv[0]); @@ -41,19 +41,11 @@ 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); - } - seq = time(NULL); 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); if (strcmp(argv[1], "ip") == 0) family = NFPROTO_IPV4; @@ -91,10 +83,8 @@ int main(int argc, char *argv[]) nftnl_table_free(t); 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); nl = mnl_socket_open(NETLINK_NETFILTER); if (nl == NULL) { -- cgit v1.2.3