<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-younsi-grow-bmp-snts-01" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true" consensus="true">

<front>
<title abbrev="BMP SNTS">BMP Sequence Number, Timestamp and Flags TLVs</title><seriesInfo value="draft-younsi-grow-bmp-snts-01" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
<author initials="M." surname="Younsi" fullname="Maxence Younsi"><organization>INSA-Lyon</organization><address><postal><street></street>
<country>France</country>
</postal><email>maxence.younsi@insa-lyon.fr</email>
</address></author><author initials="P." surname="Francois" fullname="Pierre Francois"><organization>INSA-Lyon</organization><address><postal><street></street>
<country>France</country>
</postal><email>pierre.francois@insa-lyon.fr</email>
</address></author><date/>
<area>Routing</area>
<workgroup>GROW</workgroup>
<keyword>BMP</keyword>
<keyword>Sequence Number</keyword>
<keyword>Timestamp</keyword>
<keyword>Flags</keyword>
<keyword>BGP Monitoring</keyword>

<abstract>
<t>This document defines a Timestamp TLV that carries a timestamp describing one of multiple possible events related to the BMP message. It also defines a Sequence Number TLV which carries the sequence number of the BMP message for the current BMP session. Finally, this document defines an Extended Flags TLV that replaces the Flags field of the Per-Peer Header, allowing more flags to be allocated in BMP.</t>
</abstract>

</front>

<middle>

<section anchor="introduction"><name>Introduction</name>
<t>This document defines three new BMP Version 4 <xref target="I-D.ietf-grow-bmp-tlv"></xref> TLVs to enhance the metadata exported by the BMP station.</t>
<t>BMP <xref target="RFC7854"></xref> defines a Timestamp field in the Per-Peer header. This Timestamp field contains the time of reception of a route <xref target="RFC7854"></xref>, the time the route was installed in the local-rib <xref target="RFC9069"></xref> or the time the routes were advertised to a peer <xref target="RFC8671"></xref>. As this information is sometimes unavailable in some implementations, some of them abuse this field by filling it with the time of export of the messages, misguiding collectors and operators which assume the value is correct.</t>
<t>In this document, we deprecate the Timestamp field of the Per-Peer Header and define a Timestamp TLV that can carry multiple types of Timestamps. This allows implementations of BMP to export all the timestamps available while being explicit about the their meaning.</t>
<t>Using a TLV for the timestamp field also allows exporting the timestamp of the Adj-Rib-In in the Local-RIB route monitoring messages. This removes the need to export entire RIBs just for the purpose of obtaining route reception timestamps.</t>
<t>Currently, the Timestamp field is also optional, which means it might be zero-filled. When it is the case, timestamp-based ordering of BMP messages cannot work. In this document, we also define a Sequence Number TLV that carries for each message its sequence number. This allows ordering of BMP messages, even when no timestamps are available.</t>
<t>Finally, the Flags field of the Per-Peer Header is close to running out of bits to allocate for Adj-In and Adj-Out. We thus move these flags to an extensible TLV that will allow for bits to be allocated more freely. To do that, we allocate the rightmost bit of the Per-Peer Header Flags. This bit indicates that the flags in the TLV MUST be used in place of the ones in the Per-Peer Header.</t>

<section anchor="requirements-language"><name>Requirements Language</name>
<t>The key words <strong>&quot;MUST&quot;</strong>, <strong>&quot;MUST NOT&quot;</strong>, <strong>&quot;REQUIRED&quot;</strong>, <strong>&quot;SHALL&quot;</strong>, <strong>&quot;SHALL NOT&quot;</strong>, <strong>&quot;SHOULD&quot;</strong>, <strong>&quot;SHOULD NOT&quot;</strong>, <strong>&quot;RECOMMENDED&quot;</strong>, <strong>&quot;NOT RECOMMENDED&quot;</strong>, <strong>&quot;MAY&quot;</strong>, and <strong>&quot;OPTIONAL&quot;</strong> in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"></xref> <xref target="RFC8174"></xref> when, and only when, they appear in all capitals, as shown here.</t>
</section>
</section>

