aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>2007-07-08 01:23:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:17:18 -0400
commitceceae1b1555a9afcb8dacf90df5fa1f20fd5466 (patch)
tree008841923a297be92566c8da42f516ffe6c2cdc1 /include/net
parentecfab2c9fe5597221c2b30dec48634a2361a0d08 (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.h26
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h3
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
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
298static 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 */
313static 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);
30extern int nf_conntrack_proto_init(void); 30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void); 31extern void nf_conntrack_proto_fini(void);
32 32
33extern int nf_conntrack_helper_init(void);
34extern void nf_conntrack_helper_fini(void);
35
33struct nf_conntrack_l3proto; 36struct nf_conntrack_l3proto;
34extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); 37extern 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
6enum nf_ct_ext_id 6enum 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. */
12struct nf_ct_ext { 15struct 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
14struct module; 15struct module;
15 16
@@ -52,4 +53,8 @@ extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
52extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 53extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
53extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 54extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
54 55
56static 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*/