RFC 6374

Packet Loss and Delay Measurement for MPLS Networks

3. Message Formats
Loss Measurement and Delay Measurement messages flow over the MPLS
Generic Associated Channel (G-ACh) [RFC5586]. Thus, a packet
containing an LM or DM message contains an MPLS label stack, with the
G-ACh Label (GAL) at the bottom of the stack. The GAL is followed by
an Associated Channel Header (ACH), which identifies the message
type, and the message body follows the ACH.
This document defines the following ACH Channel Types:
MPLS Direct Loss Measurement (DLM)
MPLS Inferred Loss Measurement (ILM)
MPLS Delay Measurement (DM)
MPLS Direct Loss and Delay Measurement (DLM+DM)
MPLS Inferred Loss and Delay Measurement (ILM+DM)
The message formats for direct and inferred LM are identical. The
formats of the DLM+DM and ILM+DM messages are also identical.
For these channel types, the ACH SHALL NOT be followed by the ACH TLV
Header defined in [RFC5586].
The fixed-format portion of a message MAY be followed by a block of
Type-Length-Value (TLV) fields. The TLV block provides an extensible
way of attaching subsidiary information to LM and DM messages.
Several such TLV fields are defined below.
All integer values for fields defined in this document SHALL be
encoded in network byte order.
3.1. Loss Measurement Message Format
The format of a Loss Measurement message, which follows the
Associated Channel Header (ACH), is as follows:

Field Meaning
--------------------- -----------------------------------------------
Version Protocol version
Flags Message control flags
Control Code Code identifying the query or response type
Message Length Total length of this message in bytes
Data Format Flags Flags specifying the format of message data
(DFlags)
Origin Timestamp Format of the Origin Timestamp field
Format (OTF)
Reserved Reserved for future specification
Session Identifier Set arbitrarily by the querier
Differentiated Differentiated Services Code Point (DSCP) being
Services (DS) Field measured
Origin Timestamp 64-bit field for query message transmission
timestamp
Counter 1-4 64-bit fields for LM counter values
TLV Block Optional block of Type-Length-Value fields
The possible values for these fields are as follows.
Version: Currently set to 0.
Flags: The format of the Flags field is shown below.
+-+-+-+-+
|R|T|0|0|
+-+-+-+-+
Loss Measurement Message Flags
The meanings of the flag bits are:
R: Query/Response indicator. Set to 0 for a Query and 1 for a
Response.
T: Traffic-class-specific measurement indicator. Set to 1 when
the measurement operation is scoped to packets of a particular
traffic class (DSCP value), and 0 otherwise. When set to 1, the
DS field of the message indicates the measured traffic class.
0: Set to 0.
Control Code: Set as follows according to whether the message is a
Query or a Response as identified by the R flag.

For a Query:
0x0: In-band Response Requested. Indicates that this query has
been sent over a bidirectional channel and the response is
expected over the same channel.
0x1: Out-of-band Response Requested. Indicates that the
response should be sent via an out-of-band channel.
0x2: No Response Requested. Indicates that no response to the
query should be sent. This mode can be used, for example, if
all nodes involved are being controlled by a Network Management
System.
For a Response:
Codes 0x0-0xF are reserved for non-error responses. Error
response codes imply that the response does not contain valid
measurement data.
0x1: Success. Indicates that the operation was successful.
0x2: Notification - Data Format Invalid. Indicates that the
query was processed, but the format of the data fields in this
response may be inconsistent. Consequently, these data fields
MUST NOT be used for measurement.
0x3: Notification - Initialization in Progress. Indicates that
the query was processed but this response does not contain
valid measurement data because the responder's initialization
process has not completed.
0x4: Notification - Data Reset Occurred. Indicates that the
query was processed, but a reset has recently occurred that may
render the data in this response inconsistent relative to
earlier responses.
0x5: Notification - Resource Temporarily Unavailable.
Indicates that the query was processed, but resources were
unavailable to complete the requested measurement and that,
consequently, this response does not contain valid measurement
data.
0x10: Error - Unspecified Error. Indicates that the operation
failed for an unspecified reason.

