* [PATCH] netfilter: define NF_CT_EXT_* as needed
@ 2010-11-15 9:25 Changli Gao
2010-11-15 11:13 ` Patrick McHardy
2010-11-15 11:24 ` Patrick McHardy
0 siblings, 2 replies; 5+ messages in thread
From: Changli Gao @ 2010-11-15 9:25 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev, Changli Gao
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
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(+)
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 96ba5f7..f596b60 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 {
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
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 0772d29..1a9f96d 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -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,
};
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index f5f09f0..e966092 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,
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. */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: define NF_CT_EXT_* as needed
2010-11-15 9:25 [PATCH] netfilter: define NF_CT_EXT_* as needed Changli Gao
@ 2010-11-15 11:13 ` Patrick McHardy
2010-11-15 11:19 ` Changli Gao
2010-11-15 11:24 ` Patrick McHardy
1 sibling, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2010-11-15 11:13 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netfilter-devel, netdev
On 15.11.2010 10:25, Changli Gao wrote:
> #ifdef CONFIG_NF_CONNTRACK_EVENTS
> diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
> index 0772d29..1a9f96d 100644
> --- a/include/net/netfilter/nf_conntrack_extend.h
> +++ b/include/net/netfilter/nf_conntrack_extend.h
> @@ -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,
What is the purpose of #ifdef'ing the extension IDs?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: define NF_CT_EXT_* as needed
2010-11-15 11:13 ` Patrick McHardy
@ 2010-11-15 11:19 ` Changli Gao
2010-11-15 11:20 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Changli Gao @ 2010-11-15 11:19 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev
On Mon, Nov 15, 2010 at 7:13 PM, Patrick McHardy <kaber@trash.net> wrote:
> On 15.11.2010 10:25, Changli Gao wrote:
>> #ifdef CONFIG_NF_CONNTRACK_EVENTS
>> diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
>> index 0772d29..1a9f96d 100644
>> --- a/include/net/netfilter/nf_conntrack_extend.h
>> +++ b/include/net/netfilter/nf_conntrack_extend.h
>> @@ -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,
>
> 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.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: define NF_CT_EXT_* as needed
2010-11-15 11:19 ` Changli Gao
@ 2010-11-15 11:20 ` Patrick McHardy
0 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2010-11-15 11:20 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netfilter-devel, netdev
On 15.11.2010 12:19, Changli Gao wrote:
> On Mon, Nov 15, 2010 at 7:13 PM, Patrick McHardy <kaber@trash.net> wrote:
>> On 15.11.2010 10:25, Changli Gao wrote:
>>> #ifdef CONFIG_NF_CONNTRACK_EVENTS
>>> diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
>>> index 0772d29..1a9f96d 100644
>>> --- a/include/net/netfilter/nf_conntrack_extend.h
>>> +++ b/include/net/netfilter/nf_conntrack_extend.h
>>> @@ -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,
>>
>> 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.
Right, thanks for the explanation.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: define NF_CT_EXT_* as needed
2010-11-15 9:25 [PATCH] netfilter: define NF_CT_EXT_* as needed Changli Gao
2010-11-15 11:13 ` Patrick McHardy
@ 2010-11-15 11:24 ` Patrick McHardy
1 sibling, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2010-11-15 11:24 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netfilter-devel, netdev
On 15.11.2010 10:25, Changli Gao wrote:
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Applied. Please provide the intention of the patch in the changelog
next time. I've now added your explanation.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-11-15 11:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-15 9:25 [PATCH] netfilter: define NF_CT_EXT_* as needed Changli Gao
2010-11-15 11:13 ` Patrick McHardy
2010-11-15 11:19 ` Changli Gao
2010-11-15 11:20 ` Patrick McHardy
2010-11-15 11:24 ` Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).