aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>2007-07-08 01:24:28 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:17:20 -0400
commit2d59e5ca8c7113ad91452f0f9259a4b55ee90323 (patch)
tree16ffd5284bb5462eaa3af285977389afefca54ca /include
parente54cbc1f91dea4f98b6209e693d3b5eae46321bd (diff)
[NETFILTER]: nf_nat: use extension infrastructure
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/netfilter/nf_conntrack.h17
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h2
-rw-r--r--include/net/netfilter/nf_nat.h6
3 files changed, 8 insertions, 17 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index f1e0fee9aa9c..b2083d386f33 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -278,22 +278,5 @@ nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
278extern void 278extern void
279nf_conntrack_unregister_cache(u_int32_t features); 279nf_conntrack_unregister_cache(u_int32_t features);
280 280
281/* valid combinations:
282 * basic: nf_conn, nf_conn .. nf_conn_help
283 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat .. nf_conn help
284 */
285#ifdef CONFIG_NF_NAT_NEEDED
286#include <net/netfilter/nf_nat.h>
287static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
288{
289 unsigned int offset = sizeof(struct nf_conn);
290
291 if (!(ct->features & NF_CT_F_NAT))
292 return NULL;
293
294 offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
295 return (struct nf_conn_nat *) ((void *)ct + offset);
296}
297#endif /* CONFIG_NF_NAT_NEEDED */
298#endif /* __KERNEL__ */ 281#endif /* __KERNEL__ */
299#endif /* _NF_CONNTRACK_H */ 282#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 05357dc5d2d2..73b5711faf32 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -6,10 +6,12 @@
6enum nf_ct_ext_id 6enum nf_ct_ext_id
7{ 7{
8 NF_CT_EXT_HELPER, 8 NF_CT_EXT_HELPER,
9 NF_CT_EXT_NAT,
9 NF_CT_EXT_NUM, 10 NF_CT_EXT_NUM,
10}; 11};
11 12
12#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 13#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
14#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
13 15
14/* Extensions: optional stuff which isn't permanently in struct. */ 16/* Extensions: optional stuff which isn't permanently in struct. */
15struct nf_ct_ext { 17struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 575dc8ac48dc..0425e28c6a78 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -52,6 +52,7 @@ struct nf_nat_multi_range_compat
52#ifdef __KERNEL__ 52#ifdef __KERNEL__
53#include <linux/list.h> 53#include <linux/list.h>
54#include <linux/netfilter/nf_conntrack_pptp.h> 54#include <linux/netfilter/nf_conntrack_pptp.h>
55#include <net/netfilter/nf_conntrack_extend.h>
55 56
56struct nf_conn; 57struct nf_conn;
57 58
@@ -89,6 +90,11 @@ extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
89extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 90extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
90 const struct nf_conn *ignored_conntrack); 91 const struct nf_conn *ignored_conntrack);
91 92
93static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
94{
95 return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
96}
97
92extern int nf_nat_module_is_loaded; 98extern int nf_nat_module_is_loaded;
93 99
94#else /* !__KERNEL__: iptables wants this to compile. */ 100#else /* !__KERNEL__: iptables wants this to compile. */