diff options
author | Harald Welte <laforge@netfilter.org> | 2006-03-20 20:56:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 20:56:32 -0500 |
commit | dc808fe28db59fadf4ec32d53f62477fa28f3be8 (patch) | |
tree | 2d7033e5808a63d7fb1bddc452d1ec0b2f3d381a /net/ipv4 | |
parent | 0d36f37bb1e1cbadca6dc90a840bb2bc9ab51c44 (diff) |
[NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
This patch moves all helper related data fields of 'struct nf_conn'
into a separate structure 'struct nf_conn_help'. This new structure
is only present in conntrack entries for which we actually have a
helper loaded.
Also, this patch cleans up the nf_conntrack 'features' mechanism to
resemble what the original idea was: Just glue the feature-specific
data structures at the end of 'struct nf_conn', and explicitly
re-calculate the pointer to it when needed rather than keeping
pointers around.
Saves 20 bytes per conntrack on my x86_64 box. A non-helped conntrack
is 276 bytes. We still need to save another 20 bytes in order to fit
into to target of 256bytes.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 6c8624a54933..cb9c661f3f33 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -141,19 +141,21 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum, | |||
141 | { | 141 | { |
142 | struct nf_conn *ct; | 142 | struct nf_conn *ct; |
143 | enum ip_conntrack_info ctinfo; | 143 | enum ip_conntrack_info ctinfo; |
144 | struct nf_conn_help *help; | ||
144 | 145 | ||
145 | /* This is where we call the helper: as the packet goes out. */ | 146 | /* This is where we call the helper: as the packet goes out. */ |
146 | ct = nf_ct_get(*pskb, &ctinfo); | 147 | ct = nf_ct_get(*pskb, &ctinfo); |
147 | if (ct && ct->helper) { | 148 | if (!ct) |
148 | unsigned int ret; | 149 | return NF_ACCEPT; |
149 | ret = ct->helper->help(pskb, | 150 | |
150 | (*pskb)->nh.raw - (*pskb)->data | 151 | help = nfct_help(ct); |
151 | + (*pskb)->nh.iph->ihl*4, | 152 | if (!help || !help->helper) |
152 | ct, ctinfo); | 153 | return NF_ACCEPT; |
153 | if (ret != NF_ACCEPT) | 154 | |
154 | return ret; | 155 | return help->helper->help(pskb, |
155 | } | 156 | (*pskb)->nh.raw - (*pskb)->data |
156 | return NF_ACCEPT; | 157 | + (*pskb)->nh.iph->ihl*4, |
158 | ct, ctinfo); | ||
157 | } | 159 | } |
158 | 160 | ||
159 | static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, | 161 | static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, |