|
@@ -19,6 +19,7 @@
|
|
#include <net/netfilter/nf_conntrack_tuple.h>
|
|
#include <net/netfilter/nf_conntrack_tuple.h>
|
|
#include <net/netfilter/nf_conntrack_helper.h>
|
|
#include <net/netfilter/nf_conntrack_helper.h>
|
|
#include <net/netfilter/nf_conntrack_ecache.h>
|
|
#include <net/netfilter/nf_conntrack_ecache.h>
|
|
|
|
+#include <net/netfilter/nf_conntrack_labels.h>
|
|
|
|
|
|
struct nft_ct {
|
|
struct nft_ct {
|
|
enum nft_ct_keys key:8;
|
|
enum nft_ct_keys key:8;
|
|
@@ -97,6 +98,26 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
|
|
goto err;
|
|
goto err;
|
|
strncpy((char *)dest->data, helper->name, sizeof(dest->data));
|
|
strncpy((char *)dest->data, helper->name, sizeof(dest->data));
|
|
return;
|
|
return;
|
|
|
|
+#ifdef CONFIG_NF_CONNTRACK_LABELS
|
|
|
|
+ case NFT_CT_LABELS: {
|
|
|
|
+ struct nf_conn_labels *labels = nf_ct_labels_find(ct);
|
|
|
|
+ unsigned int size;
|
|
|
|
+
|
|
|
|
+ if (!labels) {
|
|
|
|
+ memset(dest->data, 0, sizeof(dest->data));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BUILD_BUG_ON(NF_CT_LABELS_MAX_SIZE > sizeof(dest->data));
|
|
|
|
+ size = labels->words * sizeof(long);
|
|
|
|
+
|
|
|
|
+ memcpy(dest->data, labels->bits, size);
|
|
|
|
+ if (size < sizeof(dest->data))
|
|
|
|
+ memset(((char *) dest->data) + size, 0,
|
|
|
|
+ sizeof(dest->data) - size);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
tuple = &ct->tuplehash[priv->dir].tuple;
|
|
tuple = &ct->tuplehash[priv->dir].tuple;
|
|
@@ -220,6 +241,9 @@ static int nft_ct_init_validate_get(const struct nft_expr *expr,
|
|
#endif
|
|
#endif
|
|
#ifdef CONFIG_NF_CONNTRACK_SECMARK
|
|
#ifdef CONFIG_NF_CONNTRACK_SECMARK
|
|
case NFT_CT_SECMARK:
|
|
case NFT_CT_SECMARK:
|
|
|
|
+#endif
|
|
|
|
+#ifdef CONFIG_NF_CONNTRACK_LABELS
|
|
|
|
+ case NFT_CT_LABELS:
|
|
#endif
|
|
#endif
|
|
case NFT_CT_EXPIRATION:
|
|
case NFT_CT_EXPIRATION:
|
|
case NFT_CT_HELPER:
|
|
case NFT_CT_HELPER:
|