diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2007-07-08 01:24:28 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:17:20 -0400 |
commit | 2d59e5ca8c7113ad91452f0f9259a4b55ee90323 (patch) | |
tree | 16ffd5284bb5462eaa3af285977389afefca54ca /include | |
parent | e54cbc1f91dea4f98b6209e693d3b5eae46321bd (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.h | 17 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_extend.h | 2 | ||||
-rw-r--r-- | include/net/netfilter/nf_nat.h | 6 |
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); | |||
278 | extern void | 278 | extern void |
279 | nf_conntrack_unregister_cache(u_int32_t features); | 279 | nf_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> | ||
287 | static 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 @@ | |||
6 | enum nf_ct_ext_id | 6 | enum 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. */ |
15 | struct nf_ct_ext { | 17 | struct 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 | ||
56 | struct nf_conn; | 57 | struct nf_conn; |
57 | 58 | ||
@@ -89,6 +90,11 @@ extern unsigned int nf_nat_setup_info(struct nf_conn *ct, | |||
89 | extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | 90 | extern 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 | ||
93 | static 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 | |||
92 | extern int nf_nat_module_is_loaded; | 98 | extern int nf_nat_module_is_loaded; |
93 | 99 | ||
94 | #else /* !__KERNEL__: iptables wants this to compile. */ | 100 | #else /* !__KERNEL__: iptables wants this to compile. */ |