diff options
author | Florian Westphal <fw@strlen.de> | 2012-12-14 12:42:48 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2013-05-06 21:34:35 +0200 |
commit | 22c8af6991eab12a87fec4f06559e1d7ea3826f1 (patch) | |
tree | 56bd05aa44b7273770a471e0bee2677282de45eb /qa | |
parent | d5e1f43e14bff7072e5a7a232bb2b04fcd710d52 (diff) |
api: add CTA_LABEL_MASK attribute handling
allows to set/clear only a subset of the in-kernel label set, e.g.
"set bit 1 and do not change any others".
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'qa')
-rw-r--r-- | qa/test_api.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/qa/test_api.c b/qa/test_api.c index 399afdc..499d01f 100644 --- a/qa/test_api.c +++ b/qa/test_api.c @@ -91,7 +91,7 @@ int main(void) char data[256]; const char *val; int status; - struct nfct_bitmask *b; + struct nfct_bitmask *b, *b2; srand(time(NULL)); @@ -121,14 +121,23 @@ int main(void) eval_sigterm(status); } + b = nfct_bitmask_new(rand() & 0xffff); + assert(b); + b2 = nfct_bitmask_new(rand() & 0xffff); + assert(b2); + for (i=0; i<ATTR_MAX; i++) { - if (i != ATTR_CONNLABELS) { + switch (i) { + case ATTR_CONNLABELS: + nfct_set_attr(ct, i, b); + break; + case ATTR_CONNLABELS_MASK: + nfct_set_attr(ct, i, b2); + break; + default: nfct_set_attr(ct, i, data); - continue; + break; } - b = nfct_bitmask_new(rand() & 0xffff); - assert(b); - nfct_set_attr(ct, i, b); } printf("== test get API ==\n"); @@ -162,6 +171,7 @@ int main(void) nfct_set_attr_l(ct, i, data, sizeof(data)); break; case ATTR_CONNLABELS: + case ATTR_CONNLABELS_MASK: /* already set above */ break; default: @@ -173,6 +183,9 @@ int main(void) case ATTR_CONNLABELS: assert((void *) val == b); continue; + case ATTR_CONNLABELS_MASK: + assert((void *) val == b2); + continue; } if (val[0] != data[0]) { |