0x11: Error - Unsupported Version. Indicates that the
operation failed because the protocol version supplied in the
query message is not supported.
0x12: Error - Unsupported Control Code. Indicates that the
operation failed because the Control Code requested an
operation that is not available for this channel.
0x13: Error - Unsupported Data Format. Indicates that the
operation failed because the data format specified in the query
is not supported.
0x14: Error - Authentication Failure. Indicates that the
operation failed because the authentication data supplied in
the query was missing or incorrect.
0x15: Error - Invalid Destination Node Identifier. Indicates
that the operation failed because the Destination Node
Identifier supplied in the query is not an identifier of this
node.
0x16: Error - Connection Mismatch. Indicates that the
operation failed because the channel identifier supplied in the
query did not match the channel over which the query was
received.
0x17: Error - Unsupported Mandatory TLV Object. Indicates that
the operation failed because a TLV Object received in the query
and marked as mandatory is not supported.
0x18: Error - Unsupported Query Interval. Indicates that the
operation failed because the query message rate exceeded the
configured threshold.
0x19: Error - Administrative Block. Indicates that the
operation failed because it has been administratively
disallowed.
0x1A: Error - Resource Unavailable. Indicates that the
operation failed because node resources were not available.
0x1B: Error - Resource Released. Indicates that the operation
failed because node resources for this measurement session were
administratively released.
0x1C: Error - Invalid Message. Indicates that the operation
failed because the received query message was malformed.

0x1D: Error - Protocol Error. Indicates that the operation
failed because a protocol error was found in the received query
message.
Message Length: Set to the total length of this message in bytes,
including the Version, Flags, Control Code, and Message Length fields
as well as the TLV Block, if any.
DFlags: The format of the DFlags field is shown below.
+-+-+-+-+
|X|B|0|0|
+-+-+-+-+
Data Format Flags
The meanings of the DFlags bits are:
X: Extended counter format indicator. Indicates the use of
extended (64-bit) counter values. Initialized to 1 upon creation
(and prior to transmission) of an LM Query and copied from an LM
Query to an LM response. Set to 0 when the LM message is
transmitted or received over an interface that writes 32-bit
counter values.
B: Octet (byte) count. When set to 1, indicates that the Counter
1-4 fields represent octet counts. The octet count applies to all
packets within the LM scope (Section 2.9.9), and the octet count
of a packet sent or received over a channel includes the total
length of that packet (but excludes headers, labels, or framing of
the channel itself). When set to 0, indicates that the Counter
1-4 fields represent packet counts.
0: Set to 0.
Origin Timestamp Format: The format of the Origin Timestamp field, as
specified in Section 3.4.
Session Identifier: Set arbitrarily in a query and copied in the
response, if any. This field uniquely identifies a measurement
operation (also called a session) that consists of a sequence of
messages. All messages in the sequence have the same Session
Identifier.
DS: When the T flag is set to 1, this field is set to the DSCP value
[RFC3260] that corresponds to the traffic class being measured. For
MPLS, where the traffic class of a channel is identified by the
three-bit Traffic Class in the channel's LSE [RFC5462], this field

SHOULD be set to the Class Selector Codepoint [RFC2474] that
corresponds to that Traffic Class. When the T flag is set to 0, the
value of this field is arbitrary, and the field can be considered
part of the Session Identifier.
Origin Timestamp: Timestamp recording the transmit time of the query
message.
Counter 1-4: Referring to Section 2.2, when a query is sent from A,
Counter 1 is set to A_TxP and the other counter fields are set to 0.
When the query is received at B, Counter 2 is set to B_RxP. At this
point, B copies Counter 1 to Counter 3 and Counter 2 to Counter 4,
and re-initializes Counter 1 and Counter 2 to 0. When B transmits
the response, Counter 1 is set to B_TxP. When the response is
received at A, Counter 2 is set to A_RxP.
The mapping of counter types such as A_TxP to the Counter 1-4 fields
is designed to ensure that transmit counter values are always written
at the same fixed offset in the packet, and likewise for receive
counters. This property may be important for hardware processing.
When a 32-bit counter value is written to one of the counter fields,
that value SHALL be written to the low-order 32 bits of the field;
the high-order 32 bits of the field MUST, in this case, be set to 0.
TLV Block: Zero or more TLV fields.
3.2. Delay Measurement Message Format
The format of a Delay Measurement message, which follows the
Associated Channel Header (ACH), is as follows:

