tests: fix deprecation warning xt_LOG
PATCH 1/2 tests: fix deprecation warning xt_LOG
This fix the warning:
In file included from nft-expr_target-test.c:19:0:/usr/include/linux/netfilter_ipv4/ipt_LOG.h:4:2: warning:
#warning "Please update iptables, this file will be removed soon!" [-Wcpp]
--- tests/nft-expr_target-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/nft-expr_target-test.c +3 -3
@@ -16,7 +16,7 @@#include <netinet/ip.h> #include <linux/netfilter/nf_tables.h> #include <linux/netfilter/xt_iprange.h> -#include <linux/netfilter_ipv4/ipt_LOG.h> +#include <linux/netfilter/xt_LOG.h> #include <libmnl/libmnl.h> #include <libnftables/rule.h> #include <libnftables/expr.h>
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])struct nft_rule *a, *b;struct nft_rule_expr *ex;struct nlmsghdr *nlh; -struct ipt_log_info *info; +struct xt_log_info *info;char buf[4096 ];struct nft_rule_expr_iter *iter_a, *iter_b;struct nft_rule_expr *rule_a, *rule_b;
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])nft_rule_expr_set (ex,NFT_EXPR_TG_NAME ,"test" ,strlen ("test" ));nft_rule_expr_set_u32 (ex,NFT_EXPR_TG_REV ,0x12345678 ); - info =calloc (1 ,sizeof (struct ipt_log_info )); + info =calloc (1 ,sizeof (struct xt_log_info ));if (info ==NULL )print_err ("OOM" );sprintf (info->prefix,"test: " );
PATCH 2/2 tests: extend test-script to also tests parsing
Lets test the XML/JSON parsing with test-script.sh.
--- tests/test-script.sh | 2 ++ 1 file changed, 2 insertions(+)
tests/test-script.sh +2 -0
@@ -18,3 +18,5 @@ ./nft-rule-test ./nft-set-test ./nft-table-test +./nft-parsing-test xmlfiles +./nft-parsing-test jsonfiles
Re: [libnftables PATCH 2/2] tests: extend test-script to also tests parsing
Quoted 1 line · Arturo Borrero Gonzalez
Lets test the XML/JSON parsing with
test-script.sh.
Good, we have to make sure that new stuff also passes these tests.
Applied, thanks Arturo.
Quoted 5 lines · Arturo Borrero Gonzalez
This fix the warning:
In file included from nft-expr_target-test.c:19:0:
/usr/include/linux/netfilter_ipv4/ipt_LOG.h:4:2: warning:
#warning "Please update iptables, this file will be removed soon!" [-Wcpp]
Applied. I have also included a copy of xt_LOG.h to avoid breaking the compilation of the library if that header is missing in the system. It's not installed and it's just a few extra bytes in the tree.
BTW, I remember that Eric asked to remove the compat part (LOG and iprange) that is included in the nft-rule-add example some time ago. Back then, we had no automated tests and it was providing a simple way to make sure that xtables compat stuff was still working over nftables. Now, I think it's better if we just include native nftables instructions there not to get people confused.
Would you rework the nft-rule-add.c to add a simple nftables rule using native instructions?
Thanks.