Open GoogleCodeExporter opened 9 years ago
I think dpkt is neglecting to include a TCP pseudo-header. Working on a patch
now...
Original comment by crh0...@gmail.com
on 9 Nov 2010 at 8:10
OK, this was how I got it working correctly:
44,45c44,46
< # Get the checksum of concatenated pseudoheader+TCP packet
< self.data.sum = dpkt.in_cksum(s+p)
---
> s = dpkt.in_cksum_add(0, s)
> s = dpkt.in_cksum_add(s, p)
> self.data.sum = dpkt.in_cksum_done(s)
Original comment by crh0...@gmail.com
on 9 Nov 2010 at 8:29
Woops, sorry, here's a real patch. I didn't really have time to look at
in_cksum_add() so maybe that is what needs to be patched, but it makes sense to
me to just use in_cksum() for TCP as it is used for IP.
--- ip.py 2010-03-25 22:53:51.000000000 -0400
+++ ip.py 2010-11-09 15:28:35.000000000 -0500
@@ -41,9 +41,8 @@
p = str(self.data)
s = dpkt.struct.pack('>4s4sxBH', self.src, self.dst,
self.p, len(p))
- s = dpkt.in_cksum_add(0, s)
- s = dpkt.in_cksum_add(s, p)
- self.data.sum = dpkt.in_cksum_done(s)
+ # Get the checksum of concatenated pseudoheader+TCP packet
+ self.data.sum = dpkt.in_cksum(s+p)
if self.p == 17 and self.data.sum == 0:
self.data.sum = 0xffff # RFC 768
# XXX - skip transports which don't need the pseudoheader
Original comment by crh0...@gmail.com
on 9 Nov 2010 at 8:41
Original issue reported on code.google.com by
crh0...@gmail.com
on 9 Nov 2010 at 8:00