Flags: As specified in Section 3.1. The T flag in a DM message is
set to 1.
Control Code: As specified in Section 3.1.
Message Length: Set to the total length of this message in bytes,
including the Version, Flags, Control Code, and Message Length fields
as well as the TLV Block, if any.
Querier Timestamp Format: The format of the timestamp values written
by the querier, as specified in Section 3.4.
Responder Timestamp Format: The format of the timestamp values
written by the responder, as specified in Section 3.4.
Responder's Preferred Timestamp Format: The timestamp format
preferred by the responder, as specified in Section 3.4.
Session Identifier: As specified in Section 3.1.
DS: As specified in Section 3.1.
Timestamp 1-4: Referring to Section 2.4, when a query is sent from A,
Timestamp 1 is set to T1 and the other timestamp fields are set to 0.
When the query is received at B, Timestamp 2 is set to T2. At this
point, B copies Timestamp 1 to Timestamp 3 and Timestamp 2 to
Timestamp 4, and re-initializes Timestamp 1 and Timestamp 2 to 0.
When B transmits the response, Timestamp 1 is set to T3. When the
response is received at A, Timestamp 2 is set to T4. The actual
formats of the timestamp fields written by A and B are indicated by
the Querier Timestamp Format and Responder Timestamp Format fields
respectively.
The mapping of timestamps to the Timestamp 1-4 fields is designed to
ensure that transmit timestamps are always written at the same fixed
offset in the packet, and likewise for receive timestamps. This
property is important for hardware processing.
TLV Block: Zero or more TLV fields.
3.3. Combined Loss/Delay Measurement Message Format
The format of a combined Loss and Delay Measurement message, which
follows the Associated Channel Header (ACH), is as follows:

1: Sequence number. This value indicates that the timestamp field
is to be viewed as a simple 64-bit sequence number. This provides
a simple solution for applications that do not require a real
absolute timestamp, but only an indication of message ordering; an
example is LM exception detection.
2: Network Time Protocol version 4 64-bit timestamp format
[RFC5905]. This format consists of a 32-bit seconds field
followed by a 32-bit fractional seconds field, so that it can be
regarded as a fixed-point 64-bit quantity.
3: Low-order 64 bits of the IEEE 1588-2008 (1588v2) Precision Time
Protocol timestamp format [IEEE1588]. This truncated format
consists of a 32-bit seconds field followed by a 32-bit
nanoseconds field, and is the same as the IEEE 1588v1 timestamp
format.
Timestamp formats of n < 64 bits in size SHALL be encoded in the
64-bit timestamp fields specified in this document using the n high-
order bits of the field. The remaining 64 - n low-order bits in the
field SHOULD be set to 0 and MUST be ignored when reading the field.
To ensure that it is possible to find an interoperable mode between
implementations, it is necessary to select one timestamp format as
the default. The timestamp format chosen as the default is the
truncated IEEE 1588 PTP format (format code 3 in the list above);
this format MUST be supported. The rationale for this choice is
discussed in Appendix A. Implementations SHOULD also be capable of
reading timestamps written in NTPv4 64-bit format and reconciling
them internally with PTP timestamps for measurement purposes.
Support for other timestamp formats is OPTIONAL.
The implementation MUST make clear which timestamp formats it
supports and the extent of its support for computation with and
reconciliation of different formats for measurement purposes.
3.5. TLV Objects
The TLV Block in LM and DM messages consists of zero or more objects
with the following format:
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 | Length | Value ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
TLV Format

The Type and Length fields are each 8 bits long, and the Length field
indicates the size in bytes of the Value field, which can therefore
be up to 255 bytes long.
The Type space is divided into Mandatory and Optional subspaces:
Type Range Semantics
-------------- ---------
0-127 Mandatory
128-255 Optional
Upon receipt of a query message including an unrecognized mandatory
TLV object, the recipient MUST respond with an Unsupported Mandatory
TLV Object error code.
The types defined are as follows:
Type Definition
-------------- ---------------------------------
Mandatory
0 Padding - copy in response
1 Return Address
2 Session Query Interval
3 Loopback Request
4-126 Unallocated
127 Experimental use
Optional
128 Padding - do not copy in response
129 Destination Address
130 Source Address
131-254 Unallocated
255 Experimental use
3.5.1. Padding
The two padding objects permit the augmentation of packet size; this
is mainly useful for delay measurement. The type of padding
indicates whether the padding supplied by the querier is to be copied
to, or omitted from, the response. Asymmetrical padding may be
useful when responses are delivered out-of-band or when different
maximum transmission unit sizes apply to the two components of a
bidirectional channel.
More than one padding object MAY be present, in which case they MUST
be contiguous. The Value field of a padding object is arbitrary.

