summaryrefslogtreecommitdiffstats
path: root/examples/nft-rule-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nft-rule-add.c')
-rw-r--r--examples/nft-rule-add.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/examples/nft-rule-add.c b/examples/nft-rule-add.c
index 3aeb2e0..6aaf5a0 100644
--- a/examples/nft-rule-add.c
+++ b/examples/nft-rule-add.c
@@ -126,7 +126,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 || argc > 5) {
fprintf(stderr, "Usage: %s <family> <table> <chain>\n", argv[0]);
@@ -158,18 +158,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_rule_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
NFT_MSG_NEWRULE,
@@ -180,10 +172,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);
ret = mnl_socket_sendto(nl, mnl_nlmsg_batch_head(batch),
mnl_nlmsg_batch_size(batch));