diff options
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index d6dedc4aec77..c2e629d6aea4 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -220,7 +220,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
220 | struct inet_sock *inet = inet_sk(sk); | 220 | struct inet_sock *inet = inet_sk(sk); |
221 | struct ipv6_pinfo *np = inet6_sk(sk); | 221 | struct ipv6_pinfo *np = inet6_sk(sk); |
222 | struct sockaddr_in6 *addr = (struct sockaddr_in6 *) uaddr; | 222 | struct sockaddr_in6 *addr = (struct sockaddr_in6 *) uaddr; |
223 | __u32 v4addr = 0; | 223 | __be32 v4addr = 0; |
224 | int addr_type; | 224 | int addr_type; |
225 | int err; | 225 | int err; |
226 | 226 | ||
@@ -290,7 +290,7 @@ out: | |||
290 | 290 | ||
291 | void rawv6_err(struct sock *sk, struct sk_buff *skb, | 291 | void rawv6_err(struct sock *sk, struct sk_buff *skb, |
292 | struct inet6_skb_parm *opt, | 292 | struct inet6_skb_parm *opt, |
293 | int type, int code, int offset, u32 info) | 293 | int type, int code, int offset, __be32 info) |
294 | { | 294 | { |
295 | struct inet_sock *inet = inet_sk(sk); | 295 | struct inet_sock *inet = inet_sk(sk); |
296 | struct ipv6_pinfo *np = inet6_sk(sk); | 296 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -370,9 +370,9 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
370 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 370 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
371 | } | 371 | } |
372 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) | 372 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) |
373 | skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, | 373 | skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, |
374 | &skb->nh.ipv6h->daddr, | 374 | &skb->nh.ipv6h->daddr, |
375 | skb->len, inet->num, 0); | 375 | skb->len, inet->num, 0)); |
376 | 376 | ||
377 | if (inet->hdrincl) { | 377 | if (inet->hdrincl) { |
378 | if (skb_checksum_complete(skb)) { | 378 | if (skb_checksum_complete(skb)) { |
@@ -479,8 +479,8 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, | |||
479 | int offset; | 479 | int offset; |
480 | int len; | 480 | int len; |
481 | int total_len; | 481 | int total_len; |
482 | u32 tmp_csum; | 482 | __wsum tmp_csum; |
483 | u16 csum; | 483 | __sum16 csum; |
484 | 484 | ||
485 | if (!rp->checksum) | 485 | if (!rp->checksum) |
486 | goto send; | 486 | goto send; |
@@ -530,16 +530,15 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, | |||
530 | 530 | ||
531 | /* in case cksum was not initialized */ | 531 | /* in case cksum was not initialized */ |
532 | if (unlikely(csum)) | 532 | if (unlikely(csum)) |
533 | tmp_csum = csum_sub(tmp_csum, csum); | 533 | tmp_csum = csum_sub(tmp_csum, csum_unfold(csum)); |
534 | 534 | ||
535 | tmp_csum = csum_ipv6_magic(&fl->fl6_src, | 535 | csum = csum_ipv6_magic(&fl->fl6_src, |
536 | &fl->fl6_dst, | 536 | &fl->fl6_dst, |
537 | total_len, fl->proto, tmp_csum); | 537 | total_len, fl->proto, tmp_csum); |
538 | 538 | ||
539 | if (tmp_csum == 0) | 539 | if (csum == 0 && fl->proto == IPPROTO_UDP) |
540 | tmp_csum = -1; | 540 | csum = CSUM_MANGLED_0; |
541 | 541 | ||
542 | csum = tmp_csum; | ||
543 | if (skb_store_bits(skb, offset, &csum, 2)) | 542 | if (skb_store_bits(skb, offset, &csum, 2)) |
544 | BUG(); | 543 | BUG(); |
545 | 544 | ||
@@ -586,7 +585,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
586 | if (err) | 585 | if (err) |
587 | goto error_fault; | 586 | goto error_fault; |
588 | 587 | ||
589 | IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); | 588 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); |
590 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev, | 589 | err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev, |
591 | dst_output); | 590 | dst_output); |
592 | if (err > 0) | 591 | if (err > 0) |
@@ -600,7 +599,7 @@ error_fault: | |||
600 | err = -EFAULT; | 599 | err = -EFAULT; |
601 | kfree_skb(skb); | 600 | kfree_skb(skb); |
602 | error: | 601 | error: |
603 | IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS); | 602 | IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
604 | return err; | 603 | return err; |
605 | } | 604 | } |
606 | 605 | ||