3.5.2. Addressing
The addressing objects have the following format:
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 | Length | Address Family |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~ Address ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Addressing Object Format
The Address Family field indicates the type of the address, and it
SHALL be set to one of the assigned values in the "IANA Address
Family Numbers" registry.
The Source and Destination Address objects indicate the addresses of
the sender and the intended recipient of the message, respectively.
The Source Address of a query message SHOULD be used as the
destination for an out-of-band response unless some other out-of-band
response mechanism has been configured, and unless a Return Address
object is present, in which case the Return Address specifies the
target of the response. The Return Address object MUST NOT appear in
a response.
3.5.3. Loopback Request
The Loopback Request object, when included in a query, indicates a
request that the query message be returned to the sender unmodified.
This object has a Length of 0.
Upon receiving the reflected query message back from the responder,
the querier MUST NOT retransmit the message. Information that
uniquely identifies the original query source, such as a Source
Address object, can be included to enable the querier to
differentiate one of its own loopback queries from a loopback query
initiated by the far end.
This object may be useful, for example, when the querier is
interested only in the round-trip delay metric. In this case, no
support for delay measurement is required at the responder at all,
other than the ability to recognize a DM query that includes this
object and return it unmodified.

3.5.4. Session Query Interval
The Value field of the Session Query Interval object is a 32-bit
unsigned integer that specifies a time interval in milliseconds.
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 | Length | Session Query >
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
< Interval (ms) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Session Query Interval Object Format
This time interval indicates the interval between successive query
messages in a specific measurement session. The purpose of the
Session Query Interval (SQI) object is to enable the querier and
responder of a measurement session to agree on a query rate. The
procedures for handling this object SHALL be as follows:
1. The querier notifies the responder that it wishes to be informed
of the responder's minimum query interval for this session by
including the SQI object in its query messages, with a Value of
0.
2. When the responder receives a query that includes an SQI object
with a Value of 0, the responder includes an SQI object in the
response with the Value set to the minimum query interval it
supports for this session.
3. When the querier receives a response that includes an SQI object,
it selects a query interval for the session that is greater than
or equal to the Value specified in the SQI object and adjusts its
query transmission rate accordingly, including in each subsequent
query an SQI object with a Value equal to the selected query
interval. Once a response to one of these subsequent queries has
been received, the querier infers that the responder has been
apprised of the selected query interval and MAY then stop
including the SQI object in queries associated with this session.
Similar procedures allow the query rate to be changed during the
course of the session by either the querier or the responder. For
example, to inform the querier of a change in the minimum supported
query interval, the responder begins including a corresponding SQI
object in its responses, and the querier adjusts its query rate if
necessary and includes a corresponding SQI object in its queries
until a response is received.

Shorter query intervals (i.e., higher query rates) provide finer
measurement granularity at the expense of additional load on
measurement endpoints and the network; see Section 6 for further
discussion.
4. Operation
4.1. Operational Overview
A loss or delay measurement operation, also called a session, is
controlled by the querier and consists of a sequence of query
messages associated with a particular channel and a common set of
measurement parameters. If the session parameters include a response
request, then the receiving node or nodes will (under normal
conditions) generate a response message for each query message
received, and these responses are also considered part of the
session. All query and response messages in a session carry a common
session identifier.
Measurement sessions are initiated at the discretion of the network
operator and are terminated either at the operator's request or as
the result of an error condition. A session may be as brief as a
single message exchange, for example when a DM query is used by the
operator to "ping" a remote node, or it may extend throughout the
lifetime of the channel.
When a session is initiated for which responses are requested, the
querier SHOULD initialize a timer, called the SessionResponseTimeout,
that indicates how long the querier will wait for a response before
abandoning the session and notifying the user that a timeout has
occurred. This timer persists for the lifetime of the session and is
reset each time a response message for the session is received.
When a query message is received that requests a response, a variety
of exceptional conditions may arise that prevent the responder from
generating a response that contains valid measurement data. Such
conditions fall broadly into two classes: transient exceptions from
which recovery is possible and fatal exceptions that require
termination of the session. When an exception arises, the responder
SHOULD generate a response with an appropriate Notification or Error
control code according to whether the exception is, respectively,
transient or fatal. When the querier receives an Error response, the
session MUST be terminated and the user informed.
A common example of a transient exception occurs when a new session
is initiated and the responder requires a period of time to become
ready before it can begin providing useful responses. The response
control code corresponding to this situation is Notification -

