<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
        <!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
        <!ENTITY IANA_RM_CODE_4B_ASN "TBD1">
        <!ENTITY IANA_RM_CODE_PATH_ID "TBD2">
        <!ENTITY IANA_RM_CODE_MULTI_LABELS "TBD3">
        ]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" docName="draft-ietf-grow-bmp-tlv-08"
     ipr="trust200902" submissionType="IETF"
     updates="7854">

    <front>
        <title abbrev="BMP TLV">
	    TLV support for BMP Route Monitoring and Peer Down Messages
	</title>

        <author fullname="Paolo Lucente" initials="P" surname="Lucente">
            <organization>NTT</organization>
            <address>
                <postal>
                    <street>Veemweg 23</street>
                    <city>Barneveld</city>
                    <code>3771</code>
                    <region>MT</region>
                    <country>NL</country>
                </postal>
                <email>paolo@ntt.net</email>
            </address>
        </author>
        <author fullname="Yunan Gu" initials="Y" surname="Gu">
            <organization>Huawei</organization>
            <address>
                <postal>
                    <street>Huawei Bld., No.156 Beiqing Rd.</street>
                    <city>Beijing</city>
                    <code>100095</code>
                    <region></region>
                    <country>China</country>
                </postal>
                <email>guyunan@huawei.com</email>
            </address>
        </author>

        <date year="2022"/>

        <area>General</area>

        <workgroup>Global Routing Operations</workgroup>
        <keyword>BGP</keyword>
        <keyword>BMP</keyword>
        <keyword>tlv</keyword>

        <abstract>
            <t>
		Most of the message types defined by the BGP Monitoring Protocol (BMP)
		make provision for optional trailing data. However, Route Monitoring
		messages (which provide a snapshot of the monitored Routing Information
		Base) and Peer Down messages (which indicate that a peering session was
		terminated) do not. Supporting optional data in TLV format across
		all BMP message types allows for a homogeneous and extensible surface
		that would be useful for the most different use-cases that need to
		convey additional data to a BMP station. While it is not intended
		for this document to cover any specific utilization scenario, it defines
		a simple way to support optional TLV data in all message types.
            </t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction" anchor="Introduction">
            <t>
		The BGP Monitoring Protocol (BMP) is defined in <xref target="RFC7854">RFC 7854</xref>.

		<vspace blankLines="1"/>

		The Route Monitoring message consists of:
		<list style="symbols">
			<t>Common Header</t>
			<t>Per-Peer Header</t>
			<t>BGP Update PDU</t>
		</list>

		<vspace blankLines="1"/>

		The Peer Down Notification message consists of:
		<list style="symbols">
			<t>Common Header</t>
			<t>Per-Peer Header</t>
			<t>Reason</t>
			<t>Data (only if Reason code is 1, 2 or 3)</t>
		</list>
	   </t>

           <t>
		This means that both Route Monitoring and Peer Down messages have
		a non-extensible format. In the Route Monitoring case, this prevents
		the transmission of characteristics of transported NLRIs (e.g. to
		help with stateless parsing) or of vendor-specific data. In the Peer
		Down case, this prevents matching with TLVs previously sent with the
		Peer Up message. The proposal of this document is to bump the BMP
		version, for backward compatibility, and allow all message types
		to make provision for trailing TLV data.
            </t>
        </section>

        <section title="Terminology">
            <t>
		The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
		NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
		"MAY", and "OPTIONAL" in this document are to be interpreted as
		described in BCP 14 <xref target="RFC2119">RFC 2119</xref>
		<xref target="RFC8174">RFC 8174</xref> when, and only when, they
		appear in all capitals, as shown here.
            </t>
        </section>

	<section title="TLV encoding">
	    <t>
		The TLV data type is already defined in <xref target="RFC7854">Section 4.4 of</xref>
		for the Initiation and Peer Up message types. A TLV consists of:
	    </t>
	    <t>
		<list style="symbols">
		    <t>
			2 octets of TLV Type,
		    </t>
		    <t>
			2 octets of TLV Length,
		    </t>
		    <t>
			0 or more octets of TLV Value.
		    </t>
		</list>
	    </t>

	    <figure anchor="BMP-TLV-header" align="center">
	    	<artwork align="center">
	    	    <![CDATA[
  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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |        Type (2 octets)        |     Length (2 octets)         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  ~                      Value (variable)                         ~
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	    	    ]]>
	    	</artwork>
	    </figure>

	    <t>
		TLVs SHOULD be sorted by their code point. Multiple TLVs of the
		same type can be repeated as part of the same message, and it is
		left to the specific use-cases whether all, any, the first or
		the last TLV should be considered as well as whether ordering
		matters.
	    </t>

	    <t>
	        Route Monitoring messages may require per-NLRI TLVs, that is, there may
		be a need to map TLVs to NLRIs contained in the BGP Update message, for
		example, to express additional characteristics of a specific NLRI. For
		this purpose specifically, TLVs in Route Monitoring messages MUST be
		indexed, with the index starting at one (1) to refer to the first NLRI.
		Index zero (0) specifies that a TLV does apply to all NLRIs contained in
		the BGP Update message. Multiple TLVs of the same type and with the same
		index can be repeated as part of the same message. Indexed TLVs are
		encoded as in the following figure:
	    </t>

	    <figure anchor="BMP-indexed-TLV-header" align="center">
	    	<artwork align="center">
	    	    <![CDATA[
  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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |        Type (2 octets)        |     Length (2 octets)         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |        Index (2 octets)       |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  ~                      Value (variable)                         ~
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	    	    ]]>
	    	</artwork>
	    </figure>

	    <t>
	        Of the BMP message types defined so far, indexed TLVs apply only to
		Route Monitoring messages and, for example, they do not apply to Route
		Mirroring messages because the sender may not be aware of the payload
		of the transported BGP Update message.
	    </t>
	</section>

        <section title="BMP Message Format">
            <section title="Common Header" anchor="CommonHeader">
                <t>
		    <xref target="RFC7854">Section 4.1 of</xref> defines the Common
		    Header. While the structure remains unaltered, the following
		    two definitions are changed:
		     
		    <list style="symbols">
			<t>
				Version: Indicates the BMP version. This is set
				to '4' for all messages.
			</t>
			<t>
				Message Length: Total length of the message in
				bytes (including headers, encapsulated BGP message
				and optional data)
			</t>
		    </list> 
                </t>
            </section>
	    <section title="TLV data in Route Monitoring" anchor="TLVinRM">
		<t>
		    The Route Monitoring message type is defined in <xref target="RFC7854">Section 4.6 of</xref>.
		    The BGP Update PDU <xref target="RFC4271">Section 4.3 of</xref> MAY
		    be followed by TLV data. This document defines the following new
		    code points to help stateless parsing of BGP Update PDUs:
                    <list style="symbols">
                        <t>Type = &IANA_RM_CODE_4B_ASN;: the BGP Update PDU is encoded with support for the 4-octet AS number capability <xref target="RFC6793">RFC 6793</xref>, length MUST be 1 and value MUST be 0 for false and 1 for true.</t>
			<t>Type = &IANA_RM_CODE_PATH_ID;: the BGP Update PDU is encoded with the ADD-PATH capability <xref target="RFC7911">RFC 7911</xref>, length MUST be 1 and value MUST be 0 for false and 1 for true.</t>
			<t>Type = &IANA_RM_CODE_MULTI_LABELS;: the BGP Update PDU is encoded with the Multiple Labels capability <xref target="RFC8277">RFC 8277</xref>, length MUST be 1 and value MUST be 0 for false and 1 for true.</t>
                    </list>
		</t>
	    </section>
	    <section title="TLV data in Peer Down" anchor="TLVinPD">
		<t>
		    The Peer Down Notification message type is defined in <xref target="RFC7854">Section 4.9 of</xref>.
		    For Reason codes 1 or 3, a BGP Notification PDU follows; the PDU MAY be followed by TLV data.
		    For Reason code 2, a 2-byte field to give additional FSM info follows; this field MAY be
		    followed by TLV data. For all other Reason codes, TLV data MAY follow the Reason field.
		</t>
	    </section>
	    <section title="TLV data in other BMP messages" anchor="TLVinOther">
		<t>
		    All other message types defined in <xref target="RFC7854">RFC7854</xref> already provide for TLV data.
		    It is RECOMMENDED that all future BMP message types also provide for trailing TLV data.
		</t>
	    </section>
        </section>

        <section title="Error handling">
            <t>
		When a BGP PDU is enclosed in BMP messages (always for Route Monitoring messages,
		in some cases for Peer Down messages), processing of optional trailing data is
		subject to proper decoding of a well-formed BGP message.
            </t>
	    <t>
		Additionally, it is worth nothing that <xref target="RFC8654">RFC8654</xref>
		permits BGP Updates and other messages to grow to a length of 65535 octets. This
		may cause a BMP PDU that attempts to encapsulate such long messages to overflow.
	    </t>
        </section>

        <section title="Security Considerations">
            <t>
                It is not believed that this document adds any additional security considerations.
            </t>
        </section>

        <section title="Operational Considerations">
            <t>
                In Route Monitoring messages, the number of TLVs can be bound to the amount of NLRIs
		carried in the BGP Update message. This may degrade the packing of information in such
		messages and have specific impacts on the memory and CPU used in a BMP implementation.
		As a result of that it should always be possible to disable such features to mitigate
		their impact.
            </t>
        </section>

        <section title="IANA Considerations">
            <t>
		This document requests the definition of two new registries "BMP Route Monitoring
		Information TLVs" and "BMP Peer Down Information TLVs". As part of the "BMP Route
		Monitoring Information TLVs" registry, the following new TLV types are defined
		(<xref target="TLVinRM"/>):

		<list style="symbols">
		    <t>
			Type = &IANA_RM_CODE_4B_ASN;: Support for the 4-octet AS number capability.
			The value field is set to 1 if the BGP Update PDU enclosed in the Route
			Monitoring message was encoded according to the capability.
		    </t>
		    <t>
			Type = &IANA_RM_CODE_PATH_ID;: ADD-PATH capability. The value field is set
			to 1 if the BGP Update PDU enclosed in the Route Monitoring message was
			encoded according to the capability.
		    </t>
		    <t>
			Type = &IANA_RM_CODE_MULTI_LABELS;: Multiple Labels capability. The value
			field is set to 1 if the BGP Update PDU enclosed in the Route Monitoring
			message was encoded according to the capability.
		    </t>
		</list>
            </t>
        </section>

    </middle>

    <back>

        <references title="Normative References">
		&RFC2119;
		&RFC8174;

		<?rfc include="reference.RFC.4271.xml"?>
		<?rfc include="reference.RFC.7854.xml"?>
		<?rfc include="reference.RFC.6793.xml"?>
		<?rfc include="reference.RFC.7911.xml"?>
		<?rfc include="reference.RFC.8277.xml"?>
		<?rfc include="reference.RFC.8654.xml"?>
        </references>

        <section anchor="Acknowledgements" title="Acknowledgements" numbered="no">
            <t>
		The authors would like to thank Jeff Haas, Camilo Cardona, Thomas Graf,
		Pierre Francois and Ben Maddison for their valuable input. The authors
		would also like to thank Greg Skinner and Zongpeng Du for their review.
            </t>
        </section>

    </back>
</rfc>
