summaryrefslogtreecommitdiffstats
path: root/examples/nft-rule-parse-add.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-02-01 19:33:52 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-02-14 19:51:01 +0100
commitefdcd31610fe3dd94b93e8204639b00ca67fe992 (patch)
tree068dbdcfe6243c282affcb3738d8c9ac5480b55e /examples/nft-rule-parse-add.c
parent179a43db739b8151d608452d01b66f65ac8aa5e5 (diff)
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 <pablo@netfilter.org>
Diffstat (limited to 'examples/nft-rule-parse-add.c')
-rw-r--r--examples/nft-rule-parse-add.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/examples/nft-rule-parse-add.c b/examples/nft-rule-parse-add.c
index e6946c8..3fcf269 100644
--- a/examples/nft-rule-parse-add.c
+++ b/examples/nft-rule-parse-add.c
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
struct nlmsghdr *nlh;
uint32_t portid, seq, rule_seq;
struct nftnl_rule *r;
- int ret, batching;
+ int ret;
uint16_t family, format, outformat;
if (argc < 3) {
@@ -103,19 +103,11 @@ int main(int argc, char *argv[])
nftnl_rule_fprintf(stdout, r, outformat, 0);
fprintf(stdout, "\n");
- 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);
rule_seq = seq;
family = nftnl_rule_get_u32(r, NFTNL_RULE_FAMILY);
@@ -127,10 +119,8 @@ int main(int argc, char *argv[])
nftnl_rule_free(r);
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) {