diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-11-15 06:23:24 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-11-15 06:23:24 -0500 |
commit | e0e76c83becc7536e8371e560504d836d34fcf7d (patch) | |
tree | 9a2f63014e06aee37815dfa20394a79c351739f0 | |
parent | 76a2d3bcfcc86e2a8044258515b86492a37631a3 (diff) |
netfilter: ct_extend: define NF_CT_EXT_* as needed
Less IDs make nf_ct_ext smaller.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | include/net/netfilter/nf_conntrack_ecache.h | 8 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_extend.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/nf_nat.h | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 96ba5f7dcab6..f596b60d6d75 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -23,12 +23,17 @@ struct nf_conntrack_ecache { | |||
23 | static inline struct nf_conntrack_ecache * | 23 | static inline struct nf_conntrack_ecache * |
24 | nf_ct_ecache_find(const struct nf_conn *ct) | 24 | nf_ct_ecache_find(const struct nf_conn *ct) |
25 | { | 25 | { |
26 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
26 | return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); | 27 | return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); |
28 | #else | ||
29 | return NULL; | ||
30 | #endif | ||
27 | } | 31 | } |
28 | 32 | ||
29 | static inline struct nf_conntrack_ecache * | 33 | static inline struct nf_conntrack_ecache * |
30 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) | 34 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) |
31 | { | 35 | { |
36 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
32 | struct net *net = nf_ct_net(ct); | 37 | struct net *net = nf_ct_net(ct); |
33 | struct nf_conntrack_ecache *e; | 38 | struct nf_conntrack_ecache *e; |
34 | 39 | ||
@@ -45,6 +50,9 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) | |||
45 | e->expmask = expmask; | 50 | e->expmask = expmask; |
46 | } | 51 | } |
47 | return e; | 52 | return e; |
53 | #else | ||
54 | return NULL; | ||
55 | #endif | ||
48 | }; | 56 | }; |
49 | 57 | ||
50 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 58 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 0772d296dfdb..1a9f96db3798 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -7,10 +7,16 @@ | |||
7 | 7 | ||
8 | enum nf_ct_ext_id { | 8 | enum nf_ct_ext_id { |
9 | NF_CT_EXT_HELPER, | 9 | NF_CT_EXT_HELPER, |
10 | #if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE) | ||
10 | NF_CT_EXT_NAT, | 11 | NF_CT_EXT_NAT, |
12 | #endif | ||
11 | NF_CT_EXT_ACCT, | 13 | NF_CT_EXT_ACCT, |
14 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
12 | NF_CT_EXT_ECACHE, | 15 | NF_CT_EXT_ECACHE, |
16 | #endif | ||
17 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
13 | NF_CT_EXT_ZONE, | 18 | NF_CT_EXT_ZONE, |
19 | #endif | ||
14 | NF_CT_EXT_NUM, | 20 | NF_CT_EXT_NUM, |
15 | }; | 21 | }; |
16 | 22 | ||
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index f5f09f032a90..e966092a36f1 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
@@ -84,7 +84,11 @@ extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | |||
84 | 84 | ||
85 | static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) | 85 | static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) |
86 | { | 86 | { |
87 | #if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE) | ||
87 | return nf_ct_ext_find(ct, NF_CT_EXT_NAT); | 88 | return nf_ct_ext_find(ct, NF_CT_EXT_NAT); |
89 | #else | ||
90 | return NULL; | ||
91 | #endif | ||
88 | } | 92 | } |
89 | 93 | ||
90 | #else /* !__KERNEL__: iptables wants this to compile. */ | 94 | #else /* !__KERNEL__: iptables wants this to compile. */ |