diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2007-07-08 01:23:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:17:18 -0400 |
commit | ceceae1b1555a9afcb8dacf90df5fa1f20fd5466 (patch) | |
tree | 008841923a297be92566c8da42f516ffe6c2cdc1 /include/net | |
parent | ecfab2c9fe5597221c2b30dec48634a2361a0d08 (diff) |
[NETFILTER]: nf_conntrack: use extension infrastructure for helper
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/net')
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 26 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_core.h | 3 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_extend.h | 3 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_helper.h | 5 |
4 files changed, 11 insertions, 26 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index c31382d3ef11..f1e0fee9aa9c 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -294,32 +294,6 @@ static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) | |||
294 | offset = ALIGN(offset, __alignof__(struct nf_conn_nat)); | 294 | offset = ALIGN(offset, __alignof__(struct nf_conn_nat)); |
295 | return (struct nf_conn_nat *) ((void *)ct + offset); | 295 | return (struct nf_conn_nat *) ((void *)ct + offset); |
296 | } | 296 | } |
297 | |||
298 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | ||
299 | { | ||
300 | unsigned int offset = sizeof(struct nf_conn); | ||
301 | |||
302 | if (!(ct->features & NF_CT_F_HELP)) | ||
303 | return NULL; | ||
304 | if (ct->features & NF_CT_F_NAT) { | ||
305 | offset = ALIGN(offset, __alignof__(struct nf_conn_nat)); | ||
306 | offset += sizeof(struct nf_conn_nat); | ||
307 | } | ||
308 | |||
309 | offset = ALIGN(offset, __alignof__(struct nf_conn_help)); | ||
310 | return (struct nf_conn_help *) ((void *)ct + offset); | ||
311 | } | ||
312 | #else /* No NAT */ | ||
313 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | ||
314 | { | ||
315 | unsigned int offset = sizeof(struct nf_conn); | ||
316 | |||
317 | if (!(ct->features & NF_CT_F_HELP)) | ||
318 | return NULL; | ||
319 | |||
320 | offset = ALIGN(offset, __alignof__(struct nf_conn_help)); | ||
321 | return (struct nf_conn_help *) ((void *)ct + offset); | ||
322 | } | ||
323 | #endif /* CONFIG_NF_NAT_NEEDED */ | 297 | #endif /* CONFIG_NF_NAT_NEEDED */ |
324 | #endif /* __KERNEL__ */ | 298 | #endif /* __KERNEL__ */ |
325 | #endif /* _NF_CONNTRACK_H */ | 299 | #endif /* _NF_CONNTRACK_H */ |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 9fb906688ffa..3bf7d05ea64d 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -30,6 +30,9 @@ extern void nf_conntrack_cleanup(void); | |||
30 | extern int nf_conntrack_proto_init(void); | 30 | extern int nf_conntrack_proto_init(void); |
31 | extern void nf_conntrack_proto_fini(void); | 31 | extern void nf_conntrack_proto_fini(void); |
32 | 32 | ||
33 | extern int nf_conntrack_helper_init(void); | ||
34 | extern void nf_conntrack_helper_fini(void); | ||
35 | |||
33 | struct nf_conntrack_l3proto; | 36 | struct nf_conntrack_l3proto; |
34 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | 37 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); |
35 | /* Like above, but you already have conntrack read lock. */ | 38 | /* Like above, but you already have conntrack read lock. */ |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 8a988d136465..05357dc5d2d2 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -5,9 +5,12 @@ | |||
5 | 5 | ||
6 | enum nf_ct_ext_id | 6 | enum nf_ct_ext_id |
7 | { | 7 | { |
8 | NF_CT_EXT_HELPER, | ||
8 | NF_CT_EXT_NUM, | 9 | NF_CT_EXT_NUM, |
9 | }; | 10 | }; |
10 | 11 | ||
12 | #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help | ||
13 | |||
11 | /* Extensions: optional stuff which isn't permanently in struct. */ | 14 | /* Extensions: optional stuff which isn't permanently in struct. */ |
12 | struct nf_ct_ext { | 15 | struct nf_ct_ext { |
13 | u8 offset[NF_CT_EXT_NUM]; | 16 | u8 offset[NF_CT_EXT_NUM]; |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index 8c72ac9f0ab8..b43a75ba44ac 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _NF_CONNTRACK_HELPER_H | 10 | #ifndef _NF_CONNTRACK_HELPER_H |
11 | #define _NF_CONNTRACK_HELPER_H | 11 | #define _NF_CONNTRACK_HELPER_H |
12 | #include <net/netfilter/nf_conntrack.h> | 12 | #include <net/netfilter/nf_conntrack.h> |
13 | #include <net/netfilter/nf_conntrack_extend.h> | ||
13 | 14 | ||
14 | struct module; | 15 | struct module; |
15 | 16 | ||
@@ -52,4 +53,8 @@ extern void nf_ct_helper_put(struct nf_conntrack_helper *helper); | |||
52 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | 53 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); |
53 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); | 54 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); |
54 | 55 | ||
56 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | ||
57 | { | ||
58 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); | ||
59 | } | ||
55 | #endif /*_NF_CONNTRACK_HELPER_H*/ | 60 | #endif /*_NF_CONNTRACK_HELPER_H*/ |