aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/utils.c
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/core/utils.c
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/core/utils.c')
-rw-r--r--net/core/utils.c16
1 files changed, 16 insertions, 0 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);