aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/utils.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-10-15 11:20:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-15 11:20:54 -0400
commitdf9b42963f2d010ae3163a894ce22cf6b27cd344 (patch)
treef42f826d9bb975766c1a79986c39e64c9a900908 /net/core/utils.c
parent33766368f6532313571534f9112b1796d6651bbe (diff)
parentc3e7724b6bc2f25e46c38dbe68f09d71fafeafb8 (diff)
Merge remote-tracking branch 'wireless/master' into mac80211
Diffstat (limited to 'net/core/utils.c')
-rw-r--r--net/core/utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/core/utils.c b/net/core/utils.c
index 39895a65e54a..f5613d569c23 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -294,6 +294,26 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
294} 294}
295EXPORT_SYMBOL(inet_proto_csum_replace4); 295EXPORT_SYMBOL(inet_proto_csum_replace4);
296 296
297void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
298 const __be32 *from, const __be32 *to,
299 int pseudohdr)
300{
301 __be32 diff[] = {
302 ~from[0], ~from[1], ~from[2], ~from[3],
303 to[0], to[1], to[2], to[3],
304 };
305 if (skb->ip_summed != CHECKSUM_PARTIAL) {
306 *sum = csum_fold(csum_partial(diff, sizeof(diff),
307 ~csum_unfold(*sum)));
308 if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
309 skb->csum = ~csum_partial(diff, sizeof(diff),
310 ~skb->csum);
311 } else if (pseudohdr)
312 *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
313 csum_unfold(*sum)));
314}
315EXPORT_SYMBOL(inet_proto_csum_replace16);
316
297int mac_pton(const char *s, u8 *mac) 317int mac_pton(const char *s, u8 *mac)
298{ 318{
299 int i; 319 int i;