netfilter: define NF_CT_EXT_* as needed
Subsystems (3)
PATCH 1/1 netfilter: define NF_CT_EXT_* as needed
Signed-off-by Changli Gao <[email protected]>
--- include/net/netfilter/nf_conntrack_ecache.h | 8 ++++++++ include/net/netfilter/nf_conntrack_extend.h | 6 ++++++ include/net/netfilter/nf_nat.h | 4 ++++ 3 files changed, 18 insertions(+)
include/net/netfilter/nf_conntrack_ecache.h +8 -0
@@ -23,12 +23,17 @@ struct nf_conntrack_ecache {static inline struct nf_conntrack_ecache *nf_ct_ecache_find (const struct nf_conn *ct) { +#ifdef CONFIG_NF_CONNTRACK_EVENTS return nf_ct_ext_find (ct,NF_CT_EXT_ECACHE ); +#else +return NULL ; +#endif }static inline struct nf_conntrack_ecache *nf_ct_ecache_ext_add (struct nf_conn *ct,u16 ctmask,u16 expmask,gfp_t gfp) { +#ifdef CONFIG_NF_CONNTRACK_EVENTS struct net *net =nf_ct_net (ct);struct nf_conntrack_ecache *e;
@@ -45,6 +50,9 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) e->expmask = expmask; }return e; +#else +return NULL ; +#endif };#ifdef CONFIG_NF_CONNTRACK_EVENTS
include/net/netfilter/nf_conntrack_extend.h +6 -0
@@ -7,10 +7,16 @@enum nf_ct_ext_id {NF_CT_EXT_HELPER , +#if defined(CONFIG_NF_NAT ) || defined(CONFIG_NF_NAT_MODULE )NF_CT_EXT_NAT , +#endif NF_CT_EXT_ACCT , +#ifdef CONFIG_NF_CONNTRACK_EVENTS NF_CT_EXT_ECACHE , +#endif +#ifdef CONFIG_NF_CONNTRACK_ZONES NF_CT_EXT_ZONE , +#endif NF_CT_EXT_NUM , };
include/net/netfilter/nf_nat.h +4 -0
@@ -84,7 +84,11 @@ extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,static inline struct nf_conn_nat *nfct_nat (const struct nf_conn *ct) { +#if defined(CONFIG_NF_NAT ) || defined(CONFIG_NF_NAT_MODULE )return nf_ct_ext_find (ct,NF_CT_EXT_NAT ); +#else +return NULL ; +#endif }#else /* !__KERNEL__: iptables wants this to compile. */
Quoted 10 lines · Changli Gao
#ifdef
CONFIG_NF_CONNTRACK_EVENTSinclude/net/netfilter/nf_conntrack_extend.h +1
-0@@ -7,10 +7,16 @@enum nf_ct_ext_id {NF_CT_EXT_HELPER , +#if defined(CONFIG_NF_NAT ) || defined(CONFIG_NF_NAT_MODULE )
include/net/netfilter/nf_conntrack_extend.h line 20
Quoted 10 lines
include/net/netfilter/nf_conntrack_extend.h +5
-0NF_CT_EXT_NAT, +#endif NF_CT_EXT_ACCT, +#ifdef CONFIG_NF_CONNTRACK_EVENTS NF_CT_EXT_ECACHE, +#endif +#ifdef CONFIG_NF_CONNTRACK_ZONES NF_CT_EXT_ZONE, +#endif NF_CT_EXT_NUM,
What is the purpose of #ifdef'ing the extension IDs?
Quoted 8 lines · Patrick McHardy
Quoted 7 lines · Changli Gao
#ifdef
CONFIG_NF_CONNTRACK_EVENTSinclude/net/netfilter/nf_conntrack_extend.h +0
-0@@ -7,10 +7,16 @@
Quoted 16 lines
include/net/netfilter/nf_conntrack_extend.h line 20
Quoted 13 lines
include/net/netfilter/nf_conntrack_extend.h +6
-0enum nf_ct_ext_id { NF_CT_EXT_HELPER, +#if defined(CONFIG_NF_NAT ) || defined(CONFIG_NF_NAT_MODULE ) NF_CT_EXT_NAT, +#endif NF_CT_EXT_ACCT, +#ifdef CONFIG_NF_CONNTRACK_EVENTS NF_CT_EXT_ECACHE, +#endif +#ifdef CONFIG_NF_CONNTRACK_ZONES NF_CT_EXT_ZONE, +#endif NF_CT_EXT_NUM,What is the purpose of #ifdef'ing the extension IDs?
struct nf_ct_ext {
struct rcu_head rcu;
u8 offset[NF_CT_EXT_NUM];
u8 len;
char data[0];
};Less IDs make nf_ct_ext smaller.
Signature · 6 lines
Regards, Changli Gao([email protected]) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Changli Gao
Quoted 8 lines · Patrick McHardy
Quoted 7 lines · Changli Gao
#ifdef
CONFIG_NF_CONNTRACK_EVENTSinclude/net/netfilter/nf_conntrack_extend.h +0
-0@@ -7,10 +7,16 @@Quoted 16 lines
include/net/netfilter/nf_conntrack_extend.h line 20
Quoted 13 lines
include/net/netfilter/nf_conntrack_extend.h +6
-0enum nf_ct_ext_id {NF_CT_EXT_HELPER , +#if defined(CONFIG_NF_NAT ) || defined(CONFIG_NF_NAT_MODULE )NF_CT_EXT_NAT , +#endif NF_CT_EXT_ACCT , +#ifdef CONFIG_NF_CONNTRACK_EVENTS NF_CT_EXT_ECACHE , +#endif +#ifdef CONFIG_NF_CONNTRACK_ZONES NF_CT_EXT_ZONE , +#endif NF_CT_EXT_NUM ,What is the purpose of #ifdef'ing the extension IDs?
Quoted 8 lines
struct nf_ct_ext { struct rcu_head rcu; u8 offset[NF_CT_EXT_NUM]; u8 len; char data[0]; };Less IDs make
nf_ct_extsmaller.
Right, thanks for the explanation.
Patrick McHardy
AppliedQuoted 1 line · Changli Gao
Signed-off-by Changli Gao <[email protected]>
Applied. Please provide the intention of the patch in the changelog next time. I've now added your explanation.