aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-11-29 09:14:30 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:14 -0500
commita99a00cf1adef2d3dce745c93c9cc8b0a1612c50 (patch)
tree4629669029f845ae141693578a899505cde577e9 /net
parent3159afe0d2c1994392c269cf9dee2797830d016b (diff)
[NET]: Move netfilter checksum helpers to net/core/utils.c
This allows to get rid of the CONFIG_NETFILTER dependency of NET_ACT_NAT. This patch redefines the old names to keep the noise low, the next patch converts all users. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/utils.c16
-rw-r--r--net/netfilter/core.c16
2 files changed, 16 insertions, 16 deletions
diff --git a/net/core/utils.c b/net/core/utils.c
index 0bf17da40d52..34459c4c740c 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -293,3 +293,19 @@ out:
293} 293}
294 294
295EXPORT_SYMBOL(in6_pton); 295EXPORT_SYMBOL(in6_pton);
296
297void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
298 __be32 from, __be32 to, int pseudohdr)
299{
300 __be32 diff[] = { ~from, to };
301 if (skb->ip_summed != CHECKSUM_PARTIAL) {
302 *sum = csum_fold(csum_partial(diff, sizeof(diff),
303 ~csum_unfold(*sum)));
304 if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
305 skb->csum = ~csum_partial(diff, sizeof(diff),
306 ~skb->csum);
307 } else if (pseudohdr)
308 *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
309 csum_unfold(*sum)));
310}
311EXPORT_SYMBOL(inet_proto_csum_replace4);
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index bed9ba01e8ec..631d26948314 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -217,22 +217,6 @@ int skb_make_writable(struct sk_buff *skb, unsigned int writable_len)
217} 217}
218EXPORT_SYMBOL(skb_make_writable); 218EXPORT_SYMBOL(skb_make_writable);
219 219
220void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
221 __be32 from, __be32 to, int pseudohdr)
222{
223 __be32 diff[] = { ~from, to };
224 if (skb->ip_summed != CHECKSUM_PARTIAL) {
225 *sum = csum_fold(csum_partial(diff, sizeof(diff),
226 ~csum_unfold(*sum)));
227 if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
228 skb->csum = ~csum_partial(diff, sizeof(diff),
229 ~skb->csum);
230 } else if (pseudohdr)
231 *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
232 csum_unfold(*sum)));
233}
234EXPORT_SYMBOL(nf_proto_csum_replace4);
235
236#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 220#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
237/* This does not belong here, but locally generated errors need it if connection 221/* This does not belong here, but locally generated errors need it if connection
238 tracking in use: without this, connection may not be in hash table, and hence 222 tracking in use: without this, connection may not be in hash table, and hence