<section anchor="timestamp-tlv"><name>Timestamp TLV</name>
<t>In this section, we describe the optional Timestamp TLV. This BMPv4 TLV <xref target="I-D.ietf-grow-bmp-tlv"></xref> carries one of multiple types of Timestamp for a BMP message.</t>
<t>A TLV type &quot;Timestamp TLV&quot; needs to be reserved from the BMP Route Monitoring TLVs registry. The value of the type field of this TLV is <tt>TBD1</tt>.</t>
<t>The value of the TLV is the &quot;Timestamp Type&quot; code, defined in <xref target="list-timestamp-types"></xref>, followed by the timestamp values expressed in seconds and microseconds since midnight (zero hour), January 1, 1970 (UTC).</t>
<t>The encoding of the timestamp is identical to existing BMP documents <xref target="RFC7854"></xref>, <xref target="RFC8671"></xref>, and <xref target="RFC9069"></xref>, except that the timestamp <bcp14>MUST NOT</bcp14> be set to zero to indicate unavailability. The &quot;Timestamp TLV&quot; is optional, a timestamp <bcp14>MUST NOT</bcp14> be included if it is not available.</t>
<t>The value of the Length field is 9 bytes (1 byte for the &quot;Timestamp Type&quot; field plus the length of the &quot;Timestamp&quot; fields which are 4 bytes each). The &quot;Index&quot; field is, as described by <xref target="I-D.ietf-grow-bmp-tlv"></xref>, not included in the length.</t>
<t>The TLV structure is illustrated in <xref target="fig-timestamp-tlv"></xref>.</t>
<figure anchor="fig-timestamp-tlv"><name>Timestamp TLV
</name>
<artwork> 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Type (2 octets)        |       Length (2 octets)       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|G|      Index (2 octets)       | Timestmp Type |               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~              Timestamp (seconds)              |               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~            Timestamp (microseconds)           ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
</figure>
<t>The <xref target="sec-timestamp-types"></xref> defines the list of currently defined Timestamp Types.</t>

<section anchor="sec-timestamp-types"><name>Timestamp Types</name>
<t>The <xref target="list-timestamp-types"></xref> defines the list of timestamp types that can be carried in the &quot;Timestamp TLV&quot;.
Each timestamp type is described in the section associated with its name and code in the table.</t>
<table anchor="list-timestamp-types">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Section</th>
</tr>
</thead>

<tbody>
<tr>
<td>0x00</td>
<td>Trigger Time</td>
<td><xref target="sec-timestamp-trigger"></xref></td>
</tr>

<tr>
<td>0x01</td>
<td>Message Export Time</td>
<td><xref target="sec-timestamp-export"></xref></td>
</tr>

<tr>
<td>0x02</td>
<td>Adj-In Time</td>
<td><xref target="sec-timestamp-adjin"></xref></td>
</tr>

<tr>
<td>0x03</td>
<td>Local-RIB Time</td>
<td><xref target="sec-timestamp-locrib"></xref></td>
</tr>

<tr>
<td>0x04</td>
<td>Adj-Out Time</td>
<td><xref target="sec-timestamp-adjout"></xref></td>
</tr>
</tbody>
</table>
<section anchor="sec-timestamp-trigger"><name>Trigger Time</name>
<t>The Trigger Time is the timestamp of the event which triggered BMP to report the event. This might be a received message, a BGP peering or a BMP session going down or up, etc.</t>
</section>

<section anchor="sec-timestamp-export"><name>Message Export Time</name>
<t>The Message Export Time is the time at which BMP generates the BMP message.</t>
</section>

<section anchor="sec-timestamp-adjin"><name>Adj-In Time</name>
<t>The Adj-In Time is the time at which the route has been installed in the Adj-RIB-In, as per <xref target="RFC7854"></xref>.</t>
</section>

<section anchor="sec-timestamp-locrib"><name>Local-RIB Time</name>
<t>The Local-RIB Time is the time at which the route has been installed in the Local-RIB, as per <xref target="RFC9069"></xref>.</t>
</section>

<section anchor="sec-timestamp-adjout"><name>Adj-Out Time</name>
<t>The Adj-Out Time is the time at which the route has been installed in the Adj-RIB-Out, as per <xref target="RFC8671"></xref>.</t>
</section>
</section>
</section>

<section anchor="sec-seq-num"><name>Sequence Number TLV</name>
<t>In this section, we describe the Sequence Number TLV. This TLV carries the sequence number of a message in a BMP session.</t>
<t>Ordering of BMP messages based on timestamp becomes complicated when timestamps have conflicting meanings or when they are simply unavailable. A Sequence Number on a per BMP session basis allows the operator to easily and uniquely identify BMP messages on a BMP session.</t>
<t>A TLV type &quot;Sequence Number TLV&quot; needs to be reserved from the BMP Route Monitoring TLVs registry. The value of the type field of this TLV is <tt>TBD2</tt>.</t>
<t>The value of the TLV is the sequence number of the BMP message in the BMP session, starting at 0, and encoded on 8 bytes.</t>
<t>The value of the Length field is 8. The &quot;Index&quot; field is, as described by <xref target="I-D.ietf-grow-bmp-tlv"></xref>, not included in the length.</t>
<t>The TLV structure is illustrated in <xref target="fig-seqnum-tlv"></xref>.</t>
<figure anchor="fig-seqnum-tlv"><name>Sequence Number TLV
</name>
<artwork> 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Type (2 octets)        |       Length (2 octets)       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|G|      Index (2 octets)       |                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
~                   Sequence Number (8 octets)                  ~
+                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
</figure>
</section>

