<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="exp" docName="draft-chen-rtgwg-srv6-midpoint-protection-09"
     ipr="trust200902">
  <front>
    <title abbrev="SRv6 Midpoint Protection">SRv6 Midpoint Protection</title>

    <author fullname="Huanan Chen" initials="H." surname="Chen">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street>109, West Zhongshan Road, Tianhe District</street>

          <city>Guangzhou</city>

          <code>510000</code>

          <country>China</country>
        </postal>

        <email>chenhuan6@chinatelecom.cn</email>
      </address>
    </author>

    <author fullname="Zhibo Hu" initials="Z." surname="Hu">
      <organization>Huawei Technologies</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>huzhibo@huawei.com</email>
      </address>
    </author>

    <author fullname="Huaimo Chen" initials="H." surname="Chen">
      <organization>Futurewei</organization>

      <address>
        <postal>
          <street/>

          <city>Boston, MA</city>

          <region/>

          <code/>

          <country>USA</country>
        </postal>

        <email>Huaimo.chen@futurewei.com</email>
      </address>
    </author>

    <author fullname="Xuesong Geng" initials="X." surname="Geng">
      <organization>Huawei Technologies</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>gengxuesong@huawei.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Yisong Liu" initials="Y." surname="Liu">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>liuyisong@chinamobile.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Gyan S. Mishra" initials="G" surname="Mishra">
      <organization>Verizon Inc.</organization>

      <address>
        <postal>
          <street>13101 Columbia Pike</street>

          <city>Silver Spring</city>

          <code>MD 20904</code>

          <country>USA</country>
        </postal>

        <phone>301 502-1347</phone>

        <email>gyan.s.mishra@verizon.com</email>
      </address>
    </author>

    <date year="2022"/>

    <abstract>
      <t>The current local repair mechanism, e.g., TI-LFA, allows local repair
      actions on the direct neighbors of the failed node or link to
      temporarily route traffic to the destination. This mechanism could not
      work properly when the failure happens in the destination point. In SRv6
      TE, the IPv6 destination address in the outer IPv6 header could be the
      segment endpoint of the TE path rather than the destination of the TE
      path. When the SRv6 endpoint fails, local repair couldn't work on the
      direct neighbor of the failed endpoint either. This document defines
      midpoint protection for SRv6 TE path, which enables other nodes on the
      network to perform endpoint behaviors instead of the faulty node, update
      the IPv6 destination address to the other endpoint, and choose the next
      hop based on the new destination address.</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"/>
      <xref target="RFC8174"/> when, and only when, they appear in all
      capitals, as shown here.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>The current mechanism, e.g., TI-LFA (<xref
      target="I-D.ietf-rtgwg-segment-routing-ti-lfa"/>), allows local repair
      actions on the direct neighbors of the failed node or link to
      temporarily route traffic to the destination. This mechanism could not
      work properly when the failure happens in the destination point. In SRv6
      TE, the IPv6 destination address in the outer IPv6 header could be the
      segment endpoint of the TE path rather than the destination of the TE
      path (<xref target="RFC8986"/>). When the endpoint fails, local repair
      couldn't work on the direct neighbor of the failed endpoint either. This
      document defines midpoint protection for SRv6 TE path, which enables
      other nodes on the network to perform endpoint behaviors instead of the
      faulty node, update the IPv6 destination address to the other endpoint,
      and choose the next hop based on the new destination address.</t>
    </section>

    <section title="SRv6 Midpoint Protection Mechanism">
      <!-- 
       Neighbor of Endpoint (means Repair Node)
       (Neighbor can be an endpoint or non endpoint)

       Non-Neighbor of Endpoint (Transit Node?) 
       (Non-Neighbor can be an endpoint or non endpoint)
       If no route to Endpoint, then DA = SRH[-SL]
-->

      <t>When an endpoint node fails, the packet needs to bypass the failed
      endpoint node and be forwarded to the next endpoint node of the failed
      endpoint. Only endpoint node can porcess SRH, Therefore, only endpoint
      nodes can perform midpoint protection. There are two stages or time
      periods after an endpoint node fails. The first is the time period from
      the failure until the IGP converges on the failure. The second is the
      time period after the IGP converges on the failure.</t>

      <t>During the first time period, the packet will be sent to the direct
      neighbor of the failed endpoint node. After detecting the failure of its
      interface to the failed endpoint node, the neighbor forwards the packets
      around the failed endpoint node. It changes the IPv6 destination address
      with the IPv6 address of the next endpoint node (or the last or other
      reasonable endpoint node) which could avoid going through the failed
      endpoint.</t>

      <t>During the second time period. There is no route to the failed
      endpoint node after the IGP converges. When a previous hop node of the
      failed endpoint node finds out that there is no route to the IPv6
      destination address (of the failed endpoint node), it changes the IPv6
      destination address with the IPv6 address of the next endpoint node.
      Note that the previous hop node may not be the direct neighbor of the
      failed endpoint node.</t>

      <!--
