Hi,
I try to parse BMP messages and have a problem with MP_REACH_NRLI path attributes (RFC 4760). When attribute is labeled IPv6 (AFI=2 and SAFI=4), sometimes NLRI section looks invalid. More specifically, IPv6 prefix has invalid length.
For example, I've received the path attribute like following (hex): 900e001e0002041000000000000000000000ffff0afc0003003c000021
2804317480According to RFC 4271 and RFC 4760 it is parsed like this:
90 - attribute flags: optional attribute and has two octets length
0e - attribute type: MP_REACH_NLRI
001e - attribute length (30 bytes)
0002 - AFI = 2
04 - SAFI = 4
10 - Next hop length (16 bytes, so IPv6)
00000000000000000000ffff0afc0003 - next hop address
00 - reserved
3c0000212804317480 - NLRI part, parse according to
RFC 8277 - Using BGP to Bind MPLS Labels to Address Prefixes3c - length (60 bits, round up - 8 bytes)
000021 - Label, Rsrv, S-bit
2804317480 - IPv6 prefix.
So the invalid part is the IPv6 prefix, due to 0x28 decoded as 40 bits mask or 5 significant address bytes. But the address part contains only 4 bytes.
Maybe when length is less than mask, zero bits have to be appended, and my example may be parsed as 0431:7480::/40
Could anybody help me with parsing multiprotocol BGP attributes.
------------------------------
Kirill
------------------------------