Initialization in Progress. Typical examples of fatal exceptions are
cases where the querier has requested a type of measurement that the
responder does not support or where a query message is malformed.
When initiating a session, the querier SHOULD employ the Session
Query Interval mechanism (Section 3.5.4) to establish a mutually
agreeable query rate with the responder. Responders SHOULD employ
rate-limiting mechanisms to guard against the possibility of
receiving an excessive quantity of query messages.
4.2. Loss Measurement Procedures
4.2.1. Initiating a Loss Measurement Operation
An LM operation for a particular channel consists of sending a
sequence (LM[1], LM[2], ...) of LM query messages over the channel at
a specific rate and processing the responses received, if any. As
described in Section 2.2, the packet loss associated with the channel
during the operation is computed as a delta between successive
messages; these deltas can be accumulated to obtain a running total
of the packet loss for the channel or be used to derive related
metrics such as the average loss rate.
The query message transmission rate MUST be sufficiently high, given
the LM message counter size (which can be either 32 or 64 bits) and
the speed and minimum packet size of the underlying channel, that the
ambiguity condition noted in Section 2.2 cannot arise. In evaluating
this rate, the implementation SHOULD assume that the counter size is
32 bits unless explicitly configured otherwise or unless (in the case
of a bidirectional channel) all local and remote interfaces involved
in the LM operation are known to be 64-bit-capable, which can be
inferred from the value of the X flag in an LM response.
4.2.2. Transmitting a Loss Measurement Query
When transmitting an LM Query, the Version field MUST be set to 0.
The R flag MUST be set to 0. The T flag SHALL be set to 1 if, and
only if, the measurement is specific to a particular traffic class,
in which case the DS field SHALL identify that traffic class.
The X flag MUST be set to 1 if the transmitting interface writes
64-bit LM counters and otherwise MUST be set to 0 to indicate that
32-bit counters are written. The B flag SHALL be set to 1 to
indicate that the counter fields contain octet counts or to 0 to
indicate packet counts.

The Control Code field MUST be set to one of the values for Query
messages listed in Section 3.1; if the channel is unidirectional,
this field MUST NOT be set to 0x0 (Query: In-band Response
Requested).
The Session Identifier field can be set arbitrarily.
The Origin Timestamp field SHALL be set to the time at which this
message is transmitted, and the Origin Timestamp Format field MUST be
set to indicate its format, according to Section 3.4.
The Counter 1 field SHOULD be set to the total count of units
(packets or octets, according to the B flag) transmitted over the
channel prior to this LM Query, or to 0 if this is the beginning of a
measurement session for which counter data is not yet available. The
Counter 2 field MUST be set to 0. If a response was previously
received in this measurement session, the Counter 1 and Counter 2
fields of the most recent such response MAY be copied to the Counter
3 and Counter 4 fields, respectively, of this query; otherwise, the
Counter 3 and Counter 4 fields MUST be set to 0.
4.2.3. Receiving a Loss Measurement Query
Upon receipt of an LM Query message, the Counter 2 field SHOULD be
set to the total count of units (packets or octets, according to the
B flag) received over the channel prior to this LM Query. If the
receiving interface writes 32-bit LM counters, the X flag MUST be set
to 0.
At this point, the LM Query message must be inspected. If the
Control Code field is set to 0x2 (No Response Requested), an LM
Response message MUST NOT be transmitted. If the Control Code field
is set to 0x0 (In-band Response Requested) or 0x1 (Out-of-band
Response Requested), then an in-band or out-of-band response,
respectively, SHOULD be transmitted unless this has been prevented by
an administrative, security, or congestion control mechanism.
In the case of a fatal exception that prevents the requested
measurement from being made, the error SHOULD be reported, via either
a response, if one was requested, or else as a notification to the
user.
4.2.4. Transmitting a Loss Measurement Response
When constructing a Response to an LM Query, the Version field MUST
be set to 0. The R flag MUST be set to 1. The value of the T flag
MUST be copied from the LM Query.

