mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[NETFILTER]: nf_nat: use extension infrastructure
Signed-off-by: Yasuyuki Kozakai <[email protected]> Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
e54cbc1f91
commit
2d59e5ca8c
6 changed files with 73 additions and 36 deletions
|
|
@ -278,22 +278,5 @@ nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
|
|||
extern void
|
||||
nf_conntrack_unregister_cache(u_int32_t features);
|
||||
|
||||
/* valid combinations:
|
||||
* basic: nf_conn, nf_conn .. nf_conn_help
|
||||
* nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat .. nf_conn help
|
||||
*/
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#include <net/netfilter/nf_nat.h>
|
||||
static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
|
||||
{
|
||||
unsigned int offset = sizeof(struct nf_conn);
|
||||
|
||||
if (!(ct->features & NF_CT_F_NAT))
|
||||
return NULL;
|
||||
|
||||
offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
|
||||
return (struct nf_conn_nat *) ((void *)ct + offset);
|
||||
}
|
||||
#endif /* CONFIG_NF_NAT_NEEDED */
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _NF_CONNTRACK_H */
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
enum nf_ct_ext_id
|
||||
{
|
||||
NF_CT_EXT_HELPER,
|
||||
NF_CT_EXT_NAT,
|
||||
NF_CT_EXT_NUM,
|
||||
};
|
||||
|
||||
#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
|
||||
#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
|
||||
|
||||
/* Extensions: optional stuff which isn't permanently in struct. */
|
||||
struct nf_ct_ext {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ struct nf_nat_multi_range_compat
|
|||
#ifdef __KERNEL__
|
||||
#include <linux/list.h>
|
||||
#include <linux/netfilter/nf_conntrack_pptp.h>
|
||||
#include <net/netfilter/nf_conntrack_extend.h>
|
||||
|
||||
struct nf_conn;
|
||||
|
||||
|
|
@ -89,6 +90,11 @@ extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
|
|||
extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
|
||||
const struct nf_conn *ignored_conntrack);
|
||||
|
||||
static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
|
||||
{
|
||||
return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
|
||||
}
|
||||
|
||||
extern int nf_nat_module_is_loaded;
|
||||
|
||||
#else /* !__KERNEL__: iptables wants this to compile. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue