rnithyanand / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

Payload protocol checksum calculation broken for IPv6 parsing #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are a couple problems.  One is that you don't want to look at ip6.nxt to 
check the layer 4 protocol, because if there are extension headers, you need to 
walk the chain to find it.  That is already done in unpack(), where ip6.p is 
set to the payload protocol, so we can use that.

Perhaps this is a separate issue, but there is also a bug in the icmp6 unpack, 
which causes checksum calculation failure for icmp6 in many cases.  The problem 
is dpkt doesn't have handlers for all possible icmp6 types (for example, 
missing important ones like neighbour solitication == 135).  In this case the 
key lookup fails in _typesw, but you don't want to set self.data, because this 
will throw off the length calculation and you will end up with bad icmp6 
checksums.

Note: The second problem was fixed for v4 over 3 years ago in icmp.py by jono 
(via r45).

Diff attached w/ test.

Original issue reported on code.google.com by aa...@monkey.org on 7 Jan 2011 at 2:41

Attachments: