summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2012-12-14 12:42:48 +0100
committerFlorian Westphal <fw@strlen.de>2013-05-06 21:34:35 +0200
commit22c8af6991eab12a87fec4f06559e1d7ea3826f1 (patch)
tree56bd05aa44b7273770a471e0bee2677282de45eb /examples
parentd5e1f43e14bff7072e5a7a232bb2b04fcd710d52 (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 'examples')
-rw-r--r--examples/nfct-mnl-set-label.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/nfct-mnl-set-label.c b/examples/nfct-mnl-set-label.c
index 9e7fbf6..c52b267 100644
--- a/examples/nfct-mnl-set-label.c
+++ b/examples/nfct-mnl-set-label.c
@@ -35,6 +35,14 @@ static void set_label(struct nf_conntrack *ct, struct callback_args *cbargs)
nfct_bitmask_set_bit(b, bit);
nfct_set_attr(ct, ATTR_CONNLABELS, b);
+ if (bit >= 0) {
+ b = nfct_bitmask_new(bit);
+ if (b) {
+ nfct_bitmask_set_bit(b, bit);
+ nfct_set_attr(ct, ATTR_CONNLABELS_MASK, b);
+ }
+ }
+
cbargs->seq++;
nlh = mnl_nlmsg_put_header(buf);