diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-08-31 21:53:12 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-08-31 22:07:51 +0200 |
commit | 93483364369d8ef10d9e38018da02c6b0eae3077 (patch) | |
tree | 1d844375bdb5bec58f6725a0ceaf25316d545330 /tests/nft-expr_target-test.c | |
parent | fefd5494d5c23075bd90a41da9961ef8aeab5467 (diff) |
src: get rid of cached copies of x_tables.h and xt_LOG.h
Keeping the full cached copy the of x_tables.h file in tree is too much
for just the XT_EXTENSION_MAXNAMELEN constant. Similarly, xt_LOG.h is not
actually required by the tests, we can use any whatever syntetic data
to make sure the setter and getter provide the same result. So, let's
get rid of these headers from the library tree.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/nft-expr_target-test.c')
-rw-r--r-- | tests/nft-expr_target-test.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/tests/nft-expr_target-test.c b/tests/nft-expr_target-test.c index 9387779..838b3fd 100644 --- a/tests/nft-expr_target-test.c +++ b/tests/nft-expr_target-test.c @@ -15,8 +15,6 @@ #include <netinet/in.h> #include <netinet/ip.h> #include <linux/netfilter/nf_tables.h> -#include <linux/netfilter/xt_iprange.h> -#include <linux/netfilter/xt_LOG.h> #include <libmnl/libmnl.h> #include <libnftnl/rule.h> #include <libnftnl/expr.h> @@ -57,10 +55,10 @@ int main(int argc, char *argv[]) struct nft_rule *a, *b; struct nft_rule_expr *ex; struct nlmsghdr *nlh; - 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; + char data[16] = "0123456789abcdef"; a = nft_rule_alloc(); b = nft_rule_alloc(); @@ -70,18 +68,10 @@ int main(int argc, char *argv[]) ex = nft_rule_expr_alloc("target"); if (ex == NULL) print_err("OOM"); + 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 xt_log_info)); - if (info == NULL) - print_err("OOM"); - sprintf(info->prefix, "test: "); - info->prefix[sizeof(info->prefix)-1] = '\0'; - info->logflags = 0x0f; - info->level = 5; - nft_rule_expr_set(ex, NFT_EXPR_TG_INFO, info, sizeof(*info)); - + nft_rule_expr_set(ex, NFT_EXPR_TG_INFO, strdup(data), sizeof(data)); nft_rule_add_expr(a, ex); nlh = nft_rule_nlmsg_build_hdr(buf, NFT_MSG_NEWRULE, AF_INET, 0, 1234); |