2 * Copyright (c) 2014 Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/netlink.h>
13 #include <linux/netfilter.h>
14 #include <linux/netfilter/nf_tables.h>
15 #include <net/netfilter/nf_tables.h>
16 #include <net/netfilter/nf_nat.h>
17 #include <net/netfilter/nft_masq.h>
19 const struct nla_policy nft_masq_policy
[NFTA_MASQ_MAX
+ 1] = {
20 [NFTA_MASQ_FLAGS
] = { .type
= NLA_U32
},
22 EXPORT_SYMBOL_GPL(nft_masq_policy
);
24 int nft_masq_init(const struct nft_ctx
*ctx
,
25 const struct nft_expr
*expr
,
26 const struct nlattr
* const tb
[])
28 struct nft_masq
*priv
= nft_expr_priv(expr
);
30 if (tb
[NFTA_MASQ_FLAGS
] == NULL
)
33 priv
->flags
= ntohl(nla_get_be32(tb
[NFTA_MASQ_FLAGS
]));
34 if (priv
->flags
& ~NF_NAT_RANGE_MASK
)
39 EXPORT_SYMBOL_GPL(nft_masq_init
);
41 int nft_masq_dump(struct sk_buff
*skb
, const struct nft_expr
*expr
)
43 const struct nft_masq
*priv
= nft_expr_priv(expr
);
48 if (nla_put_be32(skb
, NFTA_MASQ_FLAGS
, htonl(priv
->flags
)))
56 EXPORT_SYMBOL_GPL(nft_masq_dump
);
58 MODULE_LICENSE("GPL");
59 MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>");