summaryrefslogtreecommitdiffstats
path: root/examples/nft-rule-ct-helper-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nft-rule-ct-helper-add.c')
-rw-r--r--examples/nft-rule-ct-helper-add.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/nft-rule-ct-helper-add.c b/examples/nft-rule-ct-helper-add.c
index 632cc5c..eceb1cb 100644
--- a/examples/nft-rule-ct-helper-add.c
+++ b/examples/nft-rule-ct-helper-add.c
@@ -1,11 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* (C) 2012 by Pablo Neira Ayuso <pablo@netfilter.org>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
* This software has been sponsored by Sophos Astaro <http://www.sophos.com>
*/
@@ -89,8 +85,10 @@ int main(int argc, char *argv[])
family = NFPROTO_IPV4;
else if (strcmp(argv[1], "ip6") == 0)
family = NFPROTO_IPV6;
+ else if (strcmp(argv[1], "inet") == 0)
+ family = NFPROTO_INET;
else {
- fprintf(stderr, "Unknown family: ip, ip6\n");
+ fprintf(stderr, "Unknown family: ip, ip6, inet\n");
exit(EXIT_FAILURE);
}
@@ -115,11 +113,11 @@ int main(int argc, char *argv[])
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,
- nftnl_rule_get_u32(r, NFTNL_RULE_FAMILY),
- NLM_F_APPEND|NLM_F_CREATE|NLM_F_ACK, seq++);
-
+ nlh = nftnl_nlmsg_build_hdr(mnl_nlmsg_batch_current(batch),
+ NFT_MSG_NEWRULE,
+ nftnl_rule_get_u32(r, NFTNL_RULE_FAMILY),
+ NLM_F_APPEND | NLM_F_CREATE | NLM_F_ACK,
+ seq++);
nftnl_rule_nlmsg_build_payload(nlh, r);
nftnl_rule_free(r);
mnl_nlmsg_batch_next(batch);