The X flag MUST be set to 0 if the transmitting interface writes
32-bit LM counters; otherwise, its value MUST be copied from the LM
Query. The B flag MUST be copied from the LM Query.
The Session Identifier, Origin Timestamp, and Origin Timestamp Format
fields MUST be copied from the LM Query. The Counter 1 and Counter 2
fields from the LM Query MUST be copied to the Counter 3 and Counter
4 fields, respectively, of the LM Response.
The Control Code field MUST be set to one of the values for Response
messages listed in Section 3.1. The value 0x10 (Unspecified Error)
SHOULD NOT be used if one of the other more specific error codes is
applicable.
If the response is transmitted in-band, the Counter 1 field SHOULD be
set to the total count of units transmitted over the channel prior to
this LM Response. If the response is transmitted out-of-band, the
Counter 1 field MUST be set to 0. In either case, the Counter 2
field MUST be set to 0.
4.2.5. Receiving a Loss Measurement Response
Upon in-band receipt of an LM Response message, the Counter 2 field
is set to the total count of units received over the channel prior to
this LM Response. If the receiving interface writes 32-bit LM
counters, the X flag is set to 0. (Since the life of the LM message
in the network has ended at this point, it is up to the receiver
whether these final modifications are made to the packet. If the
message is to be forwarded on for external post-processing
(Section 2.9.7), then these modifications MUST be made.)
Upon out-of-band receipt of an LM Response message, the Counter 1 and
Counter 2 fields MUST NOT be used for purposes of loss measurement.
If the Control Code in an LM Response is anything other than 0x1
(Success), the counter values in the response MUST NOT be used for
purposes of loss measurement. If the Control Code indicates an error
condition, or if the response message is invalid, the LM operation
MUST be terminated and an appropriate notification to the user
generated.
4.2.6. Loss Calculation
Calculation of packet loss is carried out according to the procedures
in Section 2.2. The X flag in an LM message informs the device
performing the calculation whether to perform 32-bit or 64-bit
arithmetic. If the flag value is equal to 1, all interfaces involved
in the LM operation have written 64-bit counter values, and 64-bit

arithmetic can be used. If the flag value is equal to 0, at least
one interface involved in the operation has written a 32-bit counter
value, and 32-bit arithmetic is carried out using the low-order 32
bits of each counter value.
Note that the semantics of the X flag allow all devices to
interoperate regardless of their counter size support. Thus, an
implementation MUST NOT generate an error response based on the value
of this flag.
4.2.7. Quality of Service
The TC field of the LSE corresponding to the channel (e.g., LSP)
being measured SHOULD be set to a traffic class equal to or better
than the best TC within the measurement scope to minimize the chance
of out-of-order conditions.
4.2.8. G-ACh Packets
By default, direct LM MUST exclude packets transmitted and received
over the Generic Associated Channel (G-ACh). An implementation MAY
provide the means to alter the direct LM scope to include some or all
G-ACh messages. Care must be taken when altering the LM scope to
ensure that both endpoints are in agreement.
4.2.9. Test Messages
In the case of inferred LM, the packets counted for LM consist of
test messages generated for this purpose, or of some other class of
packets deemed to provide a good proxy for data packets flowing over
the channel. The specification of test protocols and proxy packets
is outside the scope of this document, but some guidelines are
discussed below.
An identifier common to both the test or proxy messages and the LM
messages may be required to make correlation possible. The combined
value of the Session Identifier and DS fields SHOULD be used for this
purpose when possible. That is, test messages in this case will
include a 32-bit field that can carry the value of the combined
Session Identifier + DS field present in LM messages. When TC-
specific LM is conducted, the DS field of the LSE in the label stack
of a test message corresponding to the channel (e.g., LSP) over which
the message is sent MUST correspond to the DS value in the associated
LM messages.
A separate test message protocol SHOULD include a timeout value in
its messages that informs the responder when to discard any state
associated with a specific test.

