diff options
author | Patrick McHardy <kaber@trash.net> | 2007-11-30 01:14:30 +1100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 14:55:14 -0800 |
commit | a99a00cf1adef2d3dce745c93c9cc8b0a1612c50 (patch) | |
tree | 4629669029f845ae141693578a899505cde577e9 /net | |
parent | 3159afe0d2c1994392c269cf9dee2797830d016b (diff) | |
download | linux-a99a00cf1adef2d3dce745c93c9cc8b0a1612c50.tar.bz2 |
[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.c | 16 | ||||
-rw-r--r-- | net/netfilter/core.c | 16 |
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: } EXPORT_SYMBOL(in6_pton); + +void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, + __be32 from, __be32 to, int pseudohdr) +{ + __be32 diff[] = { ~from, to }; + if (skb->ip_summed != CHECKSUM_PARTIAL) { + *sum = csum_fold(csum_partial(diff, sizeof(diff), + ~csum_unfold(*sum))); + if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr) + skb->csum = ~csum_partial(diff, sizeof(diff), + ~skb->csum); + } else if (pseudohdr) + *sum = ~csum_fold(csum_partial(diff, sizeof(diff), + csum_unfold(*sum))); +} +EXPORT_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) } EXPORT_SYMBOL(skb_make_writable); -void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, - __be32 from, __be32 to, int pseudohdr) -{ - __be32 diff[] = { ~from, to }; - if (skb->ip_summed != CHECKSUM_PARTIAL) { - *sum = csum_fold(csum_partial(diff, sizeof(diff), - ~csum_unfold(*sum))); - if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr) - skb->csum = ~csum_partial(diff, sizeof(diff), - ~skb->csum); - } else if (pseudohdr) - *sum = ~csum_fold(csum_partial(diff, sizeof(diff), - csum_unfold(*sum))); -} -EXPORT_SYMBOL(nf_proto_csum_replace4); - #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) /* This does not belong here, but locally generated errors need it if connection tracking in use: without this, connection may not be in hash table, and hence |