Read the nested capability bytes
02A capability has Code, Length and Value inside a separate OPEN Optional Parameter.
In a separate malformed example, a Capability Length claims five Value octets but only four remain in its parameter. The teaching parser stops before interpretation. This is not a well-formed unknown capability to ignore.
Source for this drawing: RFC 5492 · Read RFC section 4 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
The outer Capabilities Optional Parameter has Parameter Type 2. In the classic OPEN format its Parameter Length is one octet and counts the Parameter Value only. Inside are one or more capability TLVs: Type/Length/Value here means a one-octet Capability Code, one-octet Capability Length, then that many Value octets (§4; RFC4271 §4.2).
- The outer Capabilities Optional Parameter has Parameter Type 2. In the classic OPEN format its Parameter Length is one octet and counts the Parameter Value only. Inside are one or more capability TLVs: Type/Length/Value here means a one-octet Capability Code, one-octet Capability Length, then that many Value octets (§4; RFC4271 §4.2).
- Capability Length counts only Value bytes, not its own Code/Length header. Route Refresh uses Capability Code 2 and Capability Length 0: bytes 02 00, with no Value octets. Outer Parameter Type 2 and inner Capability Code 2 are different namespaces (RFC2918 §2).
- Multiprotocol uses Capability Code 1, Length 4. Its Value is AFI (16 bits), Reserved (8 bits) and SAFI (8 bits). The sender SHOULD set Reserved to zero; the receiver ignores it. Our IPv6-unicast Value is 00 02 00 01 (RFC4760 §§6,8; RFC1700 Address Family Numbers).
- Combining the 2-byte Route Refresh TLV and 6-byte Multiprotocol TLV gives eight Parameter Value bytes. Outer Type/Length add two more: 02 08 02 00 01 04 00 02 00 01, ten bytes in the isolated Optional Parameters block. With no other parameters, the classic OPEN Optional Parameters Length is 10 (§4; RFC4271 §4.2).
- The codecs model structurally framed classic optional-parameter blocks of at most 255 octets and selected feature semantics. RFC9072 extends the outer lengths; it is outside this codec, so 255 is not a universal BGP capability limit. Structural truncation is different from a well-formed unknown capability. RFC4271 §6.2 assigns Unspecific subcode 0 for a recognized but malformed Optional Parameter; do not turn it into Unsupported Capability 7.
Worked examples use selected capability formats and classic OPEN optional-parameter framing. This is not a full BGP parser, state machine, routing implementation or authentication check.
Read the RFC section ↗