summaryrefslogtreecommitdiffstats
path: root/qa
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 17:16:39 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 17:16:39 +0100
commit8e63e483240687ee4c4325073d84926e39416bc9 (patch)
tree54848f691373638fc54c84c5f87938e18977f6b1 /qa
parent849342adcb7099d23b39192a4369908bb0259eee (diff)
expect: add nfexp_cmp
This patch adds nfexp_cmp that allows you to compare two expectation objects. This includes the extension of test_api for this new function. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'qa')
-rw-r--r--qa/test_api.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/qa/test_api.c b/qa/test_api.c
index 1efaf2f..74f02d0 100644
--- a/qa/test_api.c
+++ b/qa/test_api.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include <sys/wait.h>
#include <errno.h>
@@ -33,7 +34,7 @@ int main(void)
{
int ret, i;
struct nf_conntrack *ct, *tmp;
- struct nf_expect *exp;
+ struct nf_expect *exp, *tmp_exp;
char data[32];
const char *val;
int status;
@@ -135,6 +136,11 @@ int main(void)
perror("nfexp_new");
return 0;
}
+ tmp_exp = nfexp_new();
+ if (!tmp_exp) {
+ perror("nfexp_new");
+ return 0;
+ }
printf("== test expect set API ==\n");
ret = fork();
@@ -180,8 +186,22 @@ int main(void)
eval_sigterm(status);
}
+ /* XXX: missing nfexp_copy API. */
+ memcpy(tmp_exp, exp, nfexp_maxsize());
+
+ printf("== test expect cmp API ==\n");
+ ret = fork();
+ if (ret == 0) {
+ nfexp_cmp(tmp_exp, exp, 0);
+ exit(0);
+ } else {
+ wait(&status);
+ eval_sigterm(status);
+ }
+
nfct_destroy(ct);
nfct_destroy(tmp);
nfexp_destroy(exp);
+ nfexp_destroy(tmp_exp);
return EXIT_SUCCESS;
}