<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="3"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-wu-idr-flowspec-dip-community-filter-05"
     ipr="trust200902" submissionType="IETF">
  <front>
    <title abbrev="Destination-IP-Community Filter">Destination-IP-Community
    Filter for BGP Flow Specification</title>

    <author fullname="Tianhao Wu" initials="T." surname="Wu">
      <organization>Huawei</organization>

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

    <author fullname="Haibo Wang" initials="H." surname="Wang">
      <organization>Huawei</organization>

      <address>
        <email>rainsword.wang@huawei.com</email>
      </address>
    </author>

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

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

    <author fullname="Jie Dong" initials="J." surname="Dong">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>156 Beiqing Road</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>P.R. China</country>
        </postal>

        <email>jie.dong@huawei.com</email>
      </address>
    </author>

    <date day="13" month="October" year="2026"/>

    <area>Routing</area>

    <workgroup>IDR Working Group</workgroup>

    <!---->

    <abstract>
      <t>BGP Flow Specification Version 2 (FSv2) propagates both traffic Flow
      Specifications and Traffic Filtering Actions using an extensible
      TLV-based filter family architecture. This document specifies a new FSv2
      component type under the Routing Filter Family to support
      community-level filtering. The match condition evaluates the BGP
      Community attribute associated with the destination IP address encoded
      in the Flowspec NLRI. This mechanism is intended for deployment within a
      single administrative domain.</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"/> <xref target="RFC8174"/> when, and only when,
      they appear in all capitals, as shown here.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>BGP <xref target="RFC4271"/> Flow Specification, originally defined
      in <xref target="RFC8955"/> <xref target="RFC8956"/>, has evolved to
      Flow Specification Version 2 (FSv2) as specified in <xref
      target="I-D.ietf-idr-fsv2-ip-basic"/>. FSv2 introduces an extensible,
      TLV-based filter family architecture with explicit rule ordering and
      modular components.</t>

      <t>In large-scale networks, configuring individual Flowspec rules based
      on explicit destination IP prefix matches can lead to severe TCAM and
      control-plane entry scale bottlenecks. This document specifies a new
      FSv2 component type under the Routing Filter Family to support
      community-level filtering. The match field targets the BGP Community
      attribute of the destination IP prefix. This functionality is designed
      to operate within a single administrative domain.</t>

      <t/>
    </section>

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

          <t>Destination-IP-Community: The BGP Standard Community <xref
          target="RFC1997"/> associated with the reachability route of the
          destination IP address.</t>
        </list></t>
    </section>

    <section title="Flow Specification Version 2 Encoding for Destination-IP-Community Filter">
      <t>This document defines a new FSv2 component encoded within the Routing
      Filter Family (Type 1400). Unlike legacy FSv1 raw byte streams, FSv2
      utilizes explicit TLV formatting.</t>

      <t/>

      <t>This document defines a new Flow Specification component type encoded
      within the BGP Flowspec NLRI.</t>

      <t><list style="symbols">
          <t>Filter Family: 1400 (Routing Filter Family)</t>

          <t>Component Type: 300 (DIP COM)</t>
        </list></t>

      <t>Encoding format for the DIP COM component:</t>

      <t><figure anchor="Destination-IP-Origin-Community"
          title="Destination-IP-Community Filter">
          <artwork align="left"><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags |    Type (300)         |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             <[numeric_op, Destination-IP-Community]+>         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

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

      <t>Where:</t>

      <t><list style="symbols">
          <t>Flags (4 bits): Defined in FSv2 specifications.</t>

          <t>Type (12 bits): Set to 300 for DIP COM.</t>

          <t>Length (16 bits): Length of the value field in octets.</t>

          <t>&lt;[numeric_op, Destination-IP-Community]+&gt;: Contains a list
          of {numeric_op, Destination-IP-Community} pairs that are used to
          match the Destination-IP-Community.<list style="symbols">
              <t>numeric_op: This component uses the Numeric Operator
              (numeric_op) described in Section 4.1.1 of <xref
              target="I-D.ietf-idr-fsv2-ip-basic"/>, Type 300 component values
              SHOULD be encoded as 4 octets (numeric_op len=10).</t>

              <t>Destination-IP-Community (32 bits): BGP Community value to
              match.</t>
            </list></t>
        </list></t>

      <section title="Operational and Processing Mechanism">
        <t>The implementation of Destination-IP-Community filtering relies on
        a cross-coupling mechanism between the Unicast BGP Forwarding Table
        (FIB) and the Flowspec Packet Inspection Engine. The detailed
        processing workflow is defined in the following three steps:</t>

        <t><list style="numbers">
            <t>Control-Plane Community Dissemination and FIB Tagging: When a
            BGP speaker receives unicast BGP routes carrying BGP Communities
            (e.g., Standard Communities), and those routes are selected as
            best paths and installed into the Forwarding Information Base
            (FIB), the local system MUST preserve the associated BGP Community
            attributes (or a local mapped metadata tag representing the
            Community) within the corresponding FIB entries. For example:<list
                style="symbols">
                <t>FIB Entry for Destination Prefix A: Tagged with Community
                64597:1</t>

                <t>FIB Entry for Destination Prefix B: Tagged with Community
                64597:2</t>
              </list></t>

            <t>Flowspec Rule Installation: When a BGP Flowspec rule containing
            the Destination-IP-Community component is received, the system
            programs a filtering rule into the forwarding hardware. The match
            parameters include both standard RFC 8955/8956 n-tuples (e.g.,
            Destination IP, Source IP, Protocol, Port) and the target
            Community value specified in the Destination-IP-Community
            component (denoted as COMM_Rule, e.g., 64597:1).</t>

            <t>Datapath Two-Stage Packet Matching:<list style="empty">
                <t>Upon receiving a data packet:<list style="letters">
                    <t>The device evaluates the packet against installed
                    Flowspec rules.</t>

                    <t>If a candidate rule contains a Destination-IP-Community
                    match condition, the forwarding engine performs a FIB
                    lookup using the packet's Destination IP address to
                    extract the associated FIB entry's Community attribute
                    (denoted as COMM_FIB).</t>

                    <t>Evaluation:<list style="symbols">
                        <t>If COMM_FIB matches COMM_Rule (e.g., both are
                        64597:1), the Destination-IP-Community match condition
                        is satisfied, and the configured Flowspec action
                        (e.g., redirect, drop, rate-limit) is executed.</t>

                        <t>If COMM_FIB does not match COMM_Rule (e.g.,
                        COMM_FIB is 64597:2 while COMM_Rule is 64597:1), the
                        match condition fails, and packet processing continues
                        to subsequent rules or default forwarding.</t>
                      </list></t>
                  </list></t>
              </list></t>
          </list></t>
      </section>
    </section>

    <section title="Use Cases">
      <t>This section illustrates a representative operational scenario for
      community-level traffic steering. Consider the topology in <xref
      target="Redirect_the_traffic_using_Flowspec"/>.</t>

      <t><figure anchor="Redirect_the_traffic_using_Flowspec"
          title="Traffic Redirection Topology using Flowspec">
          <artwork align="center"><![CDATA[
                          +---------+
                          | BGP FS  |
                          | Server  |
                          +----|----+
                               |
                               |
                               /
                              /
                  ************/************
                  *          /            *
    IP Prefix 61  *         / AS64597     *  IP Prefix 81 (Comm 1:1)
                  *        /              *  IP Prefix 82 (Comm 1:1)
    +-------+     *  +---+/        +---+  *    +-------+
    |AS64596+--------+ R1+---------+ R2|-------+AS64598|
    +-------+     *  +-+-+\        +---+  */   +-------+
                  *        \          |\   /
                  *         \         | \ /*
                  *          \        |  /\*
                  *           \       | /  \  IP Prefix 91 (Comm 1:1)
                  *            \      |/   *\ IP Prefix 92 (Comm 1:1)
                  *             \  +-+-+  * \  +-------+
                  *              \-+ R3+-------+AS64599|
                  *                +---+  *    +-------+
                  *                       *
                  *************************


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

      <t>In AS64597, ISP operator policy requires redirecting all traffic from
      IP Prefix 61 bound for AS64598 and AS64599 to traverse R3 first.</t>

      <t>Using traditional BGP Flowspec rules, router R1 requires multiple
      "Destination Prefix + Source Prefix" filter entries:</t>

      <t><figure anchor="Using_the_traditional_method"
          title="Traditional Flowspec Redirection Rules">
          <artwork align="center"><![CDATA[
       +--------------+--------------+-------------------------+
       | Destination  | Source Prefix| Redirect to IP Nexthop  |
       | Prefix       |              |                         |
       +--------------+--------------+-------------------------+
       | IP Prefix 81 | IP Prefix 61 |           R3            |
       +--------------+--------------+-------------------------+
       | IP Prefix 82 | IP Prefix 61 |           R3            |
       +--------------+--------------+-------------------------+
       | IP Prefix 91 | IP Prefix 61 |           R3            |
       +--------------+--------------+-------------------------+
       | IP Prefix 92 | IP Prefix 61 |           R3            |
       +--------------+--------------+-------------------------+
       |                 More prefixes...                      |
       +--------------+--------------+-------------------------+

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

      <t>Using the Destination-IP-Community filter defined in this document,
      the operator configures a single "Destination Community + Source Prefix"
      rule on R1:</t>

      <t><figure anchor="Using_the_Community-level_filtering_method"
          title="Community-Level Flowspec Redirection Rule">
          <artwork align="center"><![CDATA[
      +--------------+--------------+-------------------------+
      | Destination  | Source Prefix| Redirect to IP Nexthop  |
      | Community    |              |                         |
      +--------------+--------------+-------------------------+
      |     1:1      | IP Prefix 61 |           R3            |
      +--------------+--------------+-------------------------+

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

      <t>This mechanism significantly reduces control-plane propagation state
      and hardware TCAM resource usage on network processors.</t>

      <t/>
    </section>

    <section title="IANA Considerations">
      <t>IANA is requested to make the following allocations under the BGP
      Flow Specification Version 2 (FSv2) registries defined in <xref
      target="I-D.ietf-idr-fsv2-ip-basic"/>:</t>

      <t><figure align="left">
          <artwork><![CDATA[FSv2 Routing Filter Family Component Types Registry:
+------+------------------------------------+---------------+
| Type | Description                        | Reference     |
+------+------------------------------------+---------------+
| 300  | DIP COM (Destination-IP-Community) | This document |
+------+------------------------------------+---------------+
]]></artwork>
        </figure></t>
    </section>

    <section anchor="Security Considerations" title="Security Considerations">
      <t>This specification extends BGP Flow Specification Version 2 (FSv2)
      matching capabilities. All security considerations defined in <xref
      target="I-D.ietf-idr-fsv2-ip-basic"/> apply.</t>

      <t>Unauthorized injection or modification of Destination-IP-Community
      Flowspec rules could lead to traffic misdirection, unexpected dropping,
      or Denial-of-Service (DoS) conditions.</t>

      <t>To mitigate these risks:</t>

      <t><list style="symbols">
          <t>This feature MUST be restricted to a single administrative domain
          or strictly trusted peer boundaries.</t>

          <t>BGP speakers MUST filter or strip this Flowspec component type at
          eBGP domain boundaries unless explicitly allowed by bilateral
          policy.</t>

          <t>Standard BGP Flowspec validation procedures MUST be enforced to
          prevent unauthorized prefix rule propagation.</t>
        </list></t>
    </section>

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

      <t><figure>
          <artwork align="left"><![CDATA[Jun Ge
Huawei Technologies
Email: jack.gejun@huawei.com

Xiangfeng Ding
Huawei Technologies
Email: dingxiangfeng@huawei.com

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

    <section title="Acknowledgements">
      <t>TBD.</t>
    </section>
  </middle>

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

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

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

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

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

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

    <references title="Informative References">
      <?rfc include='reference.RFC.4271'?>
    </references>
  </back>
</rfc>
