aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2014-09-23 07:30:41 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-09-29 05:28:03 -0400
commit9363dc4b599949bde338cdaba1cf7cac243e4e97 (patch)
tree65814529786415fa63587aa92a3538ef183aeecc
parent34666d467cbf1e2e3c7bb15a63eccfb582cdd71f (diff)
netfilter: nf_tables: store and dump set policy
We want to know in which cases the user explicitly sets the policy options. In that case, we also want to dump back the info. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/net/netfilter/nf_tables.h2
-rw-r--r--net/netfilter/nf_tables_api.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index c4d86198d3d6..3d7292392fac 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -241,6 +241,7 @@ void nft_unregister_set(struct nft_set_ops *ops);
241 * @dtype: data type (verdict or numeric type defined by userspace) 241 * @dtype: data type (verdict or numeric type defined by userspace)
242 * @size: maximum set size 242 * @size: maximum set size
243 * @nelems: number of elements 243 * @nelems: number of elements
244 * @policy: set parameterization (see enum nft_set_policies)
244 * @ops: set ops 245 * @ops: set ops
245 * @flags: set flags 246 * @flags: set flags
246 * @klen: key length 247 * @klen: key length
@@ -255,6 +256,7 @@ struct nft_set {
255 u32 dtype; 256 u32 dtype;
256 u32 size; 257 u32 size;
257 u32 nelems; 258 u32 nelems;
259 u16 policy;
258 /* runtime data below here */ 260 /* runtime data below here */
259 const struct nft_set_ops *ops ____cacheline_aligned; 261 const struct nft_set_ops *ops ____cacheline_aligned;
260 u16 flags; 262 u16 flags;
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index a476b9962155..19e79f0d9ad2 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2344,6 +2344,11 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx,
2344 goto nla_put_failure; 2344 goto nla_put_failure;
2345 } 2345 }
2346 2346
2347 if (set->policy != NFT_SET_POL_PERFORMANCE) {
2348 if (nla_put_be32(skb, NFTA_SET_POLICY, htonl(set->policy)))
2349 goto nla_put_failure;
2350 }
2351
2347 desc = nla_nest_start(skb, NFTA_SET_DESC); 2352 desc = nla_nest_start(skb, NFTA_SET_DESC);
2348 if (desc == NULL) 2353 if (desc == NULL)
2349 goto nla_put_failure; 2354 goto nla_put_failure;
@@ -2669,6 +2674,7 @@ static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb,
2669 set->dlen = desc.dlen; 2674 set->dlen = desc.dlen;
2670 set->flags = flags; 2675 set->flags = flags;
2671 set->size = desc.size; 2676 set->size = desc.size;
2677 set->policy = policy;
2672 2678
2673 err = ops->init(set, &desc, nla); 2679 err = ops->init(set, &desc, nla);
2674 if (err < 0) 2680 if (err < 0)