<section anchor="extended-flags-tlv"><name>Extended Flags TLV</name>
<t>In this section, we describe the Extended Flags TLV. This TLV carries the Flags field usually present in the Per-Peer Header, while extending the length of the field. This allows for a larger range of flags to be allocated in the future.</t>
<t>A TLV type &quot;Extended Flags TLV&quot; needs to be reserved from the BMP Route Monitoring TLVs registry. The value of the type field of this TLV is <tt>TBD3</tt>.</t>
<t>The value of the TLV is a sequence of bytes of variable size. The minimum size of the sequence is one, to fit at least the already existing flags.
The flags carried in this TLV are defined in the &quot;BMP Extended Peer Flags&quot; IANA registry defined by this document. The first byte of the sequence carries all flags defined previous to this document, that is Flags V, L, A, O, and F. Newly allocated bits will be carried in the following byte of the sequence.</t>
<t>The value of the &quot;Length&quot; field is the number of bytes in the sequence.
The &quot;Index&quot; field is, as described by <xref target="I-D.ietf-grow-bmp-tlv"></xref>, not included in the length.</t>
<t>The &quot;Index&quot; field is set to 0 to indicate the global scope of the TLV.</t>
<t>The TLV structure is illustrated in <xref target="fig-flags-tlv"></xref>.</t>
<figure anchor="fig-flags-tlv"><name>Extended Flags TLV
</name>
<artwork> 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Type (2 octets)        |       Length (2 octets)       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|G|      Index (2 octets)       |        Flags (Variable)       ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
</figure>
<t>When this TLV is included in a BMP message, the rightmost bit (X Flag) of the Per-Peer Header Flags MUST be set to 1 to indicate that the flags to consider are carried in this TLV. The flags in the Per-Peer Header are still set according to the current specification, allowing collectors that do not understand the X Flag and &quot;Extended Flags TLV&quot; to still function.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>This document requests that IANA assigns the following new parameters to the &quot;BMP Route Monitoring TLVs&quot; <xref target="I-D.ietf-grow-bmp-tlv"></xref> registry:</t>

<ul spacing="compact">
<li>Type = <tt>TBD1</tt>: Timestamp TLV type. This TLV carries a timestamp along with a code identifying which type of event it qualifies.</li>
<li>Type = <tt>TBD2</tt>: Sequence Number TLV type. This TLV carries a sequence number for a BMP Message.</li>
<li>Type = <tt>TBD3</tt>: Extended Flags TLV type. This TLV carries a sequence of bytes representing the Per-Peer Header Flags for a BMP Message.</li>
</ul>
<t>This document requests that IANA assigns the following new parameters to the &quot;BMP Peer Flags for Peer Types 0 through 2&quot; registry and to the &quot;BMP Peer Flags for Loc-RIB Instance Peer Type 3&quot; registry:
* Flag = &quot;7&quot;: X Flag (Extended Flags). Set if the Flags are carried in the Extended Flags TLV instead of the Per-Peer Header.</t>
<t>This document also requests the definition of a &quot;BMP Extended Peer Flags&quot; registry which contains flags contained in the &quot;Extended Flags TLV&quot;. The size of this registry is TBD.
The registration policy for this registry is <strong>Standards Action</strong> as defined in <xref target="RFC8126"></xref>.</t>
<t>The registry is seeded as follows:
* Flag 0: V flag [RFC7854]
* Flag 1: L flag [RFC7854]
* Flag 2: A flag [RFC7854]
* Flag 3: O flag [RFC8671]
* Flag 4: F flag [RFC9069]</t>
<t>This document also requests the definition of a &quot;BMP Timestamp Types&quot; registry. This registry contains type codes for the kinds of timestamps carried by the &quot;Timestamp TLV&quot;. The size of the registry matches the size of the &quot;Timestamp Type&quot; field defined in {#fig-timestamp-tlv} which is 1 byte.</t>
<t>The registration policy for this registry is <strong>Expert Review</strong> as defined in <xref target="RFC8126"></xref>.</t>
<t>The registry is seeded as follows:</t>

<ul spacing="compact">
<li>Type = 0x00: Trigger Time. Set to 0x00 if the timestamp corresponds to the event that triggered BMP to report the route or state, such as receiving a message or a session transition.</li>
<li>Type = 0x01: Message Export Time. Set to 0x01 if the timestamp corresponds to the time when the BMP message was generated for export.</li>
<li>Type = 0x02: Adj-In Time. Set to 0x02 if the timestamp corresponds to when the route was installed in the Adj-RIB-In, as per {@RFC7854}.</li>
<li>Type = 0x03: Local-RIB Time. Set to 0x03 if the timestamp corresponds to when the route was installed in the Local-RIB, as per {@RFC9069}.</li>
<li>Type = 0x04: Adj-Out Time. Set to 0x04 if the timestamp corresponds to when the route was installed in the Adj-RIB-Out, as per {@RFC8671}.</li>
</ul>
</section>

<section anchor="sec_security_considerations"><name>Security Considerations</name>
<t>This document does not introduce new security considerations.</t>
</section>

<section anchor="acknowledgements"><name>Acknowledgements</name>
</section>

</middle>

<back>
<references><name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.ietf-grow-bmp-tlv.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7854.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8671.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9069.xml"/>
</references>

</back>

</rfc>
