Skip to content
Snippets Groups Projects
Commit 12d9d943 authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

IPv6 - when the UDP checksum is 0, set it to 0xffff

--HG--
branch : Issue #5116 - IPv6 & UDP.chksum == 0
parent 6d2efe37
No related branches found
No related tags found
No related merge requests found
......@@ -517,6 +517,9 @@ class UDP(Packet):
p = p[:6]+struct.pack("!H", ck)+p[8:]
elif isinstance(self.underlayer, scapy.layers.inet6.IPv6) or isinstance(self.underlayer, scapy.layers.inet6._IPv6ExtHdr):
ck = scapy.layers.inet6.in6_chksum(socket.IPPROTO_UDP, self.underlayer, p)
# According to RFC2460 if the result checksum is 0, it should be set to 0xFFFF
if ck == 0:
ck = 0xFFFF
p = p[:6]+struct.pack("!H", ck)+p[8:]
else:
warning("No IP underlayer to compute checksum. Leaving null.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment