<?xml version="1.0" encoding="US-ASCII"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc
    category="exp"
    docName="draft-ietf-bfd-stability-21"
    ipr="trust200902"
    consensus="true"
    submissionType="IETF">
  <front>
    <title abbrev="BFD Stability">BFD Stability</title>
    <author fullname="Ashesh Mishra" initials="A" surname="Mishra">
      <organization>Aalyria Technologies</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country/>
        </postal>
        <phone/>
        <email>ashesh@aalyria.com</email>
        <uri/>
      </address>
    </author>

    <author fullname="Mahesh Jethanandani"
	    initials="M"
	    surname="Jethanandani">
      <organization>Arrcus, Inc.</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country>USA</country>
        </postal>
        <phone/>
        <facsimile/>
        <email>mjethanandani@gmail.com</email>
      </address>
    </author>

    <author fullname="Ankur Saxena" initials="A" surname="Saxena">
      <organization>Ciena Corporation</organization>
      <address>
        <postal>
          <street>3939 North 1st Street</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95134</code>
          <country>USA</country>
        </postal>
        <phone/>
        <facsimile/>
        <email>ankurpsaxena@gmail.com</email>
        <uri>www.ciena.com</uri>
      </address>
    </author>

    <author fullname="Santosh Pallagatti" initials="S" surname="Pallagatti">
      <organization>Zscaler</organization>
      <address>
        <postal>
          <street/>
          <city>Bangalore</city>
          <region>Karnataka</region>
          <code>560103</code>
          <country>India</country>
        </postal>
        <phone/>
        <facsimile/>
        <email>santosh.pallagatti@gmail.com</email>
        <uri/>
      </address>
    </author>

    <author fullname="Mach Chen" initials="M" surname="Chen">
      <organization>Huawei</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country/>
        </postal>
        <phone/>
        <facsimile/>
        <email>mach.chen@huawei.com</email>
        <uri/>
      </address>
    </author>
    <date/>

    <abstract>
      <t>
	This document describes extensions to the Bidirectional
	Forwarding Detection (BFD) protocol to measure BFD
	stability. Specifically, it describes a mechanism for
	the detection of BFD packet loss.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The Bidirectional Forwarding Detection (<xref
      target="RFC5880">BFD)</xref> protocol operates by transmitting and
      receiving BFD control packets, generally at high frequency, over the
      datapath being monitored. In order to prevent significant data loss due
      to a datapath failure, BFD session detection time as defined in <xref
      target="RFC5880">BFD</xref> is set to the smallest feasible value.</t>

      <t>
	A <xref target="RFC5880">BFD</xref> session will remain in the
	Up state as long as it receives at least one BFD packet within the
	Detection Time interval. However, additional packet loss
	within that time interval is not noted by the BFD state
	machinery. Noting the other missed packets provides a valuable
	indicator of systemic issues or a deteriorating network that
	may warrant preventive action.
      </t>
      <t>
	This document proposes an experimental mechanism to detect
	lost packets in a BFD session in addition to the datapath
	fault detection mechanisms of BFD.  Such a mechanism, combined
	with 'received-packet-count' defined in the <xref
	target="RFC9314">YANG Data Model for Bidrectional Forward
	Detection (BFD)</xref> permits operators to measure the
	stability of BFD sessions. The details of the motivation for
	experimental status can be found in <xref
	target="experimental-status"/>. Implementations may also do
	additional analysis of the packet loss over a time
	interval. Such an analysis is outside the scope of this
	document.
      </t>

      <t>
	This document does not propose any BFD extension to measure
	data traffic loss or delay on a link or tunnel, and the scope
	is limited to BFD packets.
      </t>

      <section title="Note to the RFC Editor">
	<t>
	  This document uses several placeholder values throughout the
	  document. Please replace them as follows and remove this
	  section before publication.
	</t>
        <t>
	  RFC XXXX, where XXXX is the number assigned to this document
	  at the time of publication.
	</t>
        <t>
	  2025-10-30, with the actual date of the publication of this
	  document.
	</t>
      </section>
    </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 <xref
      target="RFC2119">RFC 2119</xref> and <xref target="RFC8174">RFC
      8174</xref>.</t>

      <t>
	The reader is expected to be familiar with the <xref
	target="RFC5880">BFD</xref>. In particular, the term
	'meticulous' specified in <xref
	target="I-D.ietf-bfd-secure-sequence-numbers">Meticulous Keyed
	ISAAC for BFD Optimized Authentication</xref> means that the
	Sequence number is incremented on every new packet that is
	sent.
      </t>
    </section>

    <section title="Use Cases">
      <t>
	Bidirectional Forwarding Detection, as defined in <xref
	target="RFC5880">BFD</xref> cannot detect any BFD packet loss
	if the loss does not last for the Detection Time. This
	document proposes a method to detect dropped packets on the
	receiver. For example, if the receiver receives BFD control
	packet k at time t but receives packet k+3 at time t+10ms, and
	never receives packet k+1 and/or k+2, then it has experienced
	a packet loss.
      </t>

      <t>This proposal enables BFD implementations to generate
	diagnostic information on the health of each BFD session that
	could be used to preempt probability of a failure on a
	datapath that BFD was monitoring by allowing time for a
	corrective action to be taken.
      </t>

      <t>
	In a faulty datapath scenario, an operator can use BFD health
	information to trigger the delay and loss measurement OAM
	protocol <xref target="Y-1731">Connectivity Fault Management
	(CFM)</xref> or <xref target="RFC6374">Packet Loss and Delay
	Measurement for MPLS Networks</xref> to further isolate the
	issue.
      </t>
    </section>

    <section title="Functionality">
      <t>
        BFD stability measurement requires that a BFD Meticulous Authentication
        type is configured.
      </t>
      <t>
        The ietf-bfd-stability YANG model, defined in this document, provides
        the ability to configure BFD stability measurement for BFD sessions by
        configuring the 'stability' flag. The 'lost-packet-count' leaf permits
        monitoring of stability issues as defined in this document for BFD
        sessions that have the stability flag enabled.
      </t>
      <t>
        The configuration of BFD stability measurement and monitoring using
        other methods than the attached YANG model is out of scope from this
        document.
      </t>
    </section>

    <section anchor="null-auth-type" title="NULL Auth Type">
      <t>
	The NULL Authentication Type, defined in this document, can be
	used to provide a meticulously increasing sequence number
	<xref target="RFC5880">BFD</xref> for stability measurement.
	It provides none of the protections desired for authentication
	and is used only to provide BFD stability services to BFD
	sessions that otherwise have no authentication in use.</t>

      <t>If the Authentication Present (A) bit is set in the header
      as defined in <xref target="RFC5880" section="4">BFD</xref>,
      and the Authentication Type field contains TBD, the
      Authentication section has the following format:
      <figure
          align="center" title="NULL Auth Type">
        <artwork><![CDATA[
       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   Auth Type   |   Auth Len    |  Auth Key ID  |   Reserved    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Sequence Number                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ]]></artwork>
      </figure>
      where:
      </t>

      <t>Auth Type (8 bits): The Authentication Type, which in this
	case is TBD (NULL, to be assigned by IANA, with a suggested
	value of 6).
      </t>

      <t>Auth Len (8 bits): The length of the NULL Auth Type, in bytes;
	i.e., 8 bytes
      </t>

      <t>Auth Key ID (8 bits): The authentication key ID in use for this
	packet. MUST be set to zero and MUST be ignored on receipt.
      </t>

      <t>Reserved (8 bits): This byte MUST be set to zero on transmit
	and MUST be ignored on receipt.
      </t>

      <t>Sequence Number (32 bits): The sequence number for this
	packet.  This value is incremented for each successive packet
	transmitted for a session.  Implementations will use sequence
	numbers (bfd.XmitAuthSeq) as defined in <xref
	target="RFC5880">BFD</xref>.
      </t>

      <t>
	If bfd.AuthSeqKnown is 1, and the received Sequence Number
	field is not equal to bfd.RcvAuthSeq + 1 (in a circular number
	space), then the loss count is incremented by the difference
	between the received Sequence Number and bfd.RcvAuthSeq and
	bfd.RcvAuthSeq is set to the received Sequence Number.
      </t>

      <t>
	Otherwise (bfd.AuthSeqKnown is 0), bfd.AuthSeqKnown MUST be
	set to 1, and bfd.RcvAuthSeq MUST be set to the value of the
	received Sequence Number field as defined in <xref
	target="RFC5880" sectionFormat="comma"
	section="6.8.1">BFD</xref>, and the packet MUST
	be accepted.
      </t>

      <t>
	According to <xref target="RFC5880" sectionFormat="comma"
	section="6.7.3">BFD</xref> a receiver MUST discard a received
	packet that lies outside the range of bfd.RcvAuthSeq and
	bfd.RcvAuthSeq + (3 * Detect Multi). If it is within that
	range, but is missing a packet, it can be used to detect a
	loss. In case of NULL authentication where packets containing
	sequence numbers are accepted on receipt, an attacker with
	unauthenticated sequence number could move the Sequence Number
	forward. Meanwhile, the actual BFD neighbor that continues to
	send packets will find them discarded and the session would
	drop. To prevent such an attack, the received Sequence Number
	MUST NOT be compared with bfd.RcvAuthSeq for purposes of
	discarding the BFD packets.
      </t>
    </section>

    <section title="Theory of Operation">
      <t>This mechanism allows operators to measure the loss of BFD control
      packets.  A BFD authentication type carrying a meticulously increasing
      sequence number is required to support this loss measurement.
      Authentication types that provide for meticulously increasing sequence
      numbers include:</t>

      <ul>
        <li>
          Meticulously Keyed MD5 and SHA1, defined in
          <xref target="RFC5880"/>.
        </li>
        <li>
          Meticulously Keyed ISAAC, defined in
          <xref target="I-D.ietf-bfd-secure-sequence-numbers"/>.
        </li>
        <li>
          The NULL authentication mechanism, which does not provide for
          authentication but carries a meticulously increasing sequence number,
          defined in this document.
        </li>
      </ul>

      <t>
	Other authentication types that provide for meticulously increasing
	sequence numbers appropriate for this mechanism may be defined in future
	specifications.
      </t>

      <section title="Loss Measurement">
        <t>
	  Loss measurement counts the number of BFD control packets
	  missed at the receiver during any Detection Time <xref
	  target="RFC5880" section="6.8.4"
	  sectionFormat="comma">BFD</xref> period. The loss is detected
	  by comparing the Sequence Number field in successive BFD
	  control packets. The Sequence Number in each successive
	  control packet generated on a BFD session by the transmitter
	  is incremented by one. This loss count can then be exposed
	  using the YANG module defined in the subsequent section. See
	  discussion on <xref target="out-of-order-packets">Out of
	  Order Packets</xref> later in the document.
	</t>

        <t>
	  The first BFD authentication section with a non-zero
	  sequence number, in a valid BFD control packet, processed by
	  the receiver, is used for bootstrapping the logic.
	</t>
      </section>

      <section anchor="out-of-order-packets" title="Out of Order Packets">
        <t>
	  Some transmission mechanisms - for example, Link Aggregate Groups
	  (LAG), or Equal Cost Multipath (ECMP) - can result in out of order
	  packet delivery.  In circumstances where BFD packets are not lost, but
	  are delivered out of order, strict comparison of increasing sequence
	  numbers may result in classifying the out of order packets as packet
	  loss.
	</t>
	<t>
	  Implementations MAY provide mechanisms wherein all expected
	  packets received across an expected interval, but delivered
	  out of order are not considered lost packets.
	</t>
      </section>
    </section>

    <section anchor="yang-module" title="Stability YANG Module">
      <section anchor="data-model-overview" title="Data Model Overview">
        <t>
	  This YANG module augments the base BFD YANG module to add
	  attributes such as the flag 'stability' related
	  to the experiment of BFD Stability. The feature statement
	  'stability' needs to be enabled to indicate that BFD
	  Stability is supported by the implementation. In addition, a
	  loss count per-session or lsp for BFD packets that are lost
	  has also been added in this model.
	</t>

        <t>
	  <figure>
            <artwork><![CDATA[
module: ietf-bfd-stability

  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh
            /bfd-ip-sh:sessions/bfd-ip-sh:session:
    +--rw stability?   boolean {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh
            /bfd-ip-mh:session-groups/bfd-ip-mh:session-group:
    +--rw stability?   boolean {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-lag:lag
            /bfd-lag:sessions/bfd-lag:session:
    +--rw stability?   boolean {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls
            /bfd-mpls:session-groups/bfd-mpls:session-group:
    +--rw stability?   boolean {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh
            /bfd-ip-sh:sessions/bfd-ip-sh:session
            /bfd-ip-sh:session-statistics:
    +--ro lost-packet-count?   yang:counter64 {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh
            /bfd-ip-mh:session-groups/bfd-ip-mh:session-group
            /bfd-ip-mh:sessions/bfd-ip-mh:session-statistics:
    +--ro lost-packet-count?   yang:counter64 {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-lag:lag
            /bfd-lag:sessions/bfd-lag:session/bfd-lag:member-links
            /bfd-lag:micro-bfd-ipv4/bfd-lag:session-statistics:
    +--ro lost-packet-count?   yang:counter64 {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-lag:lag
            /bfd-lag:sessions/bfd-lag:session/bfd-lag:member-links
            /bfd-lag:micro-bfd-ipv6/bfd-lag:session-statistics:
    +--ro lost-packet-count?   yang:counter64 {stability}?
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls
            /bfd-mpls:session-groups/bfd-mpls:session-group
            /bfd-mpls:sessions/bfd-mpls:session-statistics:
    +--ro lost-packet-count?   yang:counter64 {stability}?
]]>
	    </artwork>
          </figure>
	</t>
      </section>

      <section title="YANG Module">
        <t>
	  This YANG module imports modules defined in <xref
	  target="RFC6991">Common YANG Types</xref>, <xref
	  target="RFC8349">A YANG Data Model for Routing</xref>, and
	  <xref target="RFC9314">YANG Data Model for Bidirectional
	  Forwading Detection (BFD)</xref>.
	</t>

        <t>
	  <figure>
            <artwork><![CDATA[
	    <CODE BEGINS> file "ietf-bfd-stability@2025-10-30.yang"
module ietf-bfd-stability {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bfd-stability";
  prefix "bfd-s";

  import ietf-yang-types {
    prefix "yang";
    reference
      "RFC 6991: Common YANG Data Types";
  }
  
  import ietf-routing {
    prefix "rt";
    reference
      "RFC 8349: A YANG Data Model for Routing Management
       (NMDA version)";
  }

  import ietf-bfd {
    prefix bfd;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-ip-sh {
    prefix bfd-ip-sh;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-ip-mh {
    prefix bfd-ip-mh;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-lag {
    prefix bfd-lag;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-mpls {
    prefix bfd-mpls;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-key-chain {
    prefix key-chain;
    reference
      "RFC 8177: YANG Key Chain.";
  }

  organization
    "IETF BFD Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/bfd>
     WG List:  <rtg-bfd@ietf.org>

     Authors: Mahesh Jethanandani (mjethanandani@gmail.com)
              Ashesh Mishra (mishra.ashesh@gmail.com)
              Ankur Saxena (ankurpsaxena@gmail.com)
              Santosh Pallagatti (santosh.pallagati@gmail.com)
              Mach Chen (mach.chen@huawei.com).";
              

  description
    "This YANG module augments the base BFD YANG model to add
     experimental attributes related to BFD Stability.
     In particular, it adds a per-session count for BFD packets
     that are lost.

     Copyright (c) 2025 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in the Revised BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
     for full legal notices.

     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 (RFC 2119) (RFC 8174) when, and only when,
     they appear in all capitals, as shown here.";

  revision "2025-10-30" {
    description
      "Initial Version.";
    reference
      "RFC XXXX: BFD Stability.";
  }

  feature stability {
    description
      "This feature enables BFD sessions to be monitored for lost
       packets.";
  }

  identity null-auth {
    base key-chain:crypto-algorithm;
    description
      "BFD Null Auth type defined in this draft.";
    reference
      "RFC XXXX: BFD Stability.";
  }

  grouping lost-packet-count {
    leaf lost-packet-count {
      if-feature "stability";
      type yang:counter64;
      description
        "Number of BFD packets that were lost, where loss is
         determined by the fact that the sequence number is
         not consecutive. This counter should be present only if
         stability is configured.";
    }
    description
      "Grouping of statistics related to BFD stability.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh/" +
          "bfd-ip-sh:sessions/bfd-ip-sh:session" {
    leaf stability {
      if-feature "stability";
      type boolean;
      must "../bfd-ip-sh:authentication/bfd-ip-sh:meticulous = " +
           "'true'";
      default false;
      description
        "If set to true, this enables the BFD session to monitor
         for stability, i.e., to watch how many packets are getting
         dropped.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       stability for IP Single Hop Sessions.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh/" +
          "bfd-ip-mh:session-groups/bfd-ip-mh:session-group" {
    leaf stability {
      if-feature "stability";
      type boolean;
      must "../bfd-ip-mh:authentication/bfd-ip-mh:meticulous = " +
           "'true'";
      default false;
      description
        "If set to true, this enables the BFD session to monitor
         for stability, i.e., to watch how many packets are getting
         dropped.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       stability for Multi Hop Sessions.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-lag:lag/" +
          "bfd-lag:sessions/bfd-lag:session" {
    leaf stability {
      if-feature "stability";
      type boolean;
      must "../bfd-lag:authentication/bfd-lag:meticulous = " +
           "'true'";
      default false;
      description
        "If set to true, this enables the BFD session to monitor
         for stability, i.e., to watch how many packets are getting
         dropped.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       stability for LAG session.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls/" +
    "bfd-mpls:session-groups/bfd-mpls:session-group" {
    leaf stability {
      if-feature "stability";
      type boolean;
      must "../bfd-mpls:authentication/bfd-mpls:meticulous = " +
           "'true'";
      default false;
      description
        "If set to true, this enables the BFD session to monitor
         for stability, i.e., to watch how many packets are getting
         dropped.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       stability for MPLS.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh/" +
          "bfd-ip-sh:sessions/bfd-ip-sh:session/" +
          "bfd-ip-sh:session-statistics" {
    uses lost-packet-count;
    description
      "Augment the 'bfd' container to add statistics related to BFD
       stability for IP Single Hop Sessions.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh/" +
          "bfd-ip-mh:session-groups/bfd-ip-mh:session-group/" +
          "bfd-ip-mh:sessions/bfd-ip-mh:session-statistics" {
    uses lost-packet-count;
    description
      "Augment the 'bfd' container to add statistics related to BFD
       stability for IP Multi Hop Sessions.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-lag:lag/" +
          "bfd-lag:sessions/bfd-lag:session/bfd-lag:member-links/" +
          "bfd-lag:micro-bfd-ipv4/bfd-lag:session-statistics" {
    uses lost-packet-count;
    description
      "Augment the 'bfd' container to add statistics related to BFD
       stability for Micro BFD sessions for IPv4.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-lag:lag/" +
          "bfd-lag:sessions/bfd-lag:session/bfd-lag:member-links/" +
          "bfd-lag:micro-bfd-ipv6/bfd-lag:session-statistics" {
    uses lost-packet-count;
    description
      "Augment the 'bfd' container to add statistics related to BFD
       stability for Micro BFD sessions for IPv6.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls/" +
          "bfd-mpls:session-groups/bfd-mpls:session-group/" +
          "bfd-mpls:sessions/bfd-mpls:session-statistics" {
    uses lost-packet-count;
    description
      "Augment the 'bfd' container to add statistics related to BFD
       stability for MPLS sessions.";
  }
}
	    <CODE ENDS>
	    ]]>
	    </artwork>
          </figure>
	</t>
      </section>
    </section>

    <section title="IANA Considerations">
      <t>This document requests one new authentication type and
      registers one URIs in the "ns" subregistry of the "IETF XML"
      registry <xref target="RFC3688"/>.</t>

      <section anchor="auth-type" title="Auth Type">
	<t>
	  This document requests an update to the registry titled "BFD
	  Authentication Types". IANA is requested to assign a new
	  BFD AuthType:
	  <ul>
	    <li>
	      NULL Auth Type, with a suggested value of 6.
	    </li>
	  </ul>
	</t>
      </section>
      <section anchor="ietf-xml-registry" title="IETF XML Registry">
	<t>Following the format in <xref target="RFC3688"/>, the following
	registrations are requested:</t>
	<t>
	  <figure>
	    <artwork><![CDATA[URI: urn:ietf:params:xml:ns:yang:ietf-bfd-stability
Registrant Contact: The IESG
XML: N/A, the requested URI is an XML namespace.
]]>
	    </artwork>
	  </figure>
	</t>
      </section>

      <section title="The &quot;YANG Module Names&quot; Registry">
        <t>
	  This document registers one YANG module in the "YANG Module
	  Names" registry <xref target="RFC6020"/>. Following the
	  format in <xref target="RFC6020"/>, the following
	  registrations are requested:
        </t>

        <t><figure>
            <artwork><![CDATA[
name:         ietf-bfd-stability
namespace:    urn:ietf:params:xml:ns:yang:ietf-bfd-stability
prefix:       bfd-s
reference:    RFC XXXX
]]></artwork>
          </figure></t>
      </section>
    </section>

    <section title="Security Considerations">
      <section title="BFD NULL Auth Security Considerations">
	<t>
	  The use of a BFD authentication mechanism that protects the
	  BFD packets is RECOMMENDED.
	</t>

        <t>
	  The Security Considerations of <xref target="RFC5880"/> for
	  unauthenticated BFD all apply to the new NULL authentication
	  type.  The NULL Authentication type, defined in this
	  document, provides none of the properties desired for
	  authenticating BFD packets.  It is intended to provide BFD
	  sessions that otherwise would not use authentication, a
	  sequence number that can be used for purposes of detecting
	  lost packets.
	</t>

	<t>
	  The lack of a computed AuthKey/Digest over the BFD packet,
	  but the presence of a Sequence Number makes this
	  authentication type susceptible to injection attacks.  BFD
	  without authentication is vulnerable to session resets; the
	  NULL Auth type does not change this.</t>

	<t>
	  When the NULL Authentication type is used for BFD Stability
	  purposes, maliciously injected packets that do not reset the
	  BFD session can resemble high packet loss. Sessions such as
	  multi-hop routed paths, tunnels without authentication, or
	  MPLS LSP, therefore, have security guarantees that are
	  identical to situations where BFD is run without
	  authentication.
	</t>
      </section>
      <section title="YANG Security Considerations">
	<t>
	  The YANG module specified in this document defines a schema
	  for data that is designed to be accessed via network
	  management protocols such as <xref
	  target="RFC6241">NETCONF</xref> or <xref
	  target="RFC8040">RESTCONF</xref>. These YANG-based
	  management protocols have to use a secure transport layer
	  (e.g., <xref target="RFC4252">SSH</xref>, <xref
	  target="RFC8446">TLS</xref>, and <xref
	  target="RFC9000">QUIC</xref>) and have to use mutual
	  authentication.
	</t>
	<t>
	  The <xref target="RFC8341">NETCONF Access Control Model
	  (NACM)</xref> provides the means to restrict access for
	  particular NETCONF or RESTCONF users to a preconfigured
	  subset of all available NETCONF or RESTCONF protocol
	  operations and content.
	</t>

	<t>
	  The YANG module does not define any
	  writeable/creatable/deletable data nodes that can have an
	  adverse impact on a BFD session.
	</t>

	<t>
	  The only readable data nodes in YANG module may be considered
	  sensitive or vulnerable in some network environments. It is
	  thus important to control read access (e.g., via get,
	  get-config, or notification) to these data nodes.
	</t>

	<t>
	  The model defines a read-only node to indicate the number of
	  packets that were lost. Access to this information may allow
	  a malicious user information on which links are experiencing
	  issues. In addition, and as stated in <xref
	  target="out-of-order-packets">Out of Order Packets</xref>,
	  on links such as LAG or ECMP, there is a possibility of
	  packets being delivered out-of-order. A strict comparison of
	  increasing sequence numbers may result in classifying those
	  out of order packets as packet loss.
	</t>

	<t>The YANG module does not define any RPC operations.</t>
      </section>
    </section>


    <section title="Contributors">
      <t>
	The authors of this document would like to acknowledge Jeff
	Haas as a contributor to this document. His contribution lead
	to a significant improvement of the document. In addition,
	Manav Bhatia contributed to this document.
      </t>
    </section>

    <section title="Acknowledgements">
      <t>
	Authors would like to thank Nobo Akiya, Dileep Singh, Basil
	Saji, Sagar Soni, Albert Fu, Peng Fang, and Mallik Mudigonda
	who contributed to this document. Thanks to Christian Huitema
	for the SECDIR and Ebben Aries for the YANG Doctors review.
      </t>
      <t>
	Thanks to Reshad Rehman for being the shepherd of the
	document.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119.xml'?>

      <?rfc include='reference.RFC.3688.xml'?>

      <?rfc include='reference.RFC.4252.xml'?>

      <?rfc include='reference.RFC.5880.xml'?>

      <?rfc include='reference.RFC.6020.xml'?>

      <?rfc include='reference.RFC.6991.xml'?>

      <?rfc include='reference.RFC.8174.xml'?>

      <?rfc include='reference.RFC.8341.xml'?>

      <?rfc include='reference.RFC.8349.xml'?>

      <?rfc include='reference.RFC.9314.xml'?>
    </references>
    <references title="Informative References">
      <?rfc include='reference.RFC.6241.xml'?>
      <?rfc include='reference.RFC.6374.xml'?>
      <?rfc include='reference.RFC.8040.xml'?>
      <?rfc include='reference.RFC.8446.xml'?>
      <?rfc include='reference.RFC.9000.xml'?>
      <?rfc include='reference.I-D.ietf-bfd-secure-sequence-numbers.xml'?>
      <reference anchor="Y-1731">
        <front>
          <title>
	    OAM Functions and Mechanisms for Ethernet-based Networks
	  </title>
          <author>
            <organization>ITU-T</organization>
          </author>
	  <date month="November" year="2013"/>
	</front>
	<seriesInfo name="Recommendation" value="G.8013/Y.1731"/>
      </reference>

    </references>
    <section anchor="experimental-status" title="Experimental Status">
      <t>
	This document describes an experiment that will present a
	candidate solution to predict whether a given <xref
	target="RFC5880">BFD</xref> session will continue to be
	stable. The experiment will use the packet lost count and the
	'received-packet-count' defined in the <xref
	target="RFC9314">YANG Data Model for Bidirectional Forward
	Detection (BFD)</xref> to determine how stable is the
	session. The reason why this document is on an
	Experimental track is because there are no known
	implementations or proof-of-concept. As a result, the authors
	are not clear whether a simple lost count is enough to predict
	the stability or there will be a need to have a more granular
	count.
      </t>
      <t>
	This document is classified as Experimental and is not part of
	the IETF Standards Track.
      </t>
    </section>
    <section anchor="examples" title="Examples">
      <t>
	This section tries to show some examples in how the model can
	be configured for stability.
      </t>
      <section anchor="example-a.1.1" title="Single Hop BFD Configuration">
	<t>
          This example demonstrates how a Single Hop BFD session can
          be configured to enable monitoring of a session for
          stability.
	</t>
	<t>
          <figure>
            <artwork><![CDATA[
=============== NOTE: '\' line wrapping per RFC 8792 ===============

<?xml version="1.0" encoding="UTF-8"?>
<key-chains
    xmlns="urn:ietf:params:xml:ns:yang:ietf-key-chain"
    xmlns:kc="urn:ietf:params:xml:ns:yang:ietf-key-chain">
  <key-chain>
    <name>bfd-stability-config</name>
    <description>"An example for BFD Stabalized configuration."</de\
scription>
    <key>
      <key-id>55</key-id>
      <lifetime>
        <send-lifetime>
          <start-date-time>2025-01-01T00:00:00Z</start-date-time>
          <end-date-time>2025-02-01T00:00:00Z</end-date-time>
        </send-lifetime>
        <accept-lifetime>
          <start-date-time>2024-12-31T23:59:55Z</start-date-time>
          <end-date-time>2025-02-01T00:00:05Z</end-date-time>
        </accept-lifetime>
      </lifetime>
      <crypto-algorithm>kc:sha-1</crypto-algorithm>
    </key>
  </key-chain>
</key-chains>
<interfaces
    xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
    xmlns:if-type="urn:ietf:params:xml:ns:yang:iana-if-type">
  <interface>
    <name>eth0</name>
    <type>if-type:ethernetCsmacd</type>
  </interface>
</interfaces>
<routing
    xmlns="urn:ietf:params:xml:ns:yang:ietf-routing"
    xmlns:bfd-types="urn:ietf:params:xml:ns:yang:ietf-bfd-types"
    xmlns:stability="urn:ietf:params:xml:ns:yang:ietf-bfd-stability\
">
  <control-plane-protocols>
    <control-plane-protocol>
      <type>bfd-types:bfdv1</type>
      <name>name:BFD</name>
      <bfd xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd">
        <ip-sh xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd-ip-sh">
          <sessions>
            <session>
              <interface>eth0</interface>
              <dest-addr>2001:db8:0:113::101</dest-addr>
              <desired-min-tx-interval>10000</desired-min-tx-interv\
al>
              <required-min-rx-interval>
                10000
              </required-min-rx-interval>
              <stability:stability>true</stability:stability>
              <authentication>
                <key-chain>bfd-stability-config</key-chain>
                <meticulous>true</meticulous>
              </authentication>
            </session>
          </sessions>
        </ip-sh>
      </bfd>
    </control-plane-protocol>
  </control-plane-protocols>
</routing>
            ]]>
            </artwork>
          </figure>
	</t>
      </section>
            <section anchor="example-a.1.2" title="Use of NULL Auth">
	<t>
          This example demonstrates how to configure NULL Auth
          to enable monitoring of a session for stability.
	</t>
	<t>
          <figure>
            <artwork><![CDATA[
=============== NOTE: '\' line wrapping per RFC 8792 ===============

<?xml version="1.0" encoding="UTF-8"?>
<key-chains
    xmlns="urn:ietf:params:xml:ns:yang:ietf-key-chain"
    xmlns:stability="urn:ietf:params:xml:ns:yang:ietf-bfd-stability\
">
  <key-chain>
    <name>bfd-stability-config</name>
    <description>"An example for BFD Stability configuration."</des\
cription>
    <key>
      <key-id>55</key-id>
      <lifetime>
        <send-lifetime>
          <start-date-time>2025-01-01T00:00:00Z</start-date-time>
          <end-date-time>2025-02-01T00:00:00Z</end-date-time>
        </send-lifetime>
        <accept-lifetime>
          <start-date-time>2024-12-31T23:59:55Z</start-date-time>
          <end-date-time>2025-02-01T00:00:05Z</end-date-time>
        </accept-lifetime>
      </lifetime>
      <crypto-algorithm>stability:null-auth</crypto-algorithm>
    </key>
  </key-chain>
</key-chains>
<interfaces
    xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
    xmlns:if-type="urn:ietf:params:xml:ns:yang:iana-if-type">
  <interface>
    <name>eth0</name>
    <type>if-type:ethernetCsmacd</type>
  </interface>
</interfaces>
<routing
    xmlns="urn:ietf:params:xml:ns:yang:ietf-routing"
    xmlns:bfd-types="urn:ietf:params:xml:ns:yang:ietf-bfd-types"
    xmlns:stability="urn:ietf:params:xml:ns:yang:ietf-bfd-stability\
">
  <control-plane-protocols>
    <control-plane-protocol>
      <type>bfd-types:bfdv1</type>
      <name>name:BFD</name>
      <bfd xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd">
        <ip-sh xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd-ip-sh">
          <sessions>
            <session>
              <interface>eth0</interface>
              <dest-addr>2001:db8:0:113::101</dest-addr>
              <desired-min-tx-interval>10000</desired-min-tx-interv\
al>
              <required-min-rx-interval>
                10000
              </required-min-rx-interval>
              <stability:stability>true</stability:stability>
              <authentication>
                <key-chain>bfd-stability-config</key-chain>
                <meticulous>true</meticulous>
              </authentication>
            </session>
          </sessions>
        </ip-sh>
      </bfd>
    </control-plane-protocol>
  </control-plane-protocols>
</routing>
            ]]>
            </artwork>
          </figure>
	</t>
      </section>
    </section>
  </back>
</rfc>
