Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.07k stars 443 forks source link

Unpack requires a buffer of 2 bytes when decoding withdrawn update message #1091

Closed annaisesc closed 2 years ago

annaisesc commented 2 years ago

Bug Report

The following message cannot be decoded: FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0091 02

Traceback when decoding the message

12:15:23 90080  reactor       loaded new configuration successfully
12:15:23 90080  parser          the message is an update
12:15:23 90080  parser          parsing UPDATE (   0) 
12:15:23 90080  parser        could not parse the message
12:15:23 90080  parser        Traceback (most recent call last):
12:15:23 90080  parser          File "/usr/local/lib/python3.7/site-packages/exabgp-master-py3.7.egg/exabgp/configuration/check.py", line 296, in check_update
12:15:23 90080  parser            update = Update.unpack_message(injected, Direction.IN, negotiated)
12:15:23 90080  parser          File "/usr/local/lib/python3.7/site-packages/exabgp-master-py3.7.egg/exabgp/bgp/message/update/__init__.py", line 265, in unpack_message
12:15:23 90080  parser            withdrawn, _attributes, announced = cls.split(data)
12:15:23 90080  parser          File "/usr/local/lib/python3.7/site-packages/exabgp-master-py3.7.egg/exabgp/bgp/message/update/__init__.py", line 85, in split
12:15:23 90080  parser            len_withdrawn = unpack('!H', data[0:2])[0]
12:15:23 90080  parser        struct.error: unpack requires a buffer of 2 bytes
thomas-mangin commented 2 years ago

BGP Header filler: FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF BGP Header size: 0091 BGP Heade message type: 02

So you are missing quite a few bytes to decode the update, this is probably as I print the BGP message in two parts in the logs, you want the follow up on one of the next lines.

annaisesc commented 2 years ago

Thank you @thomas-mangin did not see that the message continued in the following line.. Sorry about that