On the Repair Node (i.e., the previous hop of the failed
      endpoint node), it performs the proxy forwarding as follows after
      detecting the failure of its interface to the endpoint node.</t>

      <t>Case 1: Route to the failed endpoint could be found in its FIB:
        <list style="symbols">
          <t>If the Repair Node is not directly connected to the failed
          endpoint, the normal Ti-LFA is executed;</t>

          <t>If the Repair Node is directly connected to the failed endpoint,
          the Repair Node forwards the packets through a bypass to avoid 
          the failed
          endpoint. It replaces the IPv6 destination address with the IPv6
          address of the next, the last or other reasonable endpoint nodes,
          which could avoid going through the failed endpoint.</t>
        </list>
      </t>

     <t>Case 2: Route to the failed endpoint could not be found in its FIB:
       <list style="symbols">
          <t>Repair Node forwards the packets through a bypass of the failed
          endpoint to the next, the last or other reasonable endpoint node
          directly. There is no need to check whether the failed endpoint
          node is directly connected to the Repair Node or not.</t>
       </list>
     </t>
-->
    </section>

    <section title="SRv6 Midpoint Protection Example">
      <t>The topology in <xref target="ex-net"/> illustrates an example of
      network topology with SRv6 enabled on each node.</t>

      <t><figure anchor="ex-net"
          title="An example of network for midpoint protection">
          <artwork align="center"><![CDATA[
                   +-----+           +-----+
                   |  N5 |-----------|  N6 |--------------+
                   +-----+           +-----+              |
                      |                 |                 |  
                      |                 |                 |
                      |                 |                 |
 +-----+           +-----+           +-----+           +-----+
 |  N1 |-----------|  N2 |-----------|  N3 |-----------|  N4 |
 +-----+           +-----+           +-----+           +-----+
                 
]]></artwork>
        </figure></t>

      <t>In this document, an end SID at node n with locator block B is
      represented as B:n. An end.x SID at node n towards node k with locator
      block B is represented as B:n:k. A SID list is represented as &lt;S1,
      S2, S3&gt; where S1 is the first SID to visit, S2 is the second SID to
      visit and S3 is the last SID to visit along the SRv6 TE path.</t>

      <t>In the reference topology, suppose that Node N1 is an ingress node of
      SRv6 TE path going through N3 and N4. Node N1 steers a packet into a
      segment list &lt; B:2, B:3, B:4&gt;.</t>

      <t>When node N3 fails, the packet needs to bypass the failed endpoint
      node and be forwarded to the next endpoint node after the failed
      endpoint in the TE path. When outbound interface failure happens in the
      Repair Node (which is not limited to the previous hop node of the failed
      endpoint node), it performs the proxy forwarding as follows:</t>

      <t>During the first time period (i.e., before the IGP converges), node
      N2 (direct neighbor of N3) as a Repair Node forwards the packets around
      the failed endpoint N3 after detecting the failure of the outbound
      interface to the endpoint B:3. It changes the IPv6 destination address
      with the next sid B:4. N2 detects the failure of outbound interface to
      B:4 in the current route, it could use the normal Ti-LFA repair path to
      forward the packet, because it is not directly connected to the node N4.
      N2 encapsulates the packet with the segment list &lt; B:5, B:6&gt; as a
      repair path.</t>

      <t>During the second time period (i.e., after the IGP converges), node
      N2 does not have any route to the failed endpoint N3 in its FIB. Node
      N2, as a Repair Node, forwards the packets around the failed endpoint N3
      to the next endpoint node (e.g., N4) directly. There is no need to check
      whether the failed endpoint node is directly connected to N2. N2 changes
      the IPv6 destination address with the next sid B:4. Since IGP has
      completed convergence, it forwards packets directly based on the IGP SPF
      path.</t>
    </section>

    <section title="SRv6 Midpoint Protection Behavior">
      <t>A node N protecting the failure of an endpoint node on a SRv6 path
      may be one of the following types: <list style="symbols">
          <t>a transit node: The transit node cannot process SRH. Therefore,
          only Ti-LFA can be executed on the transit node, but not midpoint
          protection.</t>

          <t>an endpoint node: the destination address (DA) of the packet
          received by N is a N's local END SID.</t>

          <t>an endpoint x node (i.e., an endpoint with cross-connect node):
          the destination address (DA) of the packet received by N is a N's
          local End.X SID with an array of layer 3 adjacencies.</t>
        </list> This section describes the behavior of each of these nodes as
      a repair node for the two time periods after the endpoint node
      fails.</t>

      <section title="Endpoint Node as Repair Node">
        <t>When the Repair Node is an endpoint node, it provides fast
        protections for the failure through executing the following procedure
        after looking up the FIB for the updated DA.</t>

        <figure>
          <artwork><![CDATA[
     IF the primary outbound interface used to forward the packet failed
       IF NH = SRH && SL != 0 and
          the failed endpoint is directly connected to Repair Node THEN
         SL decreases; update the IPv6 DA with SRH[SL];
         FIB lookup on the updated DA;
         forward the packet according to the matched entry;
       ELSE
         forward the packet according to the backup nexthop;
     ELSE IF there is no FIB entry for forwarding the packet THEN
       IF NH = SRH && SL != 0 THEN
         SL decreases; update the IPv6 DA with SRH[SL];
         FIB lookup on the updated DA;
         forward the packet according to the matched entry;
       ELSE
         drop the packet;
     ELSE
       forward accordingly to the matched entry;]]></artwork>
        </figure>

        <t/>
      </section>

      <section title="Endpoint x Node as Repair Node">
        <t>When the Repair Node is an endpoint x node, it provides fast
        protections for the failure through executing the following procedure
        after updating DA.</t>

        <figure>
          <artwork><![CDATA[
     IF the layer-3 adjacency interface is down THEN
       FIB lookup on the updated DA;
       IF the primary interface used to forward the packet failed THEN
         IF NH = SRH && SL != 0 and
            the failed endpoint directly connected to Repair Node THEN
           SL decreases; update the IPv6 DA with SRH[SL];
           FIB lookup on the updated DA;
           forward the packet according to the matched entry;
         ELSE
           forward the packet according to the backup nexthop;
       ELSE IF there is no FIB entry for forwarding the packet THEN
         IF NH = SRH && SL != 0 THEN
           SL decreases; update the IPv6 DA with SRH[SL];
           FIB lookup on the updated DA;
           forward the packet according to the matched entry;
         ELSE
           drop the packet;
     ELSE
       forward accordingly to the matched entry;]]></artwork>
        </figure>

        <t/>
      </section>
    </section>

    <section title="Determining whether the Endpoint could Be Bypassed">
      <t>SRv6 Midpoint Protection provides a mechanism to bypass a failed
      endpoint. But in some scenarios, some important functions may be
      implemented in the bypassed failed endpoints that should not be
      bypassed, such as firewall functionality or In-situ Flow Information
      Telemetry of a specified path. Therefore, a mechanism is needed to
      indicate whether an endpoint can be bypassed or not. <xref
      target="I-D.li-rtgwg-enhanced-ti-lfa"/> provides method to determine
      whether enbale SRv6 midpoint protection or not by defining a "no bypass"
      flag for the SIDs in IGP.</t>
    </section>

    <section title="Security Considerations">
      <t>This section reviews security considerations related to SRv6 Midpoint
      protection processing discussed in this document.To ensure that the
      Repair node does not modify the SRH header Encapsulated by nodes outside
      the SRv6 Domain.Only the segment within the SRH is same domain as the
      repair node. So it is necessary to check the skipped segment have same
      block as repair node.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document makes no request of IANA.</t>

      <t>Note to RFC Editor: this section may be removed on publication as an
      RFC.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors would like to thank Bruno Decraene, Jeff Tantsura, 
      Ketan Talaulikar and Parag Kaneriya
      for their comments to this work.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.I-D.ietf-lsr-isis-srv6-extensions"?>

      <?rfc include="reference.I-D.ietf-lsr-ospfv3-srv6-extensions"?>

      <?rfc include="reference.RFC.8986"?>

      <?rfc include="reference.RFC.2119"?>

      <?rfc include="reference.RFC.7356"?>

      <?rfc include="reference.RFC.8174"?>

      <?rfc ?>
    </references>

    <references title="Informative References">
      <?rfc include="reference.I-D.hu-spring-segment-routing-proxy-forwarding"?>

      <?rfc include="reference.I-D.ietf-rtgwg-segment-routing-ti-lfa"?>

      <?rfc include="reference.I-D.ietf-spring-segment-routing-policy"?>

      <?rfc include="reference.I-D.sivabalan-pce-binding-label-sid"?>

      <?rfc include="reference.RFC.5462"?>

      <?rfc include="reference.I-D.li-rtgwg-enhanced-ti-lfa"?>
    </references>
  </back>
</rfc>
