summaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_tables_api.c
diff options
context:
space:
mode:
authorPatrick McHardy2015-04-11 03:27:36 +0200
committerPablo Neira Ayuso2015-04-13 17:17:28 +0200
commitb1c96ed37ceeef5573402d4af202897edaf1e4b8 (patch)
tree8c3664e72dad22a859712a91a49d332cbd28801c /net/netfilter/nf_tables_api.c
parentnetfilter: nf_tables: convert sets to u32 data pointers (diff)
downloadkernel-qcow2-linux-b1c96ed37ceeef5573402d4af202897edaf1e4b8.tar.gz
kernel-qcow2-linux-b1c96ed37ceeef5573402d4af202897edaf1e4b8.tar.xz
kernel-qcow2-linux-b1c96ed37ceeef5573402d4af202897edaf1e4b8.zip
netfilter: nf_tables: add register parsing/dumping helpers
Add helper functions to parse and dump register values in netlink attributes. These helpers will later be changed to take care of translation between the old 128 bit and the new 32 bit register numbers. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_tables_api.c')
-rw-r--r--net/netfilter/nf_tables_api.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 0bb16a1561d2..a25fd19453e7 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4122,6 +4122,18 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
return 0;
}
+unsigned int nft_parse_register(const struct nlattr *attr)
+{
+ return ntohl(nla_get_be32(attr));
+}
+EXPORT_SYMBOL_GPL(nft_parse_register);
+
+int nft_dump_register(struct sk_buff *skb, unsigned int attr, unsigned int reg)
+{
+ return nla_put_be32(skb, attr, htonl(reg));
+}
+EXPORT_SYMBOL_GPL(nft_dump_register);
+
/**
* nft_validate_register_load - validate a load from a register
*