dpkt
dpkt copied to clipboard
please set the 'data' fields in BGP-4 ASPath objects, for pretty-printing
From [email protected] on August 04, 2010 23:05:09
ASPath objects accepts an ASPathSegment object in its 'segments' field. However, this field is not printed when representing the object. Only the 'data' field is printed. When an object is decoded, the 'data' field is set to the value of the 'segments' field, so it is represented correctly, but it's not the case when an object is created in code. Same problem in ASPathSegment: the 'data' field should be set to the value of the 'path' field.
As a workaround, I have to set the 'data' fields manually, after creating the objects: for a in paths: # ASPath objects a.data = a.segments for s in a.segments: # ASPathSegment objects s.data = s.path
Please do that automatically, or use the 'segments' and 'path' fields to represent those objects, instead of the 'data' fields.
This is not essential, but very useful for debugging.
Original issue: http://code.google.com/p/dpkt/issues/detail?id=42
From [email protected] on August 04, 2010 20:06:29
More important, the ASPath and ASPathSegment objects only encode their 'data' fields instead of their 'segments' and 'path' fields. So setting the 'data' fields is necessary for the objects to encode correctly.