fix ip header checksums

This commit is contained in:
pi-rho 2013-01-28 19:21:39 -06:00
parent d429c3c3f9
commit 3e1dfcba49
1 changed files with 1 additions and 1 deletions

View File

@ -232,7 +232,7 @@ class TCP_Recreate(object):
dip) dip)
shorts = struct.unpack('!hhhhhhhhhh', iphdr) shorts = struct.unpack('!hhhhhhhhhh', iphdr)
shsum = sum(shorts) shsum = sum(shorts)
ipsum = struct.pack('!h', (~shsum & 0xffff) - 2) # -2? WTF? ipsum = struct.pack('!H', (~shsum & 0xffff))
iphdr = iphdr[:10] + ipsum + iphdr[12:] iphdr = iphdr[:10] + ipsum + iphdr[12:]
tcphdr = struct.pack('!HHLLBBHHH', tcphdr = struct.pack('!HHLLBBHHH',