liuweireign / dpkt

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

Data in IPv6 Fragment Header was copied to buf twice. #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Read packet that has ipv6 fragment header.
    >>> print "Before :",len(buf)
    >>> frame = dpkt.ethernet.Ethernet(buf)
    >>> print "After  :",len(str(frame))
2. IPv6 Fragment Header Data and IPv6 Data is output both.
    >>> 
    Before : 1510
    After  : 2958

What is the expected output? What do you see instead?
    >>> 
    Before : 1510
    After  : 1510

What version of the product are you using? On what operating system?
# $Id: ip6.py 58 2010-03-06 00:06:14Z dugsong $
 and
Python 2.7.2

Please provide any additional information below.
IPv6 Fragment Data(self.data) want to be null.

# diff -u ip6.py.old  ip6.py
--- ip6.py.old
+++ ip6.py
@@ -237,7 +237,8 @@
         )

     def unpack(self, buf):
-        dpkt.Packet.unpack(self, buf)
+        hdr_size=8
+        dpkt.Packet.unpack(self, buf[:hdr_size])
         setattr(self, 'length', self.__hdr_len__)

     def _get_frag_off(self):

Original issue reported on code.google.com by ruy.su...@gmail.com on 20 Oct 2011 at 1:48