From 8e63e483240687ee4c4325073d84926e39416bc9 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 4 Jan 2012 17:16:39 +0100 Subject: 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 --- qa/test_api.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'qa/test_api.c') 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 #include #include +#include #include #include @@ -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; } -- cgit v1.2.3