<?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-sr-policy-01"
  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="Flowspec Redirects to SR Policy">BGP Flowspec Redirects to SR Policy</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-sr-policy-01"/> 
   
    <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="Song Liu" initials="S" role="editor" surname="Liu">
      <!-- [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>liusongwl@chinamobile.com</email>  
        <!-- Can have more than one <email> element -->
        
      </address>
    </author>
   
    <date year="2025"/>
    <!-- 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 Flowspec</keyword>
	<keyword>SR Policy</keyword>
    <!-- [REPLACE/DELETE]. Multiple allowed.  Keywords are incorporated into HTML output files for 
         use by search engines. -->

    <abstract>
      <t>Flowspec, an extension to BGP, enables the dissemination of traffic flow specification 
	  rules and can be used to steer traffic into SR Policy. However, existing approaches using Flowspec to direct traffic into a SR Policy have certain drawbacks (for details, refer to section 1).</t>
	  
	  <t>This document difines two new standard actions for the BGP Flowspec V2 protocol (FSv2) <xref target="I-D.ietf-idr-flowspec-v2"/>: 
	  Redirect to SR Policy Action and SRv6 SID Action. The former allows traffic to be directed to a designated SR Policy, 
	  while the latter allows for the encapsulation of an additional SRv6 SID as required during redirection.</t>
	  
	  <t>The Redirect to SR Policy Action can be used independently or in conjunction with the SRv6 SID Action, depending on the application scenario. 
	  Additionally, the SRv6 SID Action can be used together with other actions defined in FSv2, such as Redirect to IPv6.</t>
	  
    </abstract>
 
  </front>

  <middle>
    
    <section>
      <name>Introduction</name>
      <t><xref target="RFC8955"/> and <xref target="RFC8956"/> define the BGP
      Flow Specification (Flowspec), which allows the conveyance of flow specifications and associated traffic filtering actions (such as rate-
      limiting, redirect, remark, etc.). BGP flow specifications are encoded within the MP_REACH_NLRI and MP_UNREACH_NLRI attributes <xref target="RFC4760"/>. 
	  Traffic filtering actions are encoded in the Extended Community attribute <xref target="RFC4360"/>. 
	  The BGP Flow Specification function enables BGP Flow Specification routes carrying traffic policies to be transmitted to BGP Flow Specification peers for traffic steering.</t>
	  
	  <t>SR Policy (including SR-MPLS and SRv6 Policy) <xref target="RFC9256"/>
      is a tunneling technology based on SR-MPLS or SRv6. A SR Policy consists of a
      set of candidate paths, each of which is composed of one or more segment lists, i.e., 
      segment ID (SID) lists. Each SID list identifies an end-to-end path from
      the source node to the destination node, instructing a network device to
      forward traffic along this path rather than the shortest path computed
      by an IGP. The header of a packet steered into a SR Policy is
      augmented with an ordered list of segments associated with that SR
      Policy, enabling other network devices traversed by the packet to execute the instructions encapsulated in the list.</t>
	  
	  <t>Regarding the use of BGP Flow specification to steer traffic into a SR Policy, 
	  the method proposed in <xref target="I-D.ietf-idr-ts-flowspec-srv6-policy"/> employs the redirect-to-IP action defined in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/>. 
	  It carries the endpoint information of the SR Policy in the redirect-to-IP action, 
	  and requires the flowspec protocol to carry color information through the BGP attribute in this case, 
	  and carry prefix SID information as necessary. This method adds a new action, redirect to SR Policy, to the originally single-action redirect to IP. 
	  The newly added redirect to SR Policy action can only be distinguished by whether the BGP attributes carry the color extended community attribute. 
	  Since the color extended community attribute is optional, this can lead to errors in the following scenarios: Redirect to SR Policy may fail when the color extended community attribute is absent;
	  Redirect to IP may fail when the color extended community attribute is present. Additionally, 
	  <xref target="I-D.ietf-idr-ts-flowspec-srv6-policy"/> is merely an informational document in the IETF, not a standard solution for steering traffic into a SR Policy.
	  To satisfy the requirement for the headend node to encapsulate an SRv6 Service SID when performing the redirect to SR Policy action, 
	  <xref target="I-D.ietf-idr-ts-flowspec-srv6-policy"/> suggests using the SRv6 Services TLVs defined for VPN services. 
	  These TLVs would be carried in the BGP Prefix-SID Attribute and sent to the headend node along with the redirect to SR Policy action. 
	  While this approach of reusing attributes or fields defined for other purposes is easy to implement, it can cause confusion.</t>
	  
	  <t><xref target="I-D.ietf0-idr-srv6-flowspec-path-redirect"/> proposes a scheme that indirectly steers traffic into a SR Policy through a Binding SID (BSID). 
	  However, this approach requires knowledge of the BSID corresponding to the SR Policy, which poses a high requirement. Moreover, as explicitly stated in <xref target="RFC9256"/>, 
	  not every SR Policy is required to have a BSID, and the specific value of a BSID may change over time and with state. 
	  Therefore, <xref target="RFC9256"/> specifically notes that the BSID should not be used as an identifier for a SR Policy. 
	  Consequently, the scheme proposed in <xref target="I-D.ietf0-idr-srv6-flowspec-path-redirect"/> is technically unfeasible.</t>
	  
	  <t>To address the drawbacks mentioned above,this document extends the BGP Flowspec V2 protocol <xref target="I-D.ietf-idr-flowspec-v2"/> (FSv2) by defining two new standard 
	  traffic filtering actions specifically for steering traffic into a SR Policy: Redirect to SR Policy Action and SRv6 SID Action.
	  The SRv6 SID Action is optional. It can be used in conjunction with the Redirect to SR Policy Action or other actions defined in FSv2 when needed.</t>
      
	  <t>The current version of this document focuses on FSv2 extensions for SRv6 Policy. FSv2 extensions for SR-MPLS Policy will be provided in a later version or written in a separate draft.</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>
      <!-- [CHECK] The 'Requirements Language' section is optional -->

    </section>
    
    <section>
      <name>FSv2 Extension</name>
	  <t>This document defines a new traffic filtering action: Redirect to SR Policy Action. 
		It is specifically encapsulated and carried through the BGP Community Container Attribute 
		(also known as BGP Wide Communities) defined in <xref target="I-D.ietf-idr-wide-bgp-communities"/>.</t>
	  
	  <t>The definition and format of an action-SubTLV in the BGP Community Container Attribute are illustrated in Figure 1.</t>
	  
	  <figure align="center">
		<name>Format of Action-SubTLV</name>
		<artwork align="center"><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      SubTLV Type (2 octets)   |        Length (2 octets)      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Value (variable)   |        
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		]]></artwork>
	  </figure>

      <section>
        <name>Redirect to SR Policy Action</name>	
	    <t>The newly defined redirect to SR policy Action in this document is represented by the action-SubTLV.</t>
	    <t>Where:</t>
		<t>SubTLV Type (2 octet): Used to indicate that this action-SubTLV is a Redirect to SR policy Action SubTLV. Its value is requested to be assigned by IANA.</t>
	    <t>Length (2 octet): Measured in byte, used to indicate the total length of the Redirect to SR policy Action.</t> 
	    <t>Value (variable): Used to specify the particular SR policy to which the traffic is to be directed.</t>
	    <t>The Value field for Redirect to SR policy Action SubTLV is shown in Figure 2.</t>
	  
		<figure align="center">
		  <name>Format of Value Field in Redirect to SR policy Action</name>
		  <artwork align="center"><![CDATA[
+-------------------------------+
|          Flags (1 octet)      |
+-------------------------------+
|     Policy Color (4 octets)   |
+-------------------------------+
|     Endpoint (4 or 16 octets) |
+-------------------------------+
			]]></artwork>
		</figure>

		<t>Where:</t>
		<t>Flags (1 octet): Currently, only two bits are defined: the S bit and the F bit. The other bits are reserved.
			The S bit and the F bit are used to indicate the type of Endpoint,as shown in Figure 3.</t>
		<t>Policy Color (4 octets): The color value of the SR policy <xref target="RFC9256"/> to which traffic is to be directed. </t>	
		<t>Endpoint (4 or 16 octets): The endpoint of the SR policy <xref target="RFC9256"/> to which traffic is to be directed. 
			When the SR policy's endpoint is represented by an IPv6 address, the Endpoint field is 16 bytes in length, and the S bit in the flags field is set to 1. 
			When the SR policy's endpoint is represented by an IPv4 address, the Endpoint field is 4 bytes in length, and the F bit in the flags field is set to 1.</t>
	  
	  
		<figure align="center">
		  <name>Format of Flags Field</name>
		  <artwork align="center"><![CDATA[
 0 1 2 3 4 5 6 7 
+-+-+-+-+-+-+-+-+
| Reserved  |S|F|        
+-+-+-+-+-+-+-+-+
			]]></artwork>
		</figure>
		<t>Where:</t>
		<t>S Flag (1 bit): Means Six. It indicates that the endpoint is represented by an IPv6 address When it is set to 1.</t> 
		<t>F Flag (1 bit): Means Four. It indicates that the endpoint is represented by an IPv4 address When it is set to 1.</t> 
		<t>Reserved (6 bits): These bits are reserved for future use. They are set to 0 when sending and ignored when receiving.</t>
		<t>The S bit and F bit can only have one bit set to 1.</t>
	  </section>
	  
	  <section>
		<name>SRv6 SID Action</name>
		<t>In some scenarios, when redirecting specific traffic to a SR Policy for forwarding, the headend node also needs to encapsulate an additional SRv6 SID. 
		For example, when the last SID of the SR policy path is not USD (Ultimate Segment Decapsulation) flavored <xref target="RFC8986"/>, the additional SRv6 SID encapsulated by the headend node is used to instruct the endpoint to decapsulate the outer packet header.
		To meet this requirement, we define a second new action for the FSv2 protocol, the SRv6 SID Action. 
		This action is used in conjunction with the Redirect to SR Policy Action when necessary. It should be noted that the Redirect to SR Policy Action can be used independently, and the SRv6 SID Action can also be combined with other actions defined in FSv2.</t>
		<t>The newly defined SRv6 SID Action in this document is represented using an action-SubTLV (format shown in Figure 1).</t>
		<t>Where:</t>
		<t>SubTLV Type (2 octet): Used to indicate that this action-SubTLV is a SRv6 SID Action SubTLV. Its value is requested to be assigned by IANA.</t>
	    <t>Length (2 octet): Measured in byte, used to indicate the total length of the SRv6 SID Action.</t> 
	    <t>Value (variable): Used to carry the specific SRv6 SID information. Its format is shown in Figure 4.</t>
	    
	  
		<figure align="center">
		  <name>Format of Value Field in SRv6 SID Action</name>
		  <artwork align="center"><![CDATA[
+-------------------------------+
|        Action (1 octet)       |
+-------------------------------+
|      SRv6 SID (16 octets)     |
+-------------------------------+
		  ]]></artwork>
		</figure>

		<t>Where:</t>
		<t>Action (1 octet): Only the value of 1 is defined. 
	  A value of 1 represents encapsulation, indicating that the headend node will encapsulate an additional SRv6 SID when performing the redirect action. 
	  The other 255 possible values are reserved for future extensions.</t>
	  
		<t>SRv6 SID (16 octets): The value represents a specific SRv6 SID, which can be an SRv6 SID type defined in  <xref target="RFC8956"/>, 
	  such as DT4, DT6, DT46, etc., or END SID with USD flavor.</t>
	 
	  </section>
	  
    </section>
    
     <section>
      <name>Application Scenario</name>
	  <t>The headend node is enhanced to support the protocol extension defined in this document, 
	  being able to receive and parse the extended BGP FSv2 policies and perform the corresponding actions according to the newly defined actions. 
	  Specifically, when the headend node receives a policy containing a Redirect to SR policy Action issued through the extended FSv2 protocol, 
	  it configures the corresponding policy. Upon receiving traffic matching the policy, 
	  the headend node forwards the matching traffic to the corresponding SR Policy as required by the policy, i.e., 
	  encapsulates the traffic in SR and forwards the encapsulated traffic to the corresponding forwarding node via the interface specified by the policy. 
	  If the policy received by the headend node, issued through the extended FSv2 protocol, contains both Redirect to SR policy Action and SRv6 SID Action, 
	  the headend node configures the policy accordingly. Upon receiving traffic matching the policy, 
	  the headend node performs both the redirection to the SR policy and the action specified by the SRv6 SID action, 
	  such as further encapsulating the SRv6 SID carried in the SRv6 SID action.</t>
	  

      <t>The forwarding node forwards the packet based on the header information upon receiving the packet. 
	  This document does not introduce any new requirements or extensions for the forwarding node.</t>
	  
	  <t>When the traffic reaches the endpoint node, the endpoint node processes and forwards the packet based on the header information of the received packet. 
	  This document does not introduce any new requirements or extensions for the endpoint node. 
	  Even if the received packet contains an SRv6 SID that was additionally encapsulated by the headend node according to the SRv6 SID Action, 
	  the endpoint node will perform the corresponding operations as indicated by the SRv6 SID, 
	  such as removing the SRv6 Policy encapsulation (decapsulating the outer IPv6 header), 
	  looking up in the routing table for the destination address of the inner packet header, and forwarding it accordingly. 
	  These are all normal processing procedures for the endpoint node, 
	  which is unaware that the SID it is processing was additionally encapsulated by the headend node according to the SRv6 SID Action. 
	  In summary, this document does not introduce any new requirements or extensions for the endpoint node.</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>IANA is requested to assign the following code points from the "BGP FSv2 Action types" Registry:
	  </t>

	  <table align="center">
		<name>Code Point for the Actions</name>
        <thead>
        <!-- [REPLACE/DELETE] a table header is optional -->
          <tr>
			<th align="left" colspan="1" rowspan="1">Code Point</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">Reference</th>
		  </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">TBD1</td>
            <td align="left" colspan="1" rowspan="1">Redirect to SR policy Action</td>
            <td align="left" colspan="1" rowspan="1">This document</td>
          </tr>
		  <tr>
            <td align="left" colspan="1" rowspan="1">TBD2</td>
            <td align="left" colspan="1" rowspan="1">SRv6 SID Action</td>
            <td align="left" colspan="1" rowspan="1">This document</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>TBD</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-v2.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-wide-bgp-communities.xml"/>
      </references>
	  
	  <references>
        <name>Informative References</name>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4360.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4760.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"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8986.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9256.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-flowspec-redirect-ip.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf0-idr-srv6-flowspec-path-redirect.xml"/>
		<xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-ts-flowspec-srv6-policy.xml"/>
      </references>

    </references>
    


    <section anchor="Acknowledgements" numbered="false">
      <!-- [REPLACE/DELETE] an Acknowledgements section is optional -->
      <name>Acknowledgements</name>
      <t>The authors would like to express their gratitude for the review and contributions from Cheng Chang and Bo Liu.</t>
	  <t>Zheng Zhang provides valueable comments to this document.</t>
	</section>
    
 </back>
</rfc>