What steps will reproduce the problem?
>>> import dpkt
>>> packet = dpkt.ip6.IP6()
>>> str(packet)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dpkt/ip6.py", line 83, in __str__
return self.pack_hdr() + self.headers_str() + str(self.data)
File "dpkt/ip6.py", line 66, in headers_str
if not self.extension_hdrs[hdr] is None:
AttributeError: 'IP6' object has no attribute 'extension_hdrs'
>>>
What is the expected output? What do you see instead?
This is expected output:
>>> import dpkt
>>> packet = dpkt.ip6.IP6()
>>> str(packet)
'`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x
00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
What version of the product are you using? On what operating system?
First line of ip6.py:
# $Id: ip6.py 58 2010-03-06 00:06:14Z dugsong $
Please provide any additional information below.
'Expected output' above was produced with this workaround:
$ diff -u ip6_original.py ip6.py
--- ip6.py 2010-03-06 00:06:21.000000000 +0300
+++ ip6.py 2011-03-31 13:29:47.009915074 +0300
@@ -62,10 +62,10 @@
"""
header_str = ""
-
- for hdr in ext_hdrs:
- if not self.extension_hdrs[hdr] is None:
- header_str += str(self.extension_hdrs[hdr])
+ if getattr(self, 'extension_hdrs', None):
+ for hdr in ext_hdrs:
+ if not self.extension_hdrs[hdr] is None:
+ header_str += str(self.extension_hdrs[hdr])
return header_str
Original issue reported on code.google.com by alexey.k...@gmail.com on 31 Mar 2011 at 9:37
Original issue reported on code.google.com by
alexey.k...@gmail.com
on 31 Mar 2011 at 9:37