diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:35:48 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:31 -0500 |
commit | 868c86bcb5bdea7ed8d45979b17bb919af9254db (patch) | |
tree | ebc232092d6a8a75261a9e3f698206cc09740fdf /net | |
parent | 2bda2853150e20ca2a44627d00b5f85af0b24a42 (diff) |
[NET]: annotate csum_ipv6_magic() callers in net/*
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ipv6.c | 2 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 14 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 4 | ||||
-rw-r--r-- | net/ipv6/netfilter.c | 5 | ||||
-rw-r--r-- | net/ipv6/raw.c | 11 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 8 | ||||
-rw-r--r-- | net/ipv6/udp.c | 9 |
7 files changed, 27 insertions, 26 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index e0a0607862ef..f28e406a4a1f 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -59,7 +59,7 @@ static void dccp_v6_hash(struct sock *sk) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /* add pseudo-header to DCCP checksum stored in skb->csum */ | 61 | /* add pseudo-header to DCCP checksum stored in skb->csum */ |
62 | static inline u16 dccp_v6_csum_finish(struct sk_buff *skb, | 62 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, |
63 | struct in6_addr *saddr, | 63 | struct in6_addr *saddr, |
64 | struct in6_addr *daddr) | 64 | struct in6_addr *daddr) |
65 | { | 65 | { |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index bd51847acd57..4ab8acf37b54 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -234,7 +234,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct | |||
234 | len, fl->proto, | 234 | len, fl->proto, |
235 | skb->csum); | 235 | skb->csum); |
236 | } else { | 236 | } else { |
237 | u32 tmp_csum = 0; | 237 | __wsum tmp_csum = 0; |
238 | 238 | ||
239 | skb_queue_walk(&sk->sk_write_queue, skb) { | 239 | skb_queue_walk(&sk->sk_write_queue, skb) { |
240 | tmp_csum = csum_add(tmp_csum, skb->csum); | 240 | tmp_csum = csum_add(tmp_csum, skb->csum); |
@@ -242,10 +242,10 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct | |||
242 | 242 | ||
243 | tmp_csum = csum_partial((char *)icmp6h, | 243 | tmp_csum = csum_partial((char *)icmp6h, |
244 | sizeof(struct icmp6hdr), tmp_csum); | 244 | sizeof(struct icmp6hdr), tmp_csum); |
245 | tmp_csum = csum_ipv6_magic(&fl->fl6_src, | 245 | icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src, |
246 | &fl->fl6_dst, | 246 | &fl->fl6_dst, |
247 | len, fl->proto, tmp_csum); | 247 | len, fl->proto, |
248 | icmp6h->icmp6_cksum = tmp_csum; | 248 | tmp_csum); |
249 | } | 249 | } |
250 | ip6_push_pending_frames(sk); | 250 | ip6_push_pending_frames(sk); |
251 | out: | 251 | out: |
@@ -636,8 +636,8 @@ static int icmpv6_rcv(struct sk_buff **pskb) | |||
636 | break; | 636 | break; |
637 | /* fall through */ | 637 | /* fall through */ |
638 | case CHECKSUM_NONE: | 638 | case CHECKSUM_NONE: |
639 | skb->csum = ~csum_ipv6_magic(saddr, daddr, skb->len, | 639 | skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len, |
640 | IPPROTO_ICMPV6, 0); | 640 | IPPROTO_ICMPV6, 0)); |
641 | if (__skb_checksum_complete(skb)) { | 641 | if (__skb_checksum_complete(skb)) { |
642 | LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n", | 642 | LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n", |
643 | NIP6(*saddr), NIP6(*daddr)); | 643 | NIP6(*saddr), NIP6(*daddr)); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index c006d02be8bc..a1c231a04ac2 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -91,7 +91,7 @@ struct mld2_grec { | |||
91 | struct mld2_report { | 91 | struct mld2_report { |
92 | __u8 type; | 92 | __u8 type; |
93 | __u8 resv1; | 93 | __u8 resv1; |
94 | __u16 csum; | 94 | __sum16 csum; |
95 | __be16 resv2; | 95 | __be16 resv2; |
96 | __be16 ngrec; | 96 | __be16 ngrec; |
97 | struct mld2_grec grec[0]; | 97 | struct mld2_grec grec[0]; |
@@ -100,7 +100,7 @@ struct mld2_report { | |||
100 | struct mld2_query { | 100 | struct mld2_query { |
101 | __u8 type; | 101 | __u8 type; |
102 | __u8 code; | 102 | __u8 code; |
103 | __u16 csum; | 103 | __sum16 csum; |
104 | __be16 mrc; | 104 | __be16 mrc; |
105 | __be16 resv1; | 105 | __be16 resv1; |
106 | struct in6_addr mca; | 106 | struct in6_addr mca; |
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index 646a47456fd4..8d1b542806c1 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -100,12 +100,13 @@ unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | |||
100 | } | 100 | } |
101 | /* fall through */ | 101 | /* fall through */ |
102 | case CHECKSUM_NONE: | 102 | case CHECKSUM_NONE: |
103 | skb->csum = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, | 103 | skb->csum = ~csum_unfold( |
104 | csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, | ||
104 | skb->len - dataoff, | 105 | skb->len - dataoff, |
105 | protocol, | 106 | protocol, |
106 | csum_sub(0, | 107 | csum_sub(0, |
107 | skb_checksum(skb, 0, | 108 | skb_checksum(skb, 0, |
108 | dataoff, 0))); | 109 | dataoff, 0)))); |
109 | csum = __skb_checksum_complete(skb); | 110 | csum = __skb_checksum_complete(skb); |
110 | } | 111 | } |
111 | return csum; | 112 | return csum; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index b03040a20814..cee5db27e8b4 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -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; |
@@ -532,14 +532,13 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, | |||
532 | if (unlikely(csum)) | 532 | if (unlikely(csum)) |
533 | tmp_csum = csum_sub(tmp_csum, csum); | 533 | tmp_csum = csum_sub(tmp_csum, 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 && fl->proto == IPPROTO_UDP) | 539 | if (tmp_csum == 0 && fl->proto == IPPROTO_UDP) |
540 | tmp_csum = -1; | 540 | tmp_csum = -1; |
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 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 53f270995d8a..394bc54c5c21 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -105,10 +105,10 @@ static void tcp_v6_hash(struct sock *sk) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | static __inline__ u16 tcp_v6_check(struct tcphdr *th, int len, | 108 | static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len, |
109 | struct in6_addr *saddr, | 109 | struct in6_addr *saddr, |
110 | struct in6_addr *daddr, | 110 | struct in6_addr *daddr, |
111 | unsigned long base) | 111 | __wsum base) |
112 | { | 112 | { |
113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); | 113 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); |
114 | } | 114 | } |
@@ -1537,8 +1537,8 @@ static int tcp_v6_checksum_init(struct sk_buff *skb) | |||
1537 | } | 1537 | } |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | skb->csum = ~tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, | 1540 | skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr, |
1541 | &skb->nh.ipv6h->daddr, 0); | 1541 | &skb->nh.ipv6h->daddr, 0)); |
1542 | 1542 | ||
1543 | if (skb->len <= 76) { | 1543 | if (skb->len <= 76) { |
1544 | return __skb_checksum_complete(skb); | 1544 | return __skb_checksum_complete(skb); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e6e1f85f1bbd..0d22008d522e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -383,9 +383,10 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh) | |||
383 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 383 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
384 | 384 | ||
385 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) | 385 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) |
386 | skb->csum = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, | 386 | skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, |
387 | &skb->nh.ipv6h->daddr, | 387 | &skb->nh.ipv6h->daddr, |
388 | skb->len, IPPROTO_UDP, 0); | 388 | ulen, IPPROTO_UDP, |
389 | 0)); | ||
389 | 390 | ||
390 | return (UDP_SKB_CB(skb)->partial_cov = 0); | 391 | return (UDP_SKB_CB(skb)->partial_cov = 0); |
391 | } | 392 | } |
@@ -511,7 +512,7 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up) | |||
511 | struct inet_sock *inet = inet_sk(sk); | 512 | struct inet_sock *inet = inet_sk(sk); |
512 | struct flowi *fl = &inet->cork.fl; | 513 | struct flowi *fl = &inet->cork.fl; |
513 | int err = 0; | 514 | int err = 0; |
514 | u32 csum = 0; | 515 | __wsum csum = 0; |
515 | 516 | ||
516 | /* Grab the skbuff where UDP header space exists. */ | 517 | /* Grab the skbuff where UDP header space exists. */ |
517 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) | 518 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) |