summaryrefslogtreecommitdiffstats
path: root/src/conntrack/build_mnl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conntrack/build_mnl.c')
-rw-r--r--src/conntrack/build_mnl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/conntrack/build_mnl.c b/src/conntrack/build_mnl.c
index 46aec8a..a666e01 100644
--- a/src/conntrack/build_mnl.c
+++ b/src/conntrack/build_mnl.c
@@ -10,6 +10,7 @@
*/
#include "internal/internal.h"
+#include <limits.h>
#include <libmnl/libmnl.h>
static int
@@ -379,6 +380,14 @@ nfct_build_zone(struct nlmsghdr *nlh, const struct nf_conntrack *ct)
return 0;
}
+static void
+nfct_build_labels(struct nlmsghdr *nlh, const struct nf_conntrack *ct)
+{
+ struct nfct_bitmask *b = ct->connlabels;
+ unsigned int size = b->words * sizeof(b->bits[0]);
+ mnl_attr_put(nlh, CTA_LABELS, size, b->bits);
+}
+
int
nfct_nlmsg_build(struct nlmsghdr *nlh, const struct nf_conntrack *ct)
{
@@ -475,5 +484,8 @@ nfct_nlmsg_build(struct nlmsghdr *nlh, const struct nf_conntrack *ct)
if (test_bit(ATTR_ZONE, ct->head.set))
nfct_build_zone(nlh, ct);
+ if (test_bit(ATTR_CONNLABELS, ct->head.set))
+ nfct_build_labels(nlh, ct);
+
return 0;
}