<?xml version="1.0" encoding="utf-8"?>
<!-- 
     draft-rfcxml-general-template-standard-00
  
     This template includes examples of the most commonly used features of RFCXML with comments 
     explaining how to customise them. This template can be quickly turned into an I-D by editing 
     the examples provided. Look for [REPLACE], [REPLACE/DELETE], [CHECK] and edit accordingly.
     Note - 'DELETE' means delete the element or attribute, not just the contents.
     
     Documentation is at https://authors.ietf.org/en/templates-and-schemas
-->
<?xml-model href="rfc7991bis.rnc"?>  
<!-- Required for schema validation and schema-aware editing -->
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->


<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<!-- If further character entities are required then they should be added to the DOCTYPE above.
     Use of an external entity file is not recommended. -->

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="draft-li-idr-flowspec-redirect-direct-ip-00"
  ipr="trust200902"
  obsoletes=""
  sortRefs="true"
  consensus="true"
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">
<!-- [REPLACE] 
       * docName with name of your draft
     [CHECK] 
       * category should be one of std, bcp, info, exp, historic
       * ipr should be one of trust200902, noModificationTrust200902, noDerivativesTrust200902, pre5378Trust200902
       * updates can be an RFC number as NNNN
       * obsoletes can be an RFC number as NNNN 
