summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-08-31 21:53:12 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-08-31 22:07:51 +0200
commit93483364369d8ef10d9e38018da02c6b0eae3077 (patch)
tree1d844375bdb5bec58f6725a0ceaf25316d545330 /tests
parentfefd5494d5c23075bd90a41da9961ef8aeab5467 (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')
-rw-r--r--tests/nft-expr_match-test.c15
-rw-r--r--tests/nft-expr_target-test.c16
2 files changed, 5 insertions, 26 deletions
diff --git a/tests/nft-expr_match-test.c b/tests/nft-expr_match-test.c
index 96b063a..784f2b2 100644
--- a/tests/nft-expr_match-test.c
+++ b/tests/nft-expr_match-test.c
@@ -16,7 +16,6 @@
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/netfilter/nf_tables.h>
-#include <linux/netfilter/xt_iprange.h>
#include <libmnl/libmnl.h>
#include <libnftnl/rule.h>
#include <libnftnl/expr.h>
@@ -60,7 +59,7 @@ int main(int argc, char *argv[])
char buf[4096];
struct nft_rule_expr_iter *iter_a, *iter_b;
struct nft_rule_expr *rule_a, *rule_b;
- struct xt_iprange_mtinfo *info;
+ char data[16] = "0123456789abcdef";
a = nft_rule_alloc();
b = nft_rule_alloc();
@@ -72,17 +71,7 @@ int main(int argc, char *argv[])
nft_rule_expr_set_str(ex, NFT_EXPR_MT_NAME, "Tests");
nft_rule_expr_set_u32(ex, NFT_EXPR_MT_REV, 0x12345678);
-
- info = calloc(1, sizeof(struct xt_iprange_mtinfo));
- if (info == NULL)
- print_err("OOM");
-
- info->src_min.ip = info->dst_min.ip = inet_addr("127.0.0.1");
- info->src_max.ip = info->dst_max.ip = inet_addr("127.0.0.1");
- info->flags = IPRANGE_SRC;
-
- nft_rule_expr_set(ex, NFT_EXPR_MT_INFO, info, sizeof(info));
-
+ nft_rule_expr_set(ex, NFT_EXPR_MT_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);
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);