<?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="std" docName="draft-ietf-idr-ts-flowspec-srv6-policy-07"
     ipr="trust200902" updates="8669">
  <front>
    <title abbrev="FlowSpec with SR Policy">Traffic Steering using BGP
    FlowSpec with SR Policy</title>

    <author fullname="Wenying Jiang" initials="W. " surname="Jiang">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street>No.32 XuanWuMen West Street</street>

          <city>Beijing</city>

          <code>100053</code>

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

        <email>jiangwenying@chinamobile.com</email>
      </address>
    </author>

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

      <address>
        <postal>
          <street>No.32 XuanWuMen West Street</street>

          <city>Beijing</city>

          <code>100053</code>

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

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

    <author fullname="Shunwan Zhuang" initials="S." surname="Zhuang">
      <organization>Huawei Technologies</organization>

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

          <city>Beijing</city>

          <region/>

          <code>100095</code>

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

        <phone/>

        <facsimile/>

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

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

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

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

          <city>Silver Spring, MD 20904</city>

          <region/>

          <code/>

          <country>United States of America</country>
        </postal>

        <phone/>

        <facsimile/>

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

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

    <author fullname="Shuanglong Chen" initials="S." surname="Chen">
      <organization>Huawei Technologies</organization>

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

          <city>Beijing</city>

          <region/>

          <code>100095</code>

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

        <phone/>

        <facsimile/>

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

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

    <date day="4" month="August" year="2025"/>

    <abstract>
      <t>BGP Flow Specification (FlowSpec) <xref target="RFC8955"/> and <xref
      target="RFC8956"/> has been proposed to distribute BGP <xref
      target="RFC4271"/> FlowSpec NLRI to FlowSpec clients to mitigate
      (distributed) denial-of-service attacks, and to provide traffic
      filtering in the context of a BGP/MPLS VPN service. Recently, traffic
      steering applications in the context of SR-MPLS and SRv6 using FlowSpec
      are being used in networks. This document introduces the usage of BGP
      FlowSpec to steer packets into an SR Policy.</t>
    </abstract>

    <note title="Requirements Language">
      <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">RFC 2119</xref> <xref target="RFC8174"/> when,
      and only when, they appear in all capitals, as shown here.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>SR-MPLS <xref target="RFC8660"/> forwards data packets using the
      source routing model. The core idea of SR-MPLS is to divide a packet
      forwarding path into different segments, allocate segment identifiers
      (SIDs) to the segments, and encapsulate segment information into packets
      at the ingress of the path to guide packet forwarding.</t>

      <t>Segment Routing IPv6 (SRv6) is a protocol designed to forward IPv6
      data packets on a network using the source routing model. SRv6 enables
      the ingress network device to add a segment routing header (SRH) <xref
      target="RFC8754"/> to an IPv6 packet and push an explicit IPv6 address
      stack into the SRH. After receiving the packet, each transit node
      updates the IPv6 destination IP address in the packet and segment list
      to implement hop-by-hop forwarding.</t>

      <t>SR Policy (includes SR-MPLS and SRv6 Policy) <xref target="RFC9256"/>
      is a tunneling technology based on SR-MPLS and SRv6. An SR Policy is a
      set of candidate paths consisting of one or more segment lists, that is,
      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 through the path rather than the shortest path computed
      using an IGP. The header of a packet steered into an SR Policy is
      augmented with an ordered list of segments associated with that SR
      Policy, so that other devices on the network can execute the
      instructions encapsulated into the list.</t>

      <t>The headend of an SR Policy may learn multiple candidate paths for an
      SR Policy. Candidate paths may be learned via a number of different
      mechanisms, e.g., CLI, NetConf, PCEP<xref
      target="I-D.ietf-pce-segment-routing-policy-cp"/>, or BGP<xref
      target="I-D.ietf-idr-sr-policy-safi"/>.</t>

      <t><xref target="RFC8955"/> and <xref target="RFC8956"/> define the BGP
      <xref target="RFC4271"/> Flow Specification (FlowSpec) that allows
      conveying flow specifications and traffic Action/Rules associated (rate-
      limiting, redirect, remark ...). BGP Flow specifications are encoded
      within the MP_REACH_NLRI and MP_UNREACH_NLRI attributes<xref
      target="RFC4760"> </xref>. Rules (Actions associated) are encoded in
      Extended Community attribute<xref target="RFC4360"> </xref>. The BGP
      Flow Specification function allows BGP Flow Specification routes that
      carry traffic policies to be transmitted to BGP Flow Specification peers
      to steer traffic.</t>

      <t>This document proposes a new usage for BGP FlowSpec in order to steer
      traffic into an SR Policy. This work is helpful for promoting the
      deployment of SR-MPLS and SRv6 networks.</t>
    </section>

    <section title="Definitions and Acronyms">
      <t><list style="symbols">
          <t>FlowSpec: Flow Specification</t>

          <t>SR: Segment Routing</t>

          <t>SR-MPLS: SR over the MPLS data plane</t>

          <t>SRv6: SR over the IPv6 data plane</t>

          <t>SID: Segment Identifier</t>

          <t>SRH: Segment Routing Header</t>

          <t>TE: Traffic Engineering</t>

          <t>USD: Ultimate Segment Decapsulation</t>
        </list></t>
    </section>

    <section title="Operations">
      <t>An SR Policy <xref target="RFC9256"/> is identified through the tuple
      &lt;headend, color, endpoint&gt;. In the context of a specific headend,
      one may identify an SR Policy by the &lt;color, endpoint&gt; tuple. The
      headend is the node where the SR Policy is instantiated/implemented. The
      headend is specified as an IPv4 or IPv6 address and is expected to be
      unique in the domain. The endpoint indicates the destination of the SR
      Policy. The endpoint is specified as an IPv4 or IPv6 address and is
      expected to be unique in the domain. The color is a 32-bit unsigned
      numerical value that associates with the SR policy, and it defines an
      application-level network Service Level Agreement (SLA) policy or
      intent.</t>

      <t>Assume one or multiple SR Policies are already setup/instantiated in
      the SR HeadEnd device. In order to steer traffic into a specific SR
      Policy at the Headend, one can use the SR Color Extended community <xref
      target="RFC9012"/> and endpoint to map to a satisfying SR Policy, and
      steer the traffic into this specific SR Policy.</t>

      <t><xref target="I-D.ietf-idr-flowspec-redirect-ip"/> defines the
      redirect to IPv4 and IPv6 Next-hop action. The IPv4 next-hop address in
      the Flow-spec Redirect to IPv4 Extended Community can be used to specify
      the endpoint of the SR Policy, and the IPv6 next-hop address in the
      Flow-spec Redirect to IPv6 Extended Community<xref target="RFC5701"/>
      can be used to specify the endpoint of the SRv6 Policy.</t>

      <t>When the packets reach the TailEnd device, some specific function
      information identifiers can be used to decide how to further process the
      flows in SRv6 scenarios. Several endpoint functions are already defined,
      e.g., End.DT6: Endpoint with decapsulation and IPv6 table lookup, and
      End.DX6: Endpoint with decapsulation and IPv6 cross-connect. The BGP
      Prefix-SID defined in <xref target="RFC8669"/> is utilized to enable
      SRv6 VPN services <xref target="RFC9252"/>. SRv6 Services TLVs within
      the BGP Prefix-SID Attribute can be used to indicate the endpoint
      functions. This document extends the use of the BGP Prefix-SID attribute
      <xref target="RFC8669"/> to carry SRv6 SIDs and their associated
      information with the BGP address families that are defined in <xref
      target="RFC8955"/> and <xref target="RFC8956"/>, where applicable, as
      described in Section 5.</t>

      <t>For SR-MPLS scenarios, this document proposes carrying the Color
      Extended Community and the Flow-spec Redirect to IPv4 Extended Community
      in the context of a Flowspec NLRI <xref target="RFC8955"/> <xref
      target="RFC8956"/> to an SR-MPLS Headend to steer traffic into one
      SR-MPLS Policy.</t>

      <t>For SRv6 scenarios, this document proposes carrying the Color
      Extended Community, the Flow-spec Redirect to IPv6 Extended Community
      and BGP Prefix-SID Attribute in the context of a Flowspec NLRI <xref
      target="RFC8955"/> <xref target="RFC8956"/> to an SRv6 Headend to steer
      traffic into one SRv6 Policy, as well as to indicate specific Tailend
      functions.</t>

      <t>For the case where a FlowSpec route carries multiple Color Extend
      Communities, the Color Extended community with the highest numerical
      value will be given higher preference per the description in Section
      8.4.1 of <xref target="RFC9256"/>.</t>

      <t/>

      <t>The method proposed in this document supports load balancing to the
      tailend device. To achieve that, the headend device CAN set up multiple
      paths in one SR Policy, and use a FlowSpec route to indicate the
      specific SR Policy.</t>

      <t/>
    </section>

    <section title="SR-MPLS Application Examples">
      <t>In following scenario, BGP FlowSpec Controller signals the filter
      rules, the Flow-spec Redirect to IPv4 action, and the policy color to
      the SR-MPLS HeadEnd device.</t>

      <t><figure>
          <artwork align="left"><![CDATA[
   +------------+
   |  BGP FS    |
   | Controller |
   +------------+
      | FlowSpec route to HeadEnd:
      |   NLRI: Filter Rules
      |   Redirect to IPv4 Nexthop: TailEnd's Address
      |   Policy Color: C0
      |
      |          .-----.
      |         (       )
      V     .--(         )--.
+-------+  (                 )  +-------+
|       |_(  SR-MPLS Network  )_|       |
|HeadEnd| ( ================> ) |TailEnd|
+-------+  (SR List<S1,S2,S3>)  +-------+
            '--(         )--'   
                (       )       
                 '-----'

      Figure 1: Steering the Traffic Flow into SR-MPLS Policy

]]></artwork>
        </figure></t>

      <t>When the SR-MPLS HeadEnd device (as a FlowSpec client) receives such
      instructions from BGP FS Controller, it will steer the traffic flows
      matching the criteria in the FlowSpec route into the SR-MPLS Policy
      matching the tuple (Endpoint: TailEnd's Address, Color: C0). And the
      packets of such traffic flows will be encapsulated with an MPLS stack
      using the SR List &lt;S1, S2, S3&gt; in the HeadEnd device, then send
      the packets to the TailEnd device along the path indicated by the SR
      list.</t>

      <t/>
    </section>

    <section title="SRv6 Application Examples">
      <t>In following scenario, BGP FlowSpec Controller signals the filter
      rules, the redirect to IPv6 Nexthop action, the policy color and the
      function information (SRv6 SID: Service_id_x) to the HeadEnd device.</t>

      <t><figure>
          <artwork align="left"><![CDATA[
   +------------+
   |  BGP FS    |
   | Controller |
   +------------+
      | FlowSpec route to HeadEnd:
      |   NLRI: Filter Rules
      |   Redirect to IPv6 Nexthop: TailEnd's Address
      |   Policy Color: C1
      |   PrefixSID: Service_id_x
      |          .-----.
      |         (       )
      V     .--(         )--.
+-------+  (                 )  +-------+
|       |_( SRv6 Core Network )_|       |
|HeadEnd| ( ================> ) |TailEnd|
+-------+  (SR List<S1,S2,S3>)  +-------+
            '--(         )--'   Service SID: Service_id_x
                (       )       (e.g.: End.DT4 or End.DT6 or others)
                 '-----'

      Figure 2: Steering the Traffic Flow into SRv6 Policy (Option 1)

]]></artwork>
        </figure></t>

      <t>When the HeadEnd device (as a FlowSpec client) receives such
      instructions from BGP FS Controller, it will steer the traffic flows
      matching the criteria in the FlowSpec route into the SRv6 Policy
      matching the tuple (Endpoint: TailEnd's Address, Color: C1). And the
      packets of such traffic flows will be encapsulated with an SRH (Segment
      Routing Header) using the SR List &lt;S1, S2, S3, Service_id_x&gt;. When
      the packets reach to the TailEnd device, they will be further processed
      per the function denoted by the Service_id_x.</t>

      <t>When the HeadEnd device determines (with the help of SRv6 SID
      Structure) that the Service SID belongs to the same SRv6 Locator as the
      last SRv6 SID of the TailEnd device in the SRv6 Policy segment list, it
      MAY exclude that last SRv6 SID when steering the service flow. For
      example, the effective segment list of the SRv6 Policy associated with
      SID list &lt;S1, S2, S3&gt; would be replaced with &lt;S1, S2,
      Service_id_x&gt;.</t>

      <t>If the last SRv6 SID (for example, we use S3 here) of the TailEnd
      device in the SRv6 Policy segment list is USD-flavored, an SRv6 Service
      SID (e.g., End.DT4 or End.DT6) is not required when a BGP FlowSpec
      Controller sends the FlowSpec route to the HeadEnd device (as a FlowSpec
      client).</t>

      <t><figure>
          <artwork align="left"><![CDATA[
   +------------+
   |  BGP FS    |
   | Controller |
   +------------+
      | FlowSpec route to HeadEnd:
      |   NLRI: Filter Rules
      |   Redirect to IPv6 Nexthop: TailEnd's Address
      |   Policy Color: C2
      |          .-----.
      |         (       )
      V     .--(         )--.
+-------+  (                 )  +-------+
|       |_( SRv6 Core Network )_|       |
|HeadEnd| ( ================> ) |TailEnd|
+-------+  (SR List<S1,S2,S3>)  +-------+
            '--(         )--'    
                (       )       
                 '-----'
Note: S3 MUST be a USD-flavored SRv6 SID of the TailEnd

      Figure 3: Steering the Traffic Flow into SRv6 Policy (Option 2)

]]></artwork>
        </figure>When the HeadEnd device (as a FlowSpec client) receives such
      instructions from a BGP FS Controller, it will steer the traffic flows
      matching the criteria in the Flowspec route into the SRv6 Policy
      matching the tuple (Endpoint: TailEnd's Address, Color: C2). And the
      packets of such traffic flows will be encapsulated with an SRH (Segment
      Routing Header) using the SR List &lt;S1, S2, S3&gt;. When the packets
      reach to the TailEnd device, they will be further processed per the
      function denoted by the USD-flavored SRv6 SID S3.</t>

      <t>For the cases of intra-AS and inter-AS traffic steering using this
      method, the usages of Flowspec Color Extended Community with BGP prefix
      SID are the same for both scenarios. The difference lies between the
      local SRv6 policy configurations. For the inter-domain case, the
      operator can configure an inter-domain SRv6 policy/path at the Headend
      device. For the intra-domain case, the operator can configure an
      intra-domain SRv6 policy/path at the Headend device.</t>

      <t/>
    </section>

    <section title="Error Handling">
      <t>The error handling procedures depend on the results of the
      following:</t>

      <t><list style="symbols">
          <t>a) The validation procedures of the redirect-to-IP Extended
          Community as per <xref
          target="I-D.ietf-idr-flowspec-redirect-ip"/></t>

          <t>b) The validation and selection procedures of the Color Extended
          Community as per <xref target="RFC9256"/>, which determine a single
          color for steering</t>

          <t>c) The validation procedures of the Prefix-SID attribute per
          section 6 of <xref target="RFC8669"/> if attached</t>
        </list>After the above results are determined, perform the following
      error-handling procedures:</t>

      <t><list style="symbols">
          <t>1) If the Color Extended Community is invalid or is not attached,
          the actions defined in this document do not apply. The procedures
          defined in <xref target="I-D.ietf-idr-flowspec-redirect-ip"/> are
          applied instead.</t>

          <t>2) If the redirect-to-IP Extended Community is invalid or is not
          attached, and there are other actions attached, the filter is
          further processed with those actions.</t>

          <t>3) If the redirect-to-IP Extended Community, the Color Extended
          Community, and the Prefix-SID attribute are attached and valid, the
          traffic flows are per-destination steered into the corresponding
          SR-Policy by the <xref target="RFC9256"/> procedures with the
          Service SID(defined in the Prefix-SID attribute), as illustrated in
          Sections 3 and 5. The HeadEnd SHOULD load-share the traffic flows
          across all the corresponding SR-Policies with the redirect-to-IP
          addresses as their Endpoints if there are multiple valid
          redirect-to-IP Extended Communities. If the HeadEnd is incapable of
          doing so, it SHOULD deterministically select one redirect-to-IP
          address as the Endpoint.</t>

          <t>4) If the redirect-to-IP Extended Community and the Color
          Extended Community are attached and valid, but the Prefix-SID
          attribute is invalid or is not attached, the traffic flows are
          per-destination steered into the corresponding SR-Policy by the
          <xref target="RFC9256"/> procedures without the Service SID, as
          illustrated in Sections 3, 4, and 5. The HeadEnd SHOULD load-share
          the traffic flows across all the corresponding SR-Policies with the
          redirect-to-IP addresses as their Endpoints if there are multiple
          valid redirect-to-IP Extended Communities. If the HeadEnd is
          incapable of doing so, it SHOULD deterministically select one
          redirect-to-IP address as the Endpoint.</t>
        </list></t>

      <t/>
    </section>

    <section title="Running Code ">
      <t/>

      <section title="Interop-test Status">
        <t>This section records the status of known implementations of the
        protocol defined by this specification at the time of posting of this
        document. The description of implementations in this section is
        intended to assist the IETF in its decision processes in progressing
        drafts to RFCs. Please note that the listing of any individual
        implementation here does not imply endorsement by the IETF.
        Furthermore, no effort has been spent to verify the information
        presented here that was supplied by IETF contributors. This is not
        intended as, and must not be construed to be, a catalog of available
        implementations or their features. Readers are advised to note that
        other implementations may exist.</t>

        <t>The Traffic Steering using BGP FlowSpec with SR-MPLS / SRv6 Policy
        mechanism has been implemented on the following hardware devices,
        Network Operating System software, and SDN controllers. They have also
        successfully participated in the series of joint interoperability
        testing events hosted by China Mobile from July 2021 to October 2021.
        The following hardware devices and Network Operating System software
        had successfully passed the interoperability testing (in alphabetical
        order).</t>

        <t><figure>
            <artwork align="left"><![CDATA[Routers:
+---------+---------------+--------------------------------+
| Vendors | Device Model  | Version                        |
+---------+---------------+--------------------------------+
| Huawei  | NE40-X8A      | NE40E V800R021C00SPC091T       |
+---------+---------------+--------------------------------+
| New H3C | CR16010H-FA   | Version 7.1.075, ESS 8305      |
+---------+---------------+--------------------------------+
| Ruijie  | RG-N8010-R    | N8000-R_RGOS 12.8(1)B08T1      |
+---------+---------------+--------------------------------+
| ZTE     | M6000-8S Plus | V5.00.10(5.60.5)               |
+---------+---------------+--------------------------------+

Controllers:
+----------------+---------------+-------------------------+
| Vendors        | Device Model  | Version                 |
+----------------+---------------+-------------------------+
| China Unitechs | I-T-E SC      | V1.3.6P3                |
+----------------+---------------+-------------------------+
| Huawei         | NCE-IP        | V100R021C00             |
+----------------+---------------+-------------------------+
| Ruijie         | RG-ONC-AIO-H  | RG-ION-WAN-CLOUD_2.00T1 |
+----------------+---------------+-------------------------+
| ZTE            | ZENIC ONE     | R22V16.21.20            |
+----------------+---------------+-------------------------+

]]></artwork>
          </figure></t>

        <t/>
      </section>

      <section title="Deployment Status">
        <t>As of August 2022, this feature has been deployed on the IP
        backbone network of China Mobile.</t>

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

    <section anchor="IANA" title="IANA Considerations">
      <t>No IANA actions are required for this document.</t>

      <t/>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>This document does not change the security properties of SRv6 and
      BGP.</t>

      <t/>
    </section>

    <section title="Contributors ">
      <t>The following people made significant contributions to this
      document:</t>

      <t><figure>
          <artwork align="left"><![CDATA[Yunan Gu
Huawei Technologies
Email: guyunan@huawei.com

Haibo Wang
Huawei Technologies
Email: rainsword.wang@huawei.com

Jie Dong
Huawei Technologies
Email: jie.dong@huawei.com

Xue Yang
China Mobile
Email: yangxuewl@chinamobile.com

]]></artwork>
        </figure></t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors would like to acknowledge the review and inputs from
      Jeffrey Haas, Susan Hares, Keyur Patel, Weiqiang Cheng, Kaliraj
      Vairavakkalai, Robin Li, Acee Lindem, Gunter Van De Velde, John Scudder,
      Rainbow Wu, Linda Dunbar, Gang Yan, Feng Yang, Wim Henderickx, Robert
      Raszuk, Ketan Talaulikar, Changwang Lin, Aijun Wang, Hao Li, Huaimo
      Chen, Sheng Fang, Yuanxiang Qiu, Ran Chen, Cheng Li, Zheng Zhang, Xuewei
      Wang, Yanrong Liang, Xuhui Cai, Haojie Wang, Lili Wang and Nan Geng.</t>

      <t>Special thanks to Nat Kao, who suggested adding SR-MPLS use cases to
      this document and provided detailed feedback on the error handling
      section.</t>

      <t>Special thanks to Donald E. Eastlake, 3rd, who thoroughly reviewed
      the entire document and made many useful suggestions for
      improvement.</t>
    </section>
  </middle>

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

      <?rfc include='reference.RFC.4271'?>

      <?rfc include='reference.RFC.4360'?>

      <?rfc include='reference.RFC.4760'?>

      <?rfc include='reference.RFC.5701'?>

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

      <?rfc include='reference.RFC.8660'?>

      <?rfc include='reference.RFC.8669'?>

      <?rfc include='reference.RFC.8955'?>

      <?rfc include='reference.RFC.8956'?>

      <?rfc include='reference.RFC.9012'?>

      <?rfc include='reference.RFC.9252'?>

      <?rfc include='reference.RFC.9256'?>

      <?rfc include='reference.I-D.ietf-idr-sr-policy-safi'?>

      <?rfc include='reference.I-D.ietf-idr-fsv2-ip-basic'?>

      <?rfc include='reference.I-D.ietf-idr-flowspec-redirect-ip'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.RFC.8754'?>

      <?rfc include='reference.I-D.ietf-pce-segment-routing-policy-cp'?>
    </references>
  </back>
</rfc>
