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>
This commit is contained in:
parent
76a2d3bcfc
commit
e0e76c83be
@ -23,12 +23,17 @@ struct nf_conntrack_ecache {
|
|||||||
static inline struct nf_conntrack_ecache *
|
static inline struct nf_conntrack_ecache *
|
||||||
nf_ct_ecache_find(const struct nf_conn *ct)
|
nf_ct_ecache_find(const struct nf_conn *ct)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||||
return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
|
return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct nf_conntrack_ecache *
|
static inline struct nf_conntrack_ecache *
|
||||||
nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
|
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 net *net = nf_ct_net(ct);
|
||||||
struct nf_conntrack_ecache *e;
|
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;
|
e->expmask = expmask;
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||||
|
@ -7,10 +7,16 @@
|
|||||||
|
|
||||||
enum nf_ct_ext_id {
|
enum nf_ct_ext_id {
|
||||||
NF_CT_EXT_HELPER,
|
NF_CT_EXT_HELPER,
|
||||||
|
#if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE)
|
||||||
NF_CT_EXT_NAT,
|
NF_CT_EXT_NAT,
|
||||||
|
#endif
|
||||||
NF_CT_EXT_ACCT,
|
NF_CT_EXT_ACCT,
|
||||||
|
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||||
NF_CT_EXT_ECACHE,
|
NF_CT_EXT_ECACHE,
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NF_CONNTRACK_ZONES
|
||||||
NF_CT_EXT_ZONE,
|
NF_CT_EXT_ZONE,
|
||||||
|
#endif
|
||||||
NF_CT_EXT_NUM,
|
NF_CT_EXT_NUM,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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)
|
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);
|
return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !__KERNEL__: iptables wants this to compile. */
|
#else /* !__KERNEL__: iptables wants this to compile. */
|
||||||
|
Loading…
Reference in New Issue
Block a user