<?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-ietf-idr-flowspec-path-redirect-12"
  ipr="trust200902"
  obsoletes=""
  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 Indirection-id Redirect">Flowspec Indirection-id Redirect</title>
    <!--  [REPLACE/DELETE] abbrev. The abbreviated title is required if the full title is longer than 39 characters -->

    <seriesInfo name="Internet-Draft" value="draft-ietf-idr-flowspec-path-redirect-12"/>

    <author
        role="editor"
		fullname="Gunter Van de Velde"
        initials="G."
        surname="Van de Velde">
        <!-- abbrev not needed but can be used for the header
             if the full organization name is too long -->
        <organization abbrev="Nokia">Nokia</organization>
        <address>
            <postal>
                <!-- I've omitted my street address here -->
                <street/>
                <city>Antwerp</city>
                <country>BE</country>
            </postal>
        <email>gunter.van_de_velde@nokia.com</email>
        </address>
    </author>

    <!-- Another author who claims to be an editor -->

    <author fullname="Keyur Patel"
            initials="K."
            surname="Patel">
      <organization>Arrcus</organization>
      <address>
        <postal>
          <street></street>
          <!-- Reorder these if your country does things differently -->
          <city></city>
          <region></region>
          <code></code>
          <country>USA</country>
        </postal>
        <phone></phone>
        <email>keyur@arrcus.com</email>
        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Zhenbin Li"
            initials="Z."
            surname="Li">
      <organization>Huawei Technologies</organization>
      <address>
        <postal>
          <street>Huawei Bld., No. 156 Beiquing Rd</street>
          <!-- Reorder these if your country does things differently -->
          <city>Beijing</city>
          <region></region>
          <code>100095</code>
          <country>China</country>
        </postal>
        <phone></phone>
        <email>lizhenbin@huawei.com</email>
        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <date year="2022"/>
    <!-- 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>IDR Working Group</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>keyword</keyword>
    <!-- [REPLACE/DELETE]. Multiple allowed.  Keywords are incorporated into HTML output files for
         use by search engines. -->

    <abstract>
      <t>This document defines a new extended community known as
      "FlowSpec Redirect to indirection-id Extended Community".
      This extended community triggers
  	  advanced redirection capabilities to flowspec clients. When
  	  activated, this flowspec extended community is used by
  	  a flowspec client to retrieve the corresponding next-hop and encoding
      information within a localised indirection-id mapping table.</t>

   	  <t>The functionality detailed in this document allows a network controller
  	  to decouple the BGP flowspec redirection instruction from the operation of
      the available paths.
  	  </t>
    </abstract>

  </front>

  <middle>

    <section>
      <name>Introduction</name>
      <t>Flowspec is an extension to BGP that allows for the dissemination
      of traffic flow specification rules. This has many possible
      applications but the primary one for many network operators is the
      distribution of traffic filtering actions for DDoS mitigation. The
      flowspec standard <xref target="RFC8955"/> defines a
      redirect-to-VRF action for policy-based forwarding, but this
      mechanism is not always sufficient, particularly if the
      redirected traffic needs to be steered onto an explicit path.</t>

      <t>Every flowspec policy route is effectively a rule, consisting
      of two parts. The first part, encoded in the NLRI field, provides
      information about the traffic matching the policy rule. the
      second part, encoded in one or more BGP extended communities, provides
      policy instructions for traffic handling on the flowspec client.
      The flowspec standard <xref target="RFC8955"/> defines
      widely-used filter actions such as discard and rate limit; it also
      defines a redirect-to-VRF action for policy-based forwarding. Using the
      redirect-to-VRF action to steer traffic towards an alternate
      destination is useful for DDoS mitigation, however using this
      methodology can be cumbersome when there is need to steer the traffic
      onto an explicitely defined traffic path.</t>

      <t>This draft specifies a "Redirect to indirection-id" flowspec action
      making use of a 32-bit indirection-id using a new extended community.
      Each indirection-id serves as anchor point, for policy-based forwarding
      onto an explicit path by a flowspec client.
      </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>indirection-id and indirection-id table</name>

          <t>The indirection-id is a 32-bit unsigned number, used as anchor
          point on a flowspec client for policy-based forwarding onto an
          explicit path by a flowspec client.
          </t>

          <t>The indirection-id table is the table construct of
          indirection-id values, grouped by indirection-id "ID-Type".  Each
          entry in this table contains policy-based forwarding and encoding
          instructions.</t>

        	<t>The configuration of the indirection-id table on a flowspec client
          is a localised operation on each router, and MAY happen out-of-band
          from BGP flowspec. For some use-case scenarios the indirection-id
          "ID-Type" provides additional (maybe even fully sufficient)
          context for a flowspec client for policy based forwarding, making a
          localised indirection-id table obsolete. For example, when the
          indirection-id refers to a MPLS segment routing node-id
          <xref target="RFC9256"/>, then the indirection-id provides sufficient
          information for a segment routing lookup on the flowspec client.
          </t>

        </section>

                <section>
                  <name>Use Case Scenarios</name>
                  <t>This section describes a few use-case scenarios when deploying
            	    "Redirect to indirection-id".
                  </t>

                  <section>
                    <name>Redirection shortest Path tunnel</name>

            	<t>Description:
            	</t>
                <t>The first use-case describes an example where a single
            	  flowspec route is sent from a BGP flowspec controller
            	  to many BGP flowspec clients. This BGP flowspec route carries
                the "Redirect to indirection-id" to all flowspec clients with intent
            	  to redirect matching dataflows onto a shortest-path tunnel
                pointing towards a single remote destination.
                </t>

            	  <t>In this first use-case scenario, each flowspec client receives
                flowspec routes. The received flowspec routes have the extended
                "Redirect to indirection-id" community attached. Each "Redirect to indirection-id"
                community embeds two relevant components: (1) 32-bit indirection-id and
                (2) ID-type. These two components provide the flowspec client
                with sufficient information for policy based forwarding, with intent
                to steer and encapsulate the data-packet accordingly upon a shortest
                path tunnel to a single remote end-point.
            	  </t>

            	  <t>Requirements: </t>
            	  <t>For redirect to shortest path tunnel it is required that the
                tunnel MUST be operational and allow packets to flow between
                tunnel head- and tail-end.</t>

                <t>Example: Indirection-ID community "ID-Type" which can be used: </t>
                <ul>
                  <li>0 (localised ID): When the intent is to use a localised
                  Indirection-id table, configured through out-of-band
                  procedures.</li>
                  <li>1 or 2 (Node ID's): This type can be used when the goal is to
                  use MPLS based Segment Routing towards a remote destination.
                  In this use-case scenario the flowspec rule contains a SR (Segment
                  Routing) node SID to steer traffic towards.</li>
                </ul>
            </section>

            <section>
             <name>Redirection to path-engineered tunnels</name>

             	<t>Description: </t>

               <t>The second use-case describes an example where a single
               flowspec route is sent from a BGP flowspec controller to many
               BGP flowspec clients. This BGP flowspec route carries policy information
               to steer traffic upon a path-engineered tunnel. It is assumed that
               the path engineered tunnels are configured using out-of-band from BGP
               flowspec.</t>

               <t>Segment Routing Example: </t>

          	    <t>For this example the indirection-id "ID-Type" points towards a Segment
               Routing Binding SID. The Binding SID is a segment identifier value
               (as per segment routing definitions in
               <xref target="RFC8402"/>)
         	    used to associate an explicit path. The Binding SID and the associated
               path engineered tunnel may for example be setup by a controller using
               BGP as specified in <xref target="SR-TE"></xref> or alternately by using PCEP as detailed in
               <xref target="RFC8664"/>.
         	    To conclude, when a BGP speaker at some point in time receives a
               flowspec route with an extended "Redirect to indirection-id' community,
               it installs a policy-based forwarding rule to redirect packets onto
         	    an explicit path, associated with the corresponding Binding SID.
         	    The encoding of the Binding SID within the "Redirect to indirection-id"
               extended community is specified in section 4.</t>

           	<t>Requirements: </t>
             <t>For redirect to path engineered tunnels it is required that the
             tunnel MUST be operational and allow packets to flow over the
             engineered path between tunnel head- and tail-end.</t>

             <t>Example: Indirection-ID community "ID-Type" to be used: </t>
             <ul>
               <li>0 (localised ID): When the intent is to policy-based steer traffic
               using Indirection. The engineered path is configured
               through out-of-band procedures and uses the 32-bit Indirection-id
               as local anchor point on the local flowspec client.</li>
               <li>3 or 4 (Binding Segment ID's): This type can be used when the goal is to
               use MPLS based Segment Routing towards an out-of-band configured
               explicit path.</li>
               <li>5 (Tunnel ID): When the intent is to policy-based steer traffic
               using a global tunnel-id. The engineered path is configured
               through out-of-band procedures and uses the 32-bit Indirection-id
               as global anchor point on the local flowspec client.</li>
             </ul>
               </section>

         <section>
           <name>Redirection to complex dynamically constructed tunnels</name>

         	<t>Description: </t>

             	<t>A third use-case describes the application and redirection towards
               complex dynamically constructed tunnels. For this use-case a BGP flowspec
               controller injects a single flowspec route with two unique
               "Redirect to indirection-id" communities attached, each community
               tagged with a different Sequence-ID (S-ID). A flowspec client should use the
         		  Sequence-ID (S-ID) to sequence the received flowspec redirect information.
               A potential use-case scenario would for example be the dynamic construction
               of Segment Routing Central Egress Path Engineered tunnel
               <xref target="RFC9087"/> or next-next-hop tunnels.</t>

               <t>Segment Routing Example: </t>

         	    <t>i.e. a classic Segment Routing example using complex tunnels is found
               in DDoS mitigation and traffic offload. Suspicious traffic
               (e.g. dirty traffic flows) may be policy-based routed into a
               purpose built Segment Routing Central Egress Path Engineered tunnel
               <xref target="RFC9087"/>. For this complex dynamic redirect tunnel
               construct, a first "Redirect to indirection-id" (i.e. S-ID=0) may be
               used to redirect traffic into a tunnel towards a particular
         		  egress router, while a second "Redirect to indirection-id" (i.e. S-ID=1) is
               used to steer traffic beyond the particular egress router towards a
               pre-identified interface/peer. From data-plane perspective, the
         			principles documented by <xref target="RFC9087"/> are valid for this
               use case scenario.</t>

           	<t>Requirements: </t>

           	<t>To achieve redirection towards complex dynamically constructed tunnels,
             multiple "Redirect to indirection-id" communities are imposed upon the flowspec
             route. The "Redirect to indirection-id" communities should be sequenced
             using the Sequence ID (S-ID).
             For redirect to complex dynamic engineered tunnels the
             tunnel MUST be operational and allow packets to flow over the
             engineered path between tunnel head- and tail-end.</t>

         	  <t>Example: Indirection-ID community "ID-Type" to be used: </t>
            <ul>
              <li>0 (localised ID) with S-ID: When the intent is to construct a
                   dynamic engineered tunnel, then a sequence of localised
                   indirection-ids may be used. The Sequence ID (S-ID) MUST be
                   used to sequence multiple "Redirect to indirection-id" actions to
                   construct a more complex engineered tunnel. The creation
                   of the localised indirection-id table is operationalised out-of-band
                   and is outside scope of this document.</li>
            </ul>
            </section>
         </section>

             <section title="Redirect to indirection-id Community">
               <t>This document defines a new transitive BGP extended community known
                 as "FlowSpec Redirect to indirection-id Extended Community" with the
                 Type and the Sub-Type field to be assigned by IANA. The format
                 of this extended community is show in Figure 1.
               </t>

               <figure anchor="Extended-Community" align="center">
                 <name>Extended-Community</name>
                 <artwork align="center">
         	  <![CDATA[
   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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Type          | Sub-Type      | Flags(1 octet)|    ID-Type    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                  Generalized indirection_id                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         ]]>
                 </artwork>
               </figure>

               <t>
         	The meaning of the extended community fields are as follows:
               </t>
          <ul>
            <li>Type: 1 octet to be assigned by IANA.</li>
            <li>Sub-Type: 1 octet to be assigned by IANA.</li>
          	<li>Flags: 1 octet field. Following Flags are defined.</li>
          </ul>

               <figure anchor="Flags" align="center">
                 <name>Flags</name>
                 <artwork align="center">
         	  <![CDATA[

  0             1
  0 1 2 3 4 5 6 7
  +-+-+-+-+-+-+-+-+
  | RES | S-ID  |C|
  +-+-+-+-+-+-+-+-+
                         ]]>
                 </artwork>
               </figure>


               <t>The least-significant Flag bit is
         	defined as the 'C' (or copy) bit. When the 'C' bit is set the
         	redirection applies to copies of the matching packets and not to the
         	original traffic stream.
               </t>

               <t>The 'S-ID' field identifies a 4 bit Sequence ID field. This field is
         	used to provide a flowspec client an indication
         	how and where to sequence the received indirection-ids. The Sequence ID
           value 0 indicates that Sequence ID field is NOT set and all other sequence
           ID's SHOULD be ignored. A single flowspec rule MUST NOT have more as one
           indirection-id per S-ID. On a flowspec client the indirection-id with
           lowest S-ID MUST be imposed first for any given flowspec entry. </t>

               <t>All bits other than the 'C' and 'S-ID' bits
         	MUST be set to 0 by the originating BGP speaker and ignored by
         	receiving BGP speakers.</t>

          <t>
         	ID-Type: 1 octet value. This draft defines following Context
         	Types:
          </t>

          <ul>
          	<li>
          	  0 - Localised ID (The flowspec client uses the received 32-bit indirection-id
              to lookup forwarding information within the localised indirection-id
              table. The allocation and programming of the localised
              indirection-id table is outside scope of the document)
          	</li>

         	<li>
         	  1 - Node ID with SID/index in MPLS-based Segment Routing (This means the
             32-bit indirection-id is mapped to an MPLS label using the index as
             a global offset in the SID/label space)
         	</li>

           <li>
         	  2 - Node ID with SID/label in MPLS-based Segment Routing (This means
             the 32-bit indirection-id is mapped to an MPLS label using the 32-bit
             indirection-id as global label)
         	</li>

         	<li>
         	  3 - Binding Segment ID with SID/index in MPLS-based Segment Routing (This
             means the 32-bit indirection-id is mapped to an MPLS binding label using the
             indirection-id as index for global offset in the SID/label space)
             <xref target="RFC8402"/>
         	</li>

           <li>
         	  4 - Binding Segment ID with SID/label in MPLS-based Segment Routing (This means
             32-bit indirection-id is mapped to an MPLS binding label using the 32-bit
             indirection-id as global label) <xref target="RFC8402"/>
         	</li>

           <li>
         	  5 - Tunnel ID (Tunnel ID is within a single administrative domain a
             32-bit globally unique tunnel identifier. The allocation and programming of
             the Tunnel ID within the localised indirection-id table is outside
             scope of the document)
         	</li>
         </ul>

           <t>Generalized indirection_id: 32-bit identifier used as indirection_id
           </t>
              </section>

          <section title="Redirect using localised indirection-id mapping table">
            <t>When a BGP flowspec client receives a flowspec policy route with
            a "Redirect to indirection-id" extended community attached, and the
            route represents the best BGP path, it will install a flowspec
            policy-based forwarding rule matching the tupples described
            by the flowpsec NLRI field and consequently redirects the flow (C=0) or
            copies the flow (C=1) using the information identified by the
            "Redirect to indirection-id" community.</t>
           </section>

           <section title="Validation Procedures">
            <t>The validation check described in <xref target="RFC8955"/>
            SHOULD be applied by
            default by a flowspec client, for received flowspec policy routes
            containing a "Redirect to indirection-id" extended community. This
            results that a flowspec route with a destination prefix subcomponent
            SHOULD NOT be accepted from an EBGP peer unless that peer also
            advertised the best path for the matching unicast route.
            </t>

            <t>While it MUST NOT happen, and is seen as invalid combination, it
            is possible from a semantics perspective to have multiple clashing
            redirect actions defined within a single flowspec rule. For best
            and consistant compatibility with legacy implementations, the
            redirect functionality as documented by rfc8955 MUST NOT be broken,
            and hence when a clash occurs, then rfc8955 based redirect MUST
            take priority. Additionally, if the "Redirect to indirection-id"
            does not result in a valid redirection, then the flowspec
            rule MUST be processed as if the "Redirect to indirection-id" community
            was not attached to the flowspec route. In addition the flowspec client
            MUST provide an indication that the respective "'Redirect to
            indirection-id" resulted in an invalid redirection action.
          </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>This document requests a new Transitive Extended Community Type and
        a new registery sub-type. The new Transitive Extended Community Type
        name shall be "FlowSpec Redirect to indirection-id Extended
        Community (Sub-Types are defined in the "FlowSpec Redirect to
        indirection-id Extended Community Sub-Type" registery)".
        The name of the new Sub-type registery shall
        be “FlowSpec Redirect to indirection-id Extended Community Sub-Type”</t>

      <t>Under "Transitive Extended Community:"
      </t>

      <t>
    	Registry: "FlowSpec Redirect to indirection-id Extended Community
     (Sub-Types are defined in the "FlowSpec Redirect to indirection-id
     Extended Community Sub-Type" registery)"
      </t>

      <t>
	    Registration Procedure(s): First Come, First Served
      </t>

      <t>0x09	FlowSpec Redirect to indirection-id Extended Community
      </t>

      <t>
	    New Sub-Type Registry: "FlowSpec Redirect to indirection-id Extended
      Community Sub-Type"
      </t>

      <figure anchor="IANA-Flags" align="center">
        <name>IANA-Flags</name>
          <artwork>
        <![CDATA[
  Value    Code                                   Reference
  0x00     Flowspec Redirect to 32-bit Path-id    RFC-To-Be
        ]]>
          </artwork>
      </figure>
    </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>A system using "Redirect to indirection-id" extended community
        can cause during the redirect mitigation of a DDoS attack
        overflow of traffic received by the mitigation infrastructure.</t>
    </section>

    <!-- NOTE: The Acknowledgements and Contributors sections are at the end of this template -->
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8402.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8955.xml"/>
        <!-- The recommended and simplest way to include a well known reference -->

      </references>

      <references>
        <name>Informative References</name>

        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8664.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9087.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9256.xml"/>

              <reference anchor='SR-TE'>
        	<front>
        	  <title>Advertising Segment Routing Policies in BGP</title>
        	  <author initials='K.' surname='Talaulikar'></author>
        	  <author initials='C.' surname='Filsfils'></author>
          	  <author initials='S.' surname='Previdi'></author>
          	  <author initials='D.' surname='Jain'></author>
          	  <author initials='P.' surname='Mattes'></author>
        	  <author initials='S.' surname='Lin'></author>
        	  <date month='July' year='2022' />
        	</front>
              </reference>
      </references>
    </references>


    <section anchor="Acknowledgements" numbered="false">
      <!-- [REPLACE/DELETE] an Acknowledgements section is optional -->
      <name>Acknowledgements</name>
      <t>This document received valuable comments and input from IDR
      working group including Adam Simpson, Mustapha Aissaoui, Jan Mertens,
      Robert Raszuk, Jeff Haas, Susan Hares and Lucy Yong.</t>
    </section>

    <section anchor="Contributors" numbered="false">
      <!-- [REPLACE/DELETE] a Contributors section is optional -->
      <name>Contributors</name>
      <t>The following people contributed to the content of this document and
       should be considered as co-authors:</t>
      <ul>
        <li>Arjun Sreekantiah, USA, arjunhrs@gmail.com</li>
        <li>Nan Wu, Huawei Technologies, China, eric.wu@huawei.com</li>
        <li>Shunwan Zhuang, Huawei Technologies, China, zhuangshunwan@huawei.com</li>
        <li>Wim Henderickx, Nokia Antwerp, Belgium, wim.henderickx@nokia.com</li>
      </ul>
    </section>

 </back>
</rfc>
