Permalink
Browse files

layers/tcpip: remove dead code in csum computation

Since the loop exits when csum fits in 16 bits, csum >> 16 is always 0.
It was probably an attempt to remove the loop (9688856 "Add serialization
to a number of layers.")
  • Loading branch information...
sentryo authored and gconnell committed Dec 9, 2016
1 parent 2f515f1 commit d3a88c0b09e3a8e82ea5dc039eeb5e8c53f0cfbc
Showing with 1 addition and 1 deletion.
  1. +1 −1 layers/tcpip.go
@@ -66,7 +66,7 @@ func tcpipChecksum(data []byte, csum uint32) uint16 {
for csum > 0xffff {
csum = (csum >> 16) + (csum & 0xffff)
}
return ^uint16(csum + (csum >> 16))
return ^uint16(csum)
}
// computeChecksum computes a TCP or UDP checksum. headerAndPayload is the

0 comments on commit d3a88c0

Please sign in to comment.