<?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-04"
     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>

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

    <area>Routing</area>

    <workgroup>IDR Working Group</workgroup>

    <!---->

    <abstract>
      <t>The BGP Flow Specification (BGP-FS) mechanism propagates both traffic
      Flow Specifications and Traffic Filtering Actions using the BGP NLRI and
      Extended Community encoding formats. This document specifies a new
      BGP-FS component type 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 Flow Specification (BGP-FS) <xref target="RFC8955"/> <xref
      target="RFC8956"/> defines a BGP NLRI mechanism to distribute traffic
      flow filtering rules via BGP <xref target="RFC4271"/>. BGP-FS policies
      contain match conditions (which can be n-tuple packet header matches)
      and corresponding actions that modify, forward, or drop matching
      traffic. Using BGP, filtering rules can be dynamically distributed to
      network elements without requiring manual device reconfiguration. BGP-FS
      defines Network Layer Reachability Information (NLRI) formats for IPv4
      unicast (AFI=1, SAFI=133) and BGP/MPLS VPNs (AFI=1, SAFI=134).</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
      BGP-FS component type 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>FS: Flow Specification</t>

          <t>Destination-IP-Community: The BGP Standard Community [RFC1997] or
          Extended Community associated with the reachability route of the
          destination IP address.</t>
        </list></t>
    </section>

    <section title="Flow Specification Encoding for Destination-IP-Community Filter">
      <t>This document defines a new Flow Specification component type encoded
      within the BGP Flowspec NLRI.</t>

      <t><list style="symbols">
          <t>Type TBD1: Destination-IP-Community</t>
        </list></t>

      <t>Encoding: &lt;type (1 octet), [op, value]+&gt;</t>

      <t>This component contains a set of {operator, value} pairs used to
      match the Destination-IP-Community associated with the destination
      prefix.</t>

      <t>The operator byte (numeric_op) is encoded as defined in Section 4.2.1
      of <xref target="RFC8955"/>:</t>

      <t><figure anchor="numeric_op" title="Numeric Operator (numeric_op)">
          <artwork align="center"><![CDATA[
    0   1   2   3   4   5   6   7
  +---+---+---+---+---+---+---+---+ 
  | e | a |  len  | 0 |lt |gt |eq | 
  +---+---+---+---+---+---+---+---+
]]></artwork>
        </figure></t>

      <t>Where:</t>

      <t>e - End-of-list bit. Set in the last {op, value} pair.</t>

      <t>a - AND bit. If unset, the logical operation with the previous term
      is OR. If set, the operation is AND. For the Destination-IP-Community
      filter, the 'a' bit MUST be unset (0) unless matching multi-value
      community sets.</t>

      <t>len - Length of the value field encoded as (1 &lt;&lt; len). Valid
      lengths for Standard BGP Communities <xref target="RFC1997"/> are 4
      octets (len=10). Future extensions MAY support 8 octets (Extended) or 12
      octets (Large Communities).</t>

      <t>lt - Less-than comparison between target data and value.</t>

      <t>gt - Greater-than comparison between target data and value.</t>

      <t>eq - Equality comparison between target data and value.</t>

      <t>The comparison operators (lt, gt, eq) can be combined to evaluate a
      specific community or a range of communities.</t>

      <t>The value field is encoded as:</t>

      <t><figure anchor="Destination-IP-Origin-Community"
          title="Destination-IP-Community">
          <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
  +---------------------------------------------------------------+
  ~          Destination-IP-Community  (4 octets)                 ~
  +---------------------------------------------------------------+

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

      <t>Per Section 10 of <xref target="RFC8955"/>, if a receiving BGP
      speaker does not support this component type, it MUST discard the entire
      NLRI value containing the unknown component. Because the NLRI encoding
      <xref target="RFC8955"/> uses a 2-tuple &lt;length, NLRI value&gt;
      structure, parsing engines can skip the unknown NLRI value and continue
      processing subsequent NLRIs.</t>

      <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, Extended, or Large 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 allocate a new component type entry in the "Flow
      Spec Component Types" registry under the "BGP Flow Spec NLRIs" registry
      group:</t>

      <t><figure align="center">
          <artwork><![CDATA[      +---------+--------------------------+---------------+
      |   Type  | Description              | Reference     |
      +---------+--------------------------+---------------+
      |   TBD1  | Destination-IP-Community | This Document |
      +---------+--------------------------+---------------+
  
]]></artwork>
        </figure></t>
    </section>

    <section anchor="Security Considerations" title="Security Considerations">
      <t>This specification extends BGP Flowspec NLRI matching capabilities.
      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 [RFC8955] 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'?>
    </references>

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