-->

  <front>
    <title abbrev="Flow Specification Redirect to Direct IP">BGP Flow Specification Redirect to Directly Connected IP Address</title>
    <!--  [REPLACE/DELETE] abbrev. The abbreviated title is required if the full title is longer than 39 characters -->

    <seriesInfo name="Internet-Draft" value="draft-li-idr-flowspec-redirect-direct-ip-00"/>
   
    <author fullname="Zhenqiang Li" initials="Z" role="editor" surname="Li">
      <!-- [CHECK]
             * initials should not include an initial for the surname
             * role="editor" is optional -->
    <!-- Can have more than one author -->
      
    <!-- all of the following elements are optional -->
      <organization>China Mobile</organization>
      <address>
        <postal>
          <!-- Reorder these if your country does things differently -->
          <street>29 Finance Avenue, Xicheng District</street>
          <city>Beijing</city>
          <country>CN</country>
          <!-- Uses two letter country code -->
        </postal>        
        <email>lizhenqiang@chinamobile.com</email>  
        <!-- Can have more than one <email> element -->
      </address>
    </author>
	<author fullname="Zhiwei An" initials="Z" role="editor" surname="An">
      <!-- [CHECK]
             * initials should not include an initial for the surname
             * role="editor" is optional -->
    <!-- Can have more than one author -->
      
    <!-- all of the following elements are optional -->
      <organization>China Mobile</organization>
      <address>
        <postal>
          <!-- Reorder these if your country does things differently -->
          <street>10 Manbai Road, Changping District</street>
          <city>BeiJing</city>
          <country>CN</country>
          <!-- Uses two letter country code -->
        </postal>
        <email>anzhiwei@chinamobile.com</email>  
        <!-- Can have more than one <email> element -->
        
      </address>
    </author>
   
    <date year="2026"/>
    <!-- On draft subbmission:
         * If only the current year is specified, the current day and month will be used.
         * If the month and year are both specified and are the current ones, the current day will
           be used
         * If the year is not the current one, it is necessary to specify at least a month and day="1" will be used.
    -->

    <area>Routing</area>
    <workgroup>Inter-Domain Routing</workgroup>
    <!-- "Internet Engineering Task Force" 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 RFC Series. -->

    <keyword>BGP</keyword>
    <keyword>Flow Specification</keyword>
    <keyword>Redirect</keyword>
	<keyword>Direct IP</keyword>
    <!-- [REPLACE/DELETE]. Multiple allowed.  Keywords are incorporated into HTML output files for 
         use by search engines. -->

    <abstract>
      <t>A bit, D bit, is defined in Flow-spec Redirect-to-IPv4 Extended Community and Flow-spec Redirect-to-IPv6 Extended Community. This bit is used by BGP Flow Specification to indicate that the associated Flow Specification policy be set to an invalid state when the directly connected link associated with the redirect target address becomes unavailable.</t>
    </abstract>
 
  </front>

  <middle>
    
    <section anchor="intro">
      <name>Introduction</name>
      <t>BGP Flow Specification, as specified in <xref target="RFC8955"/> and <xref target="RFC8956"/>, is widely used for traffic steering, traffic rate limiting, and other traffic-control purposes. <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> defines the BGP Flow Specification Redirect-to-IP action, which enables Flow Specification to redirect traffic to an IP address.</t>
      <t><xref target="I-D.ietf-idr-flowspec-redirect-ip"/> specifies that the BGP speaker is expected to do a longest-prefix-match lookup of the "target address" in the database it uses to resolve next-hop addresses and then forward the redirected packets based on the resulting route, referred to as the "target route". In some cases, this mechanism can prevent a network element from promptly setting the corresponding BGP Flow Specification policy to an invalid state. This not only wastes resources on the network element and in the network, but may also cause a traffic forwarding loop, preventing traffic from reaching its destination and causing service interruption. The specific scenarios are described in the next section.</t>
      <t>This document extends the Flow-spec Redirect-to-IPv4 Extended Community  and Flow-spec Redirect-to-IPv6 Extended Community defined in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> by defining a new directly connected link indication bit, called the D bit. An SDN controller sets the D bit to 1 when it sends a BGP Flow Specification policy that redirects traffic to the peer interface address of a directly connected link and requires the receiving network element to set the corresponding policy to an invalid state if that link becomes unavailable.</t>
      <t>How a network element detects the failure of a directly connected link is implementation specific and is not specified in this document. Possible mechanisms include, but are not limited to, Bidirectional Forwarding Detection (BFD) <xref target="RFC5880"/>, ARP-based neighbor reachability checks <xref target="RFC826"/>, and Link Aggregation Control Protocol (LACP) state monitoring <xref target="IEEE8021AX"/>.</t>

      <section>
        <name>Requirements Language</name>
        <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 BCP 14 <xref target="RFC2119"/>
        <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
        </t>
      </section>
    </section>
 
    
    <section>
      <name>Scenarios to Be Addressed</name>
      <t>The figures in this section use solid lines ("---") for physical links, asterisks ("***") for the logical BGP connection between the SDN controller and Router 1, and lines with arrowheads ("===>") for the direction of the traffic being discussed. The number associated with each physical link is both its IGP metric and, except for Link A, its delay in milliseconds. Link A has an IGP metric of 100 and a delay of 1 millisecond.</t>
      <section>
        <name>Scenario 1</name>
        <t>As shown in <xref target="fig-scenario-1"/>, Network 2 uses the prefix 198.51.100.0/24. Interface Address 1 and Interface Address 2 are 192.0.2.1 and 192.0.2.2, respectively, on Link A. The numbers shown on the links are their IGP metrics and, except for Link A, also represent their delays in milliseconds. Link A has an IGP metric of 100 and a delay of 1 millisecond.</t>
        <t>Under normal destination-based forwarding, the path from Router 1 to Router 4 through Router 3 has a total IGP metric of 20, while the path through Router 2 has a total IGP metric of 30. Therefore, traffic from Network 1 to Network 2 is forwarded by Router 1 over Link B to Router 3, by Router 3 over Link C to Router 4, and then by Router 4 to Network 2.</t>
        <t>For traffic that requires a lower-delay path, the SDN controller generates a BGP Flow Specification route that matches packets with a destination in 198.51.100.0/24 and carries a Redirect-to-IPv4 action with the target address 192.0.2.2. The SDN controller sends this route to Router 1. After installing the corresponding policy, Router 1 redirects matching traffic over Link A to Router 4, which then forwards the traffic to Network 2.</t>
        <figure anchor="fig-scenario-1">
          <name>Redirected Traffic after Failure of the Directly Connected Link</name>
          <artwork ><![CDATA[
              +----------------+
              | SDN Controller |
              +----------------+
                       *
                       * BGP Flow Specification
                       *
                       *
                       *      +----------+
                       v      | Router 2 |
                              +----------+
                           15/            \15
                      Link D/              \Link E
                           /                \
   +----+         +----------+   X     +----------+         +----+
   | N1 |---------| Router 1 |---------| Router 4 |---------| N2 |
   +----+         +----------+ Link A  +----------+         +----+
                          \    metric 100    /
                     Link B\   (FAILED)     /Link C
                          10\              /10
                             \            /
                              +----------+
                              | Router 3 |
                              +----------+

     After Link A fails while the Flow Specification policy remains active:
       R1 ===> R3 ===> R4
          ]]></artwork>
        </figure>
        <t>While Link A is available, Router 1 has a connected route to the redirect target address 192.0.2.2 and sends the matching traffic directly to Router 4 over Link A. The redirected traffic therefore uses the 1-millisecond link instead of the normal 20-millisecond path through Links B and C.</t>
        <t>When Link A fails, Router 1 removes the connected route to 192.0.2.2. However, the redirect target address may remain reachable through another route, such as an aggregate route or a default route whose forwarding path uses Links B and C. Under the procedures in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/>, Router 1 therefore retains the BGP Flow Specification policy and redirects the matching traffic over Link B to Router 3. Router 3 then forwards the traffic over Link C to Router 4, which forwards it to Network 2.</t>
        <t>Retaining the BGP Flow Specification policy after Link A fails is unnecessary in this scenario. Without the policy, Router 1 would use the same destination-based path through Router 3 and Router 4. Moreover, the redirected traffic no longer uses the intended low-delay Link A and may no longer satisfy its delay requirement.</t>
      
      </section>
      <section>
        <name>Scenario 2</name>
        <t>As shown in <xref target="fig-scenario-2"/>, Scenario 2 uses the same topology, addressing, metrics, and BGP Flow Specification route installed on Router 1 as Scenario 1. In this scenario, Link A is unavailable, but Link C remains available. Therefore, if Router 3 used only normal destination-based forwarding, traffic destined to Network 2 could be forwarded from Router 3 to Router 4 over Link C.</t>
        <t>However, Router 3 has already installed another BGP Flow Specification policy. This policy matches traffic destined to 198.51.100.0/24 and redirects the matching traffic to Router 1 over Link B. This Flow Specification policy is the reason Router 3 sends the traffic back to Router 1; the loop is not caused by a failure of Link C.</t>
        <figure anchor="fig-scenario-2">
          <name>Forwarding Loop over Link B</name>
          <artwork ><![CDATA[
              +----------------+
              | SDN Controller |
              +----------------+
                       *
                       * BGP Flow Specification
                       *
                       *
                       *      +----------+
                       *      | Router 2 |
                       v      +----------+
                           15/            \15
                      Link D/              \Link E
                           /                \
   +----+         +----------+   X     +----------+         +----+
   | N1 |---------| Router 1 |---------| Router 4 |---------| N2 |
   +----+         +----------+ Link A  +----------+         +----+
                           \  metric 100    /
                      Link B\  (FAILED)    / Link C
                           10\            /10
                              \          /
                               +----------+
                               | Router 3 |
                               +----------+

   Forwarding loop over Link B:
     R1 === redirect-target lookup ===> R3
     R1 <== Flow-spec redirect on R3 ==== R3

   Router 3 Flow-spec policy:
     match destination 198.51.100.0/24
     redirect to Router 1
          ]]></artwork>
        </figure>
        <t>While Link A is available, Router 1 has a connected route to the redirect target address 192.0.2.2 and redirects matching traffic directly to Router 4 over Link A.</t>
        <t>When Link A fails, Router 1 removes the connected route to 192.0.2.2. However, the redirect target address may still be resolved through another route, such as an aggregate route or a default route whose forwarding path uses Link B. Router 1 therefore retains the BGP Flow Specification policy and sends matching traffic destined to 198.51.100.0/24 over Link B to Router 3.</t>
        <t>After receiving the traffic, Router 3 matches its own BGP Flow Specification policy for destination prefix 198.51.100.0/24. Although Link C remains available, the Flow Specification policy on Router 3 redirects the traffic back to Router 1 over Link B instead of allowing normal destination-based forwarding toward Router 4 over Link C.</t>
        <t>When Router 1 receives the traffic again, it continues to match the same BGP Flow Specification policy and redirects the traffic toward the target address through Router 3. The traffic consequently loops between Router 1 and Router 3 over Link B until its TTL expires. The loop consumes forwarding resources, and the traffic is eventually discarded without reaching Network 2, resulting in service interruption.</t>
      </section>
    </section>


    <section anchor="d-bit">
      <name>D Bit for Redirect-to-IP Extended Communities</name>
      <t>This document extends the Redirect-to-IP Extended Communities defined in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> by defining a new directly connected link indication bit, called the D bit. The D bit is used to instruct a receiving network element to set the corresponding BGP Flow Specification policy that redirects traffic to an IP address to an invalid state when the directly connected link associated with that address becomes unavailable.</t>
      <t>As shown in <xref target="fig-d-bit"/>,  bit 14 in the Local Administrator field is solicited to be defined as the "D" (Direct) bit, which is applicable for both Flow-spec Redirect-to-IPv4 and Flow-spec Redirect-to-IPv6. The D bit is requested to be assigned by IANA.</t>
      <figure anchor="fig-d-bit" align="center">
        <name>Format of the D Bit in the Local Administrator Field</name>
        <artwork align="center"><![CDATA[
       0                   1
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |          Reserved         |D|C|
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>
      <t>Where:</t>
      <t>D bit: The directly connected link indication bit. When a BGP Flow Specification policy is configured to redirect traffic to an IP address and the D bit is set to 1, the receiving network element sets the corresponding BGP Flow Specification policy to an invalid state if the directly connected link associated with that IP address becomes unavailable. When the directly connected link recovers, the network element sets the policy back to a valid state.</t>
      <t>When the D bit is set to 0, the processing behavior of the Redirect-to-IPv4 and Redirect-to-IPv6 action is unchanged. If the directly connected link associated with the redirect target address becomes unavailable but the network element still has a route to that IP address, the corresponding BGP Flow Specification policy is not set to an invalid state and remains valid.</t>
      
    </section>


    <section anchor="behavior">
      <name>Behavior</name>
      <t>When an SDN controller intends matching traffic to be redirected to the peer interface address of a directly connected link, it originates a BGP Flow Specification route with the Redirect-to-IP action defined in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/>. The SDN controller sets the D bit when the redirect action is required to remain valid only while that directly connected link is available.</t>
      <t>After receiving the BGP Flow Specification route and completing the applicable validation procedures, a network element that supports the D bit associates the redirect target address with the directly connected link used to reach that address. The method used to determine the operational state of the link is implementation specific, as discussed in <xref target="intro"/>.</t>
      <t>When the D bit is set and the associated directly connected link becomes unavailable, the network element sets the corresponding BGP Flow Specification policy to an invalid state and stops applying its Redirect-to-IP action. The network element does not keep that policy active by resolving the redirect target through a less-specific aggregate route or a default route. Matching packets are then processed by any other applicable policy or, if no such policy applies, by normal destination-based forwarding. This behavior prevents the unintended detour described in Scenario 1 and the forwarding loop described in Scenario 2.</t>
      <t>When the associated directly connected link becomes available again, the network element re-evaluates the policy. If the redirect target is again reachable over that directly connected link and the BGP Flow Specification route remains otherwise valid, the network element sets the policy back to a valid state and resumes applying the Redirect-to-IP action. No new advertisement from the SDN controller is required solely because the link state changes.</t>
      <t>When the D bit is not set, the procedures specified in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> are unchanged.</t>
    </section>


    
    <section anchor="IANA">
    <!-- All drafts are required to have an IANA considerations section. See RFC 8126 for a guide.-->
      <name>IANA Considerations</name>
      <t>Two-octet registry called "Flow-spec Redirect-to-IPv4 Flags" is solicited to be created. This registry is located in the "Border Gateway Protocol (BGP) Extended Communities" registry <xref target="IANA-BGP-EXT-COMM"/>. New registrations will be made through the "RFC Required" procedure defined in <xref target="RFC8126"/>.  Initial registrations are as follows:</t>
      <table align="center">
		<name>Initial Values of the "Flow-spec Redirect-to-IPv4 Flags" Registry</name>
        <thead>
        <!-- [REPLACE/DELETE] a table header is optional -->
          <tr>
						<th align="left" colspan="1" rowspan="1">Flag Position</th>
            <th align="left" colspan="1" rowspan="1">Name</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
		  </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">0-13</td>
            <td align="left" colspan="1" rowspan="1">Unassigned</td>
            <td align="left" colspan="1" rowspan="1"></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">14</td>
            <td align="left" colspan="1" rowspan="1">Direct Flag (D)</td>
            <td align="left" colspan="1" rowspan="1">This document</td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">15</td>
            <td align="left" colspan="1" rowspan="1"> Copy Flag (C)</td>
            <td align="left" colspan="1" rowspan="1"><xref target="I-D.ietf-idr-flowspec-redirect-ip"/></td>
          </tr>
        </tbody>
      </table>
   
   <t>Two-octet registry called "Flow-spec Redirect-to-IPv6 Flags" is solicited to be created. This registry is located in the "Border Gateway Protocol (BGP) Extended Communities" registry <xref target="IANA-BGP-EXT-COMM"/>. New registrations will be made through the "RFC Required" procedure defined in <xref target="RFC8126"/>.  Initial registrations are as follows:</t>
      <table align="center">
		<name>Initial Values of the "Flow-spec Redirect-to-IPv6 Flags" Registry</name>
        <thead>
        <!-- [REPLACE/DELETE] a table header is optional -->
          <tr>
			<th align="left" colspan="1" rowspan="1">Flag Position</th>
            <th align="left" colspan="1" rowspan="1">Name</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
		  </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">0-13</td>
            <td align="left" colspan="1" rowspan="1">Unassigned</td>
            <td align="left" colspan="1" rowspan="1"></td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">14</td>
            <td align="left" colspan="1" rowspan="1">Direct Flag (D)</td>
            <td align="left" colspan="1" rowspan="1">This document</td>
          </tr>
          <tr>
            <td align="left" colspan="1" rowspan="1">15</td>
            <td align="left" colspan="1" rowspan="1"> Copy Flag (C)</td>
            <td align="left" colspan="1" rowspan="1"><xref target="I-D.ietf-idr-flowspec-redirect-ip"/></td>
          </tr>
        </tbody>
      </table>
    </section>
    
    <section anchor="Security">
      <!-- All drafts are required to have a security considerations section. See RFC 3552 for a guide. -->
      <name>Security Considerations</name>
      <t>The security considerations discussed in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> also apply to this document.</t>
    </section>
    
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>		
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-flowspec-redirect-ip.xml" />
      </references>
	  
	  <references>
        <name>Informative References</name>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.826.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5880.xml"/>
		<reference anchor="IEEE8021AX" target="https://standards.ieee.org/standard/802_1AX-2020.html">
		  <front>
		    <title>IEEE Standard for Local and Metropolitan Area Networks--Link Aggregation</title>
		    <author>
		      <organization>IEEE</organization>
		    </author>
		    <date month="May" year="2020"/>
		  </front>
		  <seriesInfo name="IEEE Std" value="802.1AX-2020"/>
		</reference>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8955.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8956.xml"/>
        <reference anchor="IANA-BGP-EXT-COMM" target="https://www.iana.org/assignments/bgp-extended-communities" quoteTitle="true" derivedAnchor="IANA-BGP-EXT-COMM">
<front>
<title>Border Gateway Protocol (BGP) Extended Communities</title>
<author>
<organization showOnFrontPage="true">IANA</organization>
</author>
</front>
</reference>
      </references>

    </references>
 
 </back>
</rfc>

