udp: call __skb_checksum_complete when doing full checksum
authorTom Herbert <therbert@google.com>
Sun, 15 Jun 2014 06:24:20 +0000 (23:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Jun 2014 08:00:49 +0000 (01:00 -0700)
In __udp_lib_checksum_complete check if checksum is being done over all
the data (len is equal to skb->len) and if it is call
__skb_checksum_complete instead of __skb_checksum_complete_head. This
allows checksum to be saved in checksum complete.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/udp.h

index 2ecfc6e156098dbd37b3763a3040109a19e85810..68a1fefe3dfe46c3fc8f4847fa074fdb237573bb 100644 (file)
@@ -111,7 +111,9 @@ struct sk_buff;
  */
 static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
 {
-       return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov);
+       return (UDP_SKB_CB(skb)->cscov == skb->len ?
+               __skb_checksum_complete(skb) :
+               __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov));
 }
 
 static inline int udp_lib_checksum_complete(struct sk_buff *skb)