Skip to content

Commit 8587f78

Browse files
committed
Merged in gvaladon/scapy-issues/Issue #5116 - IPv6 & UDP.chksum == 0 (pull request #112)
Issue #5116 fixed
2 parents e71f936 + 12d9d94 commit 8587f78

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scapy/layers/inet.py

+3
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ def post_build(self, p, pay):
517517
p = p[:6]+struct.pack("!H", ck)+p[8:]
518518
elif isinstance(self.underlayer, scapy.layers.inet6.IPv6) or isinstance(self.underlayer, scapy.layers.inet6._IPv6ExtHdr):
519519
ck = scapy.layers.inet6.in6_chksum(socket.IPPROTO_UDP, self.underlayer, p)
520+
# According to RFC2460 if the result checksum is 0, it should be set to 0xFFFF
521+
if ck == 0:
522+
ck = 0xFFFF
520523
p = p[:6]+struct.pack("!H", ck)+p[8:]
521524
else:
522525
warning("No IP underlayer to compute checksum. Leaving null.")

0 commit comments

Comments
 (0)