4.2.10. Message Loss and Packet Misorder Conditions
Because an LM operation consists of a message sequence with state
maintained from one message to the next, LM is subject to the effects
of lost messages and misordered packets in a way that DM is not.
Because this state exists only on the querier, the handling of these
conditions is, strictly speaking, a local matter. This section,
however, presents recommended procedures for handling such
conditions. Note that in the absence of ECMP, packet misordering
within a traffic class is a relatively rare event.
The first kind of anomaly that may occur is that one or more LM
messages may be lost in transit. The effect of such loss is that
when an LM Response is next received at the querier, an unambiguous
interpretation of the counter values it contains may be impossible,
for the reasons described at the end of Section 2.2. Whether this is
so depends on the number of messages lost and the other variables
mentioned in that section, such as the LM message rate and the
channel parameters.
Another possibility is that LM messages are misordered in transit, so
that, for instance, the response to LM[n] is received prior to the
response to LM[n-1]. A typical implementation will discard the late
response to LM[n-1], so that the effect is the same as the case of a
lost message.
Finally, LM is subject to the possibility that data packets are
misordered relative to LM messages. This condition can result, for
example, in a transmit count of 100 and a corresponding receive count
of 101. The effect here is that the A_TxLoss[n-1,n] value (for
example) for a given measurement interval will appear to be extremely
(if not impossibly) large. The other case, where an LM message
arrives earlier than some of the packets, simply results in those
packets being counted as lost.
An implementation SHOULD identify a threshold value that indicates
the upper bound of lost packets measured in a single computation
beyond which the interval is considered unmeasurable. This is called
the "MaxLMIntervalLoss threshold". It is clear that this threshold
should be no higher than the maximum number of packets (or bytes) the
channel is capable of transmitting over the interval, but it may be
lower. Upon encountering an unmeasurable interval, the LM state
(i.e., data values from the last LM message received) SHOULD be
discarded.
With regard to lost LM messages, the MaxLMInterval (see Section 2.2)
indicates the maximum amount of time that can elapse before the LM
state is discarded. If some messages are lost, but a message is

subsequently received within MaxLMInterval, its timestamp or sequence
number will quantify the loss, and it MAY still be used for
measurement, although the measurement interval will in this case be
longer than usual.
If an LM message is received that has a timestamp less than or equal
to the timestamp of the last LM message received, this indicates that
an exception has occurred, and the current interval SHOULD be
considered unmeasurable unless the implementation has some other way
of handling this condition.
4.3. Delay Measurement Procedures
4.3.1. Transmitting a Delay Measurement Query
When transmitting a DM Query, the Version and Reserved fields MUST be
set to 0. The R flag MUST be set to 0, the T flag MUST be set to 1,
and the remaining flag bits MUST be set to 0.
The Control Code field MUST be set to one of the values for Query
messages listed in Section 3.1; if the channel is unidirectional,
this field MUST NOT be set to 0x0 (Query: In-band Response
Requested).
The Querier Timestamp Format field MUST be set to the timestamp
format used by the querier when writing timestamp fields in this
message; the possible values for this field are listed in
Section 3.4. The Responder Timestamp Format and Responder's
Preferred Timestamp Format fields MUST be set to 0.
The Session Identifier field can be set arbitrarily. The DS field
MUST be set to the traffic class being measured.
The Timestamp 1 field SHOULD be set to the time at which this DM
Query is transmitted, in the format indicated by the Querier
Timestamp Format field. The Timestamp 2 field MUST be set to 0. If
a response was previously received in this measurement session, the
Timestamp 1 and Timestamp 2 fields of the most recent such response
MAY be copied to the Timestamp 3 and Timestamp 4 fields,
respectively, of this query; otherwise, the Timestamp 3 and Timestamp
4 fields MUST be set to 0.
4.3.2. Receiving a Delay Measurement Query
Upon receipt of a DM Query message, the Timestamp 2 field SHOULD be
set to the time at which this DM Query was received.

