dpkt icon indicating copy to clipboard operation
dpkt copied to clipboard

please calculate the length of BGP-4 Attribute packets automatically

Open kbandla opened this issue 9 years ago • 1 comments

From [email protected] on August 04, 2010 23:12:14

The length of Attribute objects is not automatically calculated (the 'len' field'). Please calculate the length automatically when encoding a Attribute object.

As a workaround, I have to calculate the lengths manually, and to create the attribute objects in two steps, e.g.:

raw_attributes = [ (0x40, dpkt.bgp.ORIGIN, dpkt.bgp.BGP.Update.Attribute.Origin( type=dpkt.bgp.ORIGIN_IGP)), ... ]

attributes = [dpkt.bgp.BGP.Update.Attribute( flags=f, len=len(a), type=t, data=a) for f, t, a in raw_attributes]

This second step on the list of attribute objects could be avoided if Attribute calculated the 'len' attribute automatically when assigning the 'data' attribute, or when encoding the packet.

Original issue: http://code.google.com/p/dpkt/issues/detail?id=43

kbandla avatar Jun 04 '15 01:06 kbandla

From [email protected] on August 04, 2010 20:17:40

There is the same problem with classes dpkt.bgp.BGP.Open.Parameter.Capability and dpkt.bgp.BGP.Open.Parameter: the 'len' field has to be calculated manually for objects of those classes.

kbandla avatar Jun 04 '15 01:06 kbandla