diff options
Diffstat (limited to 'net/core/utils.c')
-rw-r--r-- | net/core/utils.c | 20 |
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 | } |
295 | EXPORT_SYMBOL(inet_proto_csum_replace4); | 295 | EXPORT_SYMBOL(inet_proto_csum_replace4); |
296 | 296 | ||
297 | void 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 | } | ||
315 | EXPORT_SYMBOL(inet_proto_csum_replace16); | ||
316 | |||
297 | int mac_pton(const char *s, u8 *mac) | 317 | int mac_pton(const char *s, u8 *mac) |
298 | { | 318 | { |
299 | int i; | 319 | int i; |