At this point, the DM Query message must be inspected. If the
Control Code field is set to 0x2 (No Response Requested), a DM
Response message MUST NOT be transmitted. If the Control Code field
is set to 0x0 (In-band Response Requested) or 0x1 (Out-of-band
Response Requested), then an in-band or out-of-band response,
respectively, SHOULD be transmitted unless this has been prevented by
an administrative, security, or congestion control mechanism.
In the case of a fatal exception that prevents the requested
measurement from being made, the error SHOULD be reported, via either
a response, if one was requested, or else as a notification to the
user.
4.3.3. Transmitting a Delay Measurement Response
When constructing a Response to a DM Query, the Version and Reserved
fields MUST be set to 0. The R flag MUST be set to 1, the T flag
MUST be set to 1, and the remaining flag bits MUST be set to 0.
The Session Identifier and Querier Timestamp Format (QTF) fields MUST
be copied from the DM Query. The Timestamp 1 and Timestamp 2 fields
from the DM Query MUST be copied to the Timestamp 3 and Timestamp 4
fields, respectively, of the DM Response.
The Responder Timestamp Format (RTF) field MUST be set to the
timestamp format used by the responder when writing timestamp fields
in this message, i.e., Timestamp 4 and (if applicable) Timestamp 1;
the possible values for this field are listed in Section 3.4.
Furthermore, the RTF field MUST be set equal to either the QTF or the
RPTF field. See Section 4.3.5 for guidelines on the selection of the
value for this field.
The Responder's Preferred Timestamp Format (RPTF) field MUST be set
to one of the values listed in Section 3.4 and SHOULD be set to
indicate the timestamp format with which the responder can provide
the best accuracy for purposes of delay measurement.
The Control Code field MUST be set to one of the values for Response
messages listed in Section 3.1. The value 0x10 (Unspecified Error)
SHOULD NOT be used if one of the other more specific error codes is
applicable.
If the response is transmitted in-band, the Timestamp 1 field SHOULD
be set to the time at which this DM Response is transmitted. If the
response is transmitted out-of-band, the Timestamp 1 field MUST be
set to 0. In either case, the Timestamp 2 field MUST be set to 0.

If the response is transmitted in-band and the Control Code in the
message is 0x1 (Success), then the Timestamp 1 and Timestamp 4 fields
MUST have the same format, which will be the format indicated in the
Responder Timestamp Format field.
4.3.4. Receiving a Delay Measurement Response
Upon in-band receipt of a DM Response message, the Timestamp 2 field
is set to the time at which this DM Response was received. (Since
the life of the DM message in the network has ended at this point, it
is up to the receiver whether this final modification is made to the
packet. If the message is to be forwarded on for external post-
processing (Section 2.9.7), then these modifications MUST be made.)
Upon out-of-band receipt of a DM Response message, the Timestamp 1
and Timestamp 2 fields MUST NOT be used for purposes of delay
measurement.
If the Control Code in a DM Response is anything other than 0x1
(Success), the timestamp values in the response MUST NOT be used for
purposes of delay measurement. If the Control Code indicates an
error condition, or if the response message is invalid, the DM
operation MUST be terminated and an appropriate notification to the
user generated.
4.3.5. Timestamp Format Negotiation
In case either the querier or the responder in a DM transaction is
capable of supporting multiple timestamp formats, it is desirable to
determine the optimal format for purposes of delay measurement on a
particular channel. The procedures for making this determination
SHALL be as follows.
Upon sending an initial DM Query over a channel, the querier sets the
Querier Timestamp Format (QTF) field to its preferred timestamp
format.
Upon receiving any DM Query message, the responder determines whether
it is capable of writing timestamps in the format specified by the
QTF field. If so, the Responder Timestamp Format (RTF) field is set
equal to the QTF field. If not, the RTF field is set equal to the
Responder's Preferred Timestamp Format (RPTF) field.
The process of changing from one timestamp format to another at the
responder may result in the Timestamp 1 and Timestamp 4 fields in an
in-band DM Response having different formats. If this is the case,

the Control Code in the response MUST NOT be set to 0x1 (Success).
Unless an error condition has occurred, the Control Code MUST be set
to 0x2 (Notification - Data Format Invalid).
Upon receiving a DM Response, the querier knows from the RTF field in
the message whether the responder is capable of supporting its
preferred timestamp format: if it is, the RTF will be equal to the
QTF. The querier also knows the responder's preferred timestamp
format from the RPTF field. The querier can then decide whether to
retain its current QTF or to change it and repeat the negotiation
procedures.
4.3.5.1. Single-Format Procedures
When an implementation supports only one timestamp format, the
procedures above reduce to the following simple behavior:
o All DM Queries are transmitted with the same QTF;
o All DM Responses are transmitted with the same RTF, and the RPTF
is always set equal to the RTF;
o All DM Responses received with RTF not equal to QTF are discarded;
o On a unidirectional channel, all DM Queries received with QTF not
equal to the supported format are discarded.
4.3.6. Quality of Service
The TC field of the LSE corresponding to the channel (e.g., LSP)
being measured MUST be set to the value that corresponds to the DS
field in the DM message.
4.4. Combined Loss/Delay Measurement Procedures
The combined LM/DM message defined in Section 3.3 allows loss and
delay measurement to be carried out simultaneously. This message
SHOULD be treated as an LM message that happens to carry additional
timestamp data, with the timestamp fields processed as per delay
measurement procedures.