<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->


<rfc category="std" docName="draft-mbind-bfd-redundancy-01" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <title abbrev="Redundant BFD sessions">
	Redundant BFD sessions
    </title>

    <!-- add 'role="editor"' below for the editors if appropriate -->
    <!-- Another author who claims to be an editor -->

    <author fullname="Marc Binderberger" initials="M."
            surname="Binderberger">
      <organization>Cisco Systems</organization>
      <address>
        <email>mbinderb@cisco.com</email>
      </address>
    </author>

    <author fullname="Nobo Akiya" initials="N."
            surname="Akiya">
      <organization>Cisco Systems</organization>
      <address>
        <email>nobo@cisco.com</email>
      </address>
    </author>

    <date day="7" month="May" year="2013" />

    <area>BFD Working Group</area>
    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
    IETF is fine for individual submissions.  
	If this element is not present, the default is "Network Working Group",
    which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>BFD</keyword>
    <keyword>redundancy</keyword>
    <keyword>redundent session</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
    	<t>This document defines a second or "shadow" BFD session to
	  an existing "primary" BFD session, providing resiliency against
	  BFD failures that are not legitimate.</t>

	  <t>Scenarios will be discussed on how presence of a shadow BFD
	  session will be beneficial in the context of high availability.</t>
    </abstract>
	
	<note title="Requirements Language">
	<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
	"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
	document are to be interpreted as described in
	<xref target="RFC2119">RFC 2119</xref>.</t>
	</note>
  </front>

  <middle>
    <section title="Introduction">

  	<t>Bidirectional Forwarding Detection <xref target="RFC5880" />
	is used to detect network failures. Link failures and peer system
	outages are some examples of failures which can be detected with
	BFD technology. Although undesirable, the BFD technology
	may falsely declare failure in some scenarios: BFD process crash,
	FPGA reset on hardware based BFD, or a card running the BFD
	functionality fails or gets removed accidentally. In all these cases,
	the forwarding being monitored by BFD may remain functional.
	Unnecessary rerouting of traffic, while not a problem per-se, can
	be a problem at a large scale of false BFD triggers, e.g. tens of
	thousands of traffic path. A serious outcome may be seen if
	a network outage occurs in a time window in which BFD is not detecting
	failures. For example, during software updates an extended timer
	value may be used, leaving the system and it's peer "blind" for any real
	liveliness problem until the BFD functionality is restored.</t>

	<t>This draft proposes to run a second "shadow" BFD session, in
	parallel to the existing "primary" BFD session. This additional
	session will have it's own unique discriminator value(s). The
	method used to differentiate discriminator zero primary and shadow 
	sessions is discussed in the following sections.</t>

    </section>

    <section title="Failure scenarios">

	<t>BFD technology requires continuous transmission of control
	packets in both directions. The rate at which both systems are required
	to transmit these packets will vary depending on operational requirements
	and configurations: BFD mode and interval. If a BFD module on one system
	is unable to transmit BFD control packets for amount of time greater than
	the negotiated failure detection time, then the BFD module on the other
	system will declare a session failure. Sometimes the cause of such
	a session failure is not related to the functionality of the path being
	monitored by BFD.</t>

	<t>Some failure scenarios which can exhibit such behaviors are described
	in this section.

	<list style="numbers">

	<t>Software based BFD: BFD process crash - Software entity handling BFD packets may crash unexpectedly. Time it takes for same, or possibly alternative software entity, to become functional is a time window where BFD packets will not be handled. If this time window is larger than negotiated failure detection time, sessions will be declared as failure even though monitored paths may still be valid. If there existed another software entity, running on same CPU or different CPU, validating same paths, false failure can be avoided as long as two software entities do not crash around same time.</t>
	<t>Software based BFD: CPU starvation - CPU starvation may cause BFD packets from being handled in timely manner. During this period, packets may not get transmitted or received packets may not get processed. If length of time CPU starvation affecting BFD software entity is larger than negotiated failure detection time, sessions will be declared as failure even though monitored paths may still be valid. If there existed another software entity, running on different CPU, validating same paths, false failure for this scenario can be avoided as long as two software entities do not become CPU starved around same time.</t>
	<t>Hardware based BFD: FPGA reset - In a scenario where hardware BFD and actual forwarding are performed on separate chips, it may be desirable to reset just FPGA which runs BFD. Planned such FPGA reset can be handled locally. Sessions can be migrated to another chip set, failure detection times can be extended during absence of local BFD functionality, combination of both or some other means. However, any solution will require additional proprietary logics to be implemented. Users, operating multiple products, may need to understand expected behavior of each. In addition, extending failure detection times mean that system can no longer detect true failure within desired failure detection times. A consistent solution which does not compromise configured failure detection time is desired.</t>
	<t>System using centralized BFD architecture: Route processor card fault - A product with redundant route processor card could implement a standby BFD entity to run on the other route processor card. Implementation may set BFD entity on standby route processor to be partially active or dormant until it is determined to be active. In both cases, data synchronization between the two entities is essential to ensure standby "take over" happens seamlessly. Additionally, "take over" detection and "take over" procedures themselves becoms essential, as any slowness in such may cause remote peers to take down sessions. If there existed two fully active BFD entities, one on active route processor and another on standby route processor, validating same paths, potentially complex "take over" logics can be avoided.</t>
	<t>System using distributed BFD architecture: Linecard fault - BFD may run on logical interfaces which are comprised of physical interfaces spanning multiple linecards. BFD may run on paths which are comprised of nexthops hosted on multiple linecards. BFD may run on logical interfaces or paths which nexthops change dynamically, jumping from one linecard to another. In all cases, a linecard hosting a certain BFD session may not be hosting actual outgoing interface corresponding to that BFD session at any given time. In such cases, failure of a linecard may not have any impact to the paths being monitored by some or all hosted BFD sessions. One implementation may attempt to solve this problem by trying to move BFD sessions to a linecard where nexthops reside. Unfortunately this only solves subset of the problem since it will not cover the scenario where there are valid multiple nexthops hosted on multiple linecards (ex: LAG, ECMP). Another implementation may attempt to solve this problem by running a standby BFD entity on another linecard. However, this solution has same issues as described in the centralized BFD architecture section. Again, if there existed two fully active BFD entities, running on different linecards, validating same paths, potentially complex synchronization, "take over" or "migration" logics can be avoided.</t>

	</list>

	Failure scenarios are not limited to the ones described above. In all cases,
	the reliability of BFD sessions will increase significantly if a second fully
	active BFD instance existed. It is possible to address some, or potentially all,
	failure scenarios locally. However, multiple proprietary solutions are likely
	required to cover wide problematic areas. Result may not be desirable from
	operator perspective, as expected behavior will deviate from a failure to
	failure, and from a device to device. Therefore, this specification defines
	a simple and consistent redundancy mechanism which can be used with
	wide range of local failure scenarios.</t>

    </section>

    <section title="Differentiating primary and shadow sessions">

	<t>For a single target monitored by BFD, a system needs to run
	two instances of the BFD sessions: a primary session and a shadow session.
	This requires BFD control packets to have an indication on which role they
	belong. In other words, every control packet needs to have an indication on
	whether it belongs to the primary or the shadow session.</t>

	<t>When looking at the BFD version 1 packet in <xref target="RFC5880" />,
	there are no unused bits left to store a shadow flag to distinguish the
	primary
	from the shadow session. One could take away a bit from e.g. the Diag, the
	Multiplier or the Length field, even claiming the least significant bit
	from one of
	the interval fields. But none of these proposals would be safe against
	interoperability problems with BFD speakers not supporting this draft.</t>

	<t>That leaves three possible options.
	
	<list style="letters">

	<t>Use of existing BFD version 1 control packet definition will
	indicate a primary BFD session.
	Shadow BFD sessions will use version 2 in the BFD packets.
	Besides usage of different version number, all operation will conform to
	the behaviors described in BFD RFCs. Shadow BFD sessions only
	handle version 2 BFD packets. Primary BFD sessions only handle
	version 1 BFD packets as specified in section 6.8.6 of
	<xref target="RFC5880" />.</t>

	<t>Define a new BFD packet header for version 2. This new
	version is to include bits to indicate the session type: primary session
	or shadow session. Shadow BFD sessions only handle version 2 BFD
	packets with shadow bits set. Primary BFD sessions handle version 1
	BFD packets or version 2 BFD packets with primary bits set.</t>

	<t>Use information outside the BFD packet. For IP/UDP
	encapsulated BFD packets this could be a UDP destination port different
	from the well-known ports defined in <xref target="RFC5881" /> and
	<xref target="RFC5883" />. For BFD over Pseudo Wires 
	<xref target="RFC5885" /> or BFD for MPLS-TP OAM
	<xref target="RFC6428" /> new type values could be used in the
	PW-ACH and G-ACH to differentiate shadow BFD packets from the
	primary BFD session packets.</t>

	</list>

	Option b redefines the BFD packet contents. Although it is a 
	clean solution, this approach can have a significant impact to existing BFD
	implementations. Introduction of BFD redundancy capability at
	significant costs is thought to be undesirable, thus this option is
	not recommended. However, when there is a discussion on defining new
	version of BFD packet contents, addition of redundancy capability would
	be recommended. Option c will create dependencies with current and
	future BFD RFCs since each will need to define a way shadow session
	can be specified. Therefore, this option is also not recommended. That
	leaves option a as the recommended choice.</t>

    </section>

    <section title="BFD version 2 packets">

	<t>BFD version 2 packets follow exactly the definition given in
	<xref target="RFC5880" /> and other BFD-related RFCs, with one
	difference that the version field contains the value "2".
	The packet format is the same as described in section 4.1 of
	<xref target="RFC5880" />.
	Implementations following this draft MUST be able to receive BFD
	packets with the version field values "1" and "2" and MUST drop
	BFD packets with any other version value.</t>

	<t>BFD packets with a version value of "1" are named "primary"
	packets while BFD packets with a version value of "2" are named
	"shadow" packets within this document. The primary session MUST only
	transmit and receive primary packets. The shadow session MUST only
	transmit and receive shadow packets.</t>

    </section>

    <section title="BFD discriminators">

	<t>As primary sessions and shadow sessions are operating independently,
	they have different my discriminator values. My discriminator values
	assigned to BFD sessions are unique per system, across the combined set
	of primary and shadow sessions. In other words, a system will have one
	discriminator pool to be used for both primary and shadow sessions, not a
	pool per session type.</t>

    </section>

    <section title="Using primary and shadow BFD sessions">

	<t>A shadow BFD session is associated to exactly one primary BFD
	session. The parameters used by shadow sessions SHOULD be the same as
	the parameters of associated primary session. Purpose for such is to ensure
	that two sessions operate using the same mode, interval and failure
	detection time.  This allows for the two sessions to behave as similar
	as possible to reduce the chance of them concluding deviating state in
	valid failure scenarios.</t>

	<t>When the BFD shadow capability is enabled to a target, two session
	instances to that target are created: primary and shadow. A logic SHOULD
	be applied to identify where in the system to host the two sessions.
	The logic should maximize the failure detection validity by minimizing the
	chances of both sessions being impacted by a single local failure. For example,
	if there are multiple CPU instances, there will be more benefits to run the two
	sessions on different CPU instances. Details of this logic, however, is outside
	the scope of this document.</t>

	<t>Both the primary and the shadow session are to operate as per
	specified in other BFD RFCs. A differentiator comes into play between
	state changes of the two sessions and the action taken when reachability
	of the BFD enabled target changes. This differentiator will be referred as the
	state consolidation module from here onward. The purpose of the state
	consolidation module is to consolidate the state of the primary and
	the shadow session, and to produce a final state to be used by the
	system to take action on. The logic of the state consolidation module
	is as follows:</t>

	<t>Final state is UP when the state of the primary session is UP or the
	state of the shadow session is UP.</t>

	<t>Final state is DOWN when both the state primary session is DOWN and
	the state of the shadow sessions is DOWN.</t>

    </section>

    <section title="LSP ping bootstrapped BFD sessions">

	<t>This specification aims to introduce BFD redundancy concept to various
	flavors of BFD while minimizing disruption to existing implementations. There
	is, however, one additional change required in order to support LSP ping
	bootstrapped BFD sessions described by <xref target="RFC5884" />.</t>

	<t>This specification defines a new optional TLV to be carried in LSP
	ping packet.</t>

	<figure align="left"><preamble></preamble><artwork align="left">
       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Discriminator                          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	</artwork></figure>

	<t>This TLV has a length of 4. The value contains the 4-byte local discriminator
	that the LSR, sending the LSP ping message, associates with the shadow BFD
	session. TBD: IANA to assign optional type.</t>

            <t>Upon reception of this optional TLV, LSP egress is to create a shadow
	session for specified FEC, if local constraints allow, with your discriminator
	set to value specified in the TLV. This TLV MAY be included in the LSP ping
	which carries BFD discriminator TLV of corresponding primary session, or this
	TLV MAY be carried in a separate LSP ping packet which does not carry BFD
	discriminator TLV of corresponding primary session. In both cases, egress
	LSR MUST associate both primary and shadow sessions in the state
	consolidation module.</t>

    </section>

    <section title="Scale aspect">

	<t>The BFD module becomes more resilient by enabling the
	shadow BFD capability.  However, when the shadow BFD capability
	is enabled on a system, the total number of BFD sessions hosted on a
	system will be increased by the number of shadow BFD sessions. For the
	same number of BFD monitored targets, more system resources will be
	used. Solving a scale issue is outside the scope of this document. However,
	below lists some techniques which can be considered:

	<list style="numbers">

	<t>Reduce the configured BFD intervals of some or all BFD sessions.</t>
	<t>Allow an implementation to run shadow sessions at a slower rate.</t>

	</list>
	</t>
	
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
      <t>IANA to assign optional type for new LSP ping TLV.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>This document does not introduce any additional security issues
	  and the security mechanisms defined in <xref target="RFC5880" />
	  apply in this document.</t>
    </section>

    <section title="Acknowledgements">
	<t>Authors would like to thank Aswatnarayan Raghuram from AT&amp;T for
	providing requirements and helpful comments.</t>
	<t>Authors would like to thank Gregory Mirsky and Alexander Vainshtein for
	providing insightful comments.</t>
	<t>Authors would like to thank Srihari Raghavan and Mallik Mudigonda
	from Cisco Systems for providing valuable comments regarding LSP ping
	bootstrapped sessions.</t>
<!-- TBD: should poll Gregory Mirsky and Alexander Vainshtein if they want to be added here -->
    </section>

  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <references title="Normative References">
	  <?rfc include="reference.RFC.2119"?>
	  <?rfc include="reference.RFC.5880"?>
	  <?rfc include="reference.RFC.5881"?>
	  <?rfc include="reference.RFC.5883"?>
	  <?rfc include="reference.RFC.5884"?>
	  <?rfc include="reference.RFC.5885"?>
	  <?rfc include="reference.RFC.6428"?>
    </references>
    
    <!-- Change Log
v00 2012-11-27	Nobo - Initial version
v01 2013-04-29	Nobo - Clarified use cases, and added procedures for LSP
			ping bootstrapped sessions.
    -->
  </back>
</rfc>
