This document reserves Optional Parameter type code 255 as the "Extended Length".
In the event that the length of the Optional Parameters in the BGP OPEN message does not exceed 255, the encodings of [
RFC 4271]
SHOULD be used without alteration. Configuration
MAY override this to force the extended format to be used in all cases; this might be used, for example, to test that a peer supports this specification. (In any case, an implementation
MUST accept an OPEN message that uses the encoding of this specification even if the length of the Optional Parameters is 255 or less.)
However, if the length of the Optional Parameters in the BGP OPEN message does exceed 255, the OPEN message
MUST be encoded according to the procedure below.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+
| Version |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| My Autonomous System |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Hold Time |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| BGP Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Non-Ext OP Len.|Non-Ext OP Type| Extended Opt. Parm. Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Optional Parameters (variable) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Non-Extended Optional Parameters Length field (Non-Ext OP Len.)
SHOULD be set to 255 on transmission and, in any event,
MUST NOT be set to 0; it
MUST be ignored on receipt once the use of the extended format is determined positively by inspection of the Non-Extended Optional Parameters Type (Non-Ext OP Type) field.
The subsequent one-octet field (which would be the first Optional Parameter Type field in the non-extended format and is called "Non-Ext OP Type" in the
figure above)
MUST be set to 255 on transmission. On receipt, a value of 255 for this field is the indication that the extended format is in use.
In this extended encoding, the subsequent two-octet field, termed the "Extended Optional Parameters Length field", is an unsigned integer indicating the total length of the Optional Parameters field in octets. If the value of this field is zero, no Optional Parameters are present.
Likewise, in that situation, the Optional Parameters encoding is modified to be the following:
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Parm. Type | Parameter Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~ Parameter Value (variable) ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The rules for encoding Optional Parameters are unchanged with respect to those given in [
RFC 4271], except that the Parameter Length field is extended to be a two-octet unsigned integer.
In parsing an OPEN message, if the one-octet Optional Parameters Length field (labeled "Non-Ext OP Len." in
Figure 1) is non-zero, a BGP speaker
MUST use the value of the octet following the one-octet Optional Parameters Length field (labeled "Non-Ext OP Type" in
Figure 1) to determine both the encoding of the Optional Parameters length and the size of the Parameter Length field of individual Optional Parameters. If the value of the "Non-Ext OP Type" field is 255, then the encoding described above is used for the Optional Parameters length. Otherwise, the encoding defined in [
RFC 4271] is used.