<?xml version="1.0" encoding="utf-8"?>
<?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-haas-idr-path-attribute-filtering-00"
  ipr="trust200902"
  submissionType="IETF"
  xml:lang="en"
  version="3">

  <front>
    <title abbrev="Path Attribute Filtering">BGP-4 Path Attribute Filtering Capability</title>

    <seriesInfo name="Internet-Draft" value="draft-haas-idr-path-attribute-filtering-00"/>
   
    <author fullname="Jeffrey Haas" initials="J." surname="Haas">
      <organization>HPE</organization>
      <address>
        <postal>
          <street>1133 Innovation Way</street>
          <city>Sunnyvale</city>
          <region>CA</region>
          <code>94089</code>
          <country>USA</country>
        </postal>
        <phone/>
        <email>jhaas@juniper.net</email>
      </address>
    </author>

    <author fullname="John Scudder" initials="J." surname="Scudder">
      <organization>HPE</organization>
      <address>
        <postal>
          <street>1133 Innovation Way</street>
          <city>Sunnyvale</city>
          <region>CA</region>
          <code>94089</code>
          <country>USA</country>
        </postal>
        <phone/>
        <email>jgs@juniper.net</email>
      </address>
    </author>
   
    <date year="2025"/>

    <area>Routing</area>
    <workgroup>Internet Engineering Task Force</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</keyword>

    <abstract>
      <t>Path Attributes in the BGP-4 protocol [RFC 4271] carry data associated
      with BGP routes.  Many of the Path Attributes carried in BGP are
      intended for limited scope deployment.  However, the extension mechanism
      defined by BGP that carries these attributes often carries them farther
      than necessary, sometimes with unfortunate results.</t>

      <t>This document defines a mechanism using BGP Capabilities [RFC 5492]
      that permits eBGP speakers to determine what Path Attributes should be
      permitted to cross external BGP routing boundaries.</t>
    </abstract>
 
  </front>

  <middle>
    
    <section>
      <name>Introduction</name>
      <t>A BGP Route (<xref target="RFC4271" section="1.1"/>)
      is a tuple consisting of a set of Path Attributes
      (<xref target="RFC4271" section="5"/>) and sets of network reachability
      carried as Network Layer Reachability Information (NLRI).  Some of these
      Path Attributes are defined as part of the core BGP-4 protocol.  Path
      Attributes are the main extension mechanism defined by BGP, and may be
      scoped as "transitive" or "non-transitive." </t>

      <t>Non-Transitive Path Attributes require the BGP speaker to understand the
      attribute in order to determine if it will be locally used and perhaps
      later propagated to additional BGP speakers.  Unrecognized non-transitive
      Path Attributes are discarded by the receiving BGP speaker.</t>

      <t>Transitive Path Attributes, when not understood by the receiving BGP
      speaker, are required to be propagated to other BGP speakers.</t>

      <t>Some Path Attributes defined by BGP extensions are intended to be used
      in limited scopes, such as a single BGP Autonomous System (AS).  When such
      attributes are distributed beyond the expected scope, this is called an
      <xref target="I-D.haas-idr-bgp-attribute-escape">"Attribute Escape"</xref>.
      Such attribute escapes may lead to improper BGP protocol behavior when
      received outside of their expected scope, and may lead to incorrect
      forwarding, or be a serious security consideration.</t>

      <t>This document defines a mechanism exchanged through 
      <xref target="RFC5492">BGP Capabilities</xref>
      where BGP speakers can more appropriately scope both Path Attributes to
      prevent escape, and to limit the distribution of routes that
      carry escaped Path Attributes.</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>BGP Path Attribute Filtering Capability</name>
      <t>The BGP Path Attribute Filtering Capability is encoded as follows:</t>
      <ul spacing="compact">
        <li>Capability Code of (TBD).</li>
        <li>Capability Length of 1..32.</li>
        <li>Capability Value contains a bit-string where a bit is set if the
        underlying BGP Path Attribute is desired to be advertised by this BGP
        speaker to the remote BGP speaker.</li>
      </ul>
      <figure>
      <artwork>
          Example encoding for Capability Value:

 0                   1                   2
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0|1|1|1|1|0|1|1|1|0|0|0|0|0|1|1|0|1|1|0|0|0|0|0|0|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 Bits are set for Path Attributes:

   Origin (1),
   AS_PATH (2),
   NEXT_HOP (3),
   MULTI_EXIT_DISCR (4),
   ATOMIC_AGGREGATE (6),
   AGGREGATOR (7),
   COMMUNITIES (8),
   MP_REACH_NLRI (14),
   MP_UNREACH_NLRI (15),
   AS4_PATH (17),
   AS4_AGGREGATOR (18).
      </artwork>
      </figure>
      <t>Bits 1, 2, 3, 6, 7, 14, 15, 17, 18 MUST be set, because support for
      <xref target="RFC4271"/>, <xref target="RFC4760"/>, and
      <xref target="RFC6783"/> procedures are required when this specification
      is in use.</t>

    </section>

    <section>
      <name>Operation</name>

      <section>
        <name>If both eBGP speakers exchange the Path Attribute Filtering capability</name>

        <t>The intersection of the sent and the received Path Attribute
        Filtering capabilies's bits represents the set of Path Attributes that
        the BGP speakers are willing to exchange with each other.  When both
        bits for a given Path Attribute Type Code are 1, the Path Attribute is
        negotiated; otherwise it is not negotiated.</t>

        <t>Routes with Path Attributes that have been negotiated MAY be
        exchanged between both BGP speakers, depending on the procedures
        associated with those Path Attributes.</t>

        <t>When a Path Attribute has not been negotiated, a BGP speaker MUST NOT
        send a BGP route that contains a Path Attribute for that Path Attribute
        Type Code.</t>

        <t>One strategy to accomplish the above requirement is for the BGP
        speaker to not advertise BGP routes containing that Path Attribute in
        question.  This might require a withdraw to be sent instead.  This is
        similar to treat-as-withdraw as defined in
        <xref target="RFC7606"/>.</t>

        <t>Another strategy that could be used, when appropriate for the
        procedure covering a given BGP Path Attribute, is for the BGP speaker
        to remove the not negotiated Path Attributes when it distributes the
        route to the remote BGP speaker.  This is similar to the Attribute
        Discard behavior defined in <xref target="RFC7606"/>.</t>

        <t>Receiving BGP speakers SHOULD filter routes or discard unwanted Path
        Attributes if they are incorrectly sent by the remote BGP speaker.
        Minimally, a receiving BGP speaker receiving a Path Attribute that was
        not negotiated SHOULD use treat-as-withdraw procedures.  Receiving BGP
        speakers MAY accept the route and discard the not negotiated Path
        Attribute if permitted to by local configuration.</t>
      </section>

      <section>
        <name>If only one peer supports the Path Attribute Filtering capability</name>

        <t>When only one BGP speaker supports or sends the Path Attribute
        Filtering capability that BGP implementation is demonstrating a
        preference to not receive Path Attributes where the bit representing the
        Path Attribute Type Code is zero.  It is, in fact, representing a
        filtering policy for routes containing those Path Attributes.</t>

        <t>BGP speakers sending a Path Attribute Filtering capability
        but not receiving one from the remote BGP speaker SHOULD filter the
        routes according to their own locally set and supported bits for the
        capability, as described in the final paragraph of the previous subsection.</t>
      </section>
    </section>

    <section>
      <name>Selecting supported Path Attributes</name>

      <t>Implementations MUST, as described in Figure 1, exchange the
      required bits covering required core eBGP Path Attributes.</t>

      <t>Common BGP features that are defined for Internet use SHOULD be
      included by default between two BGP speakers.  These include:</t>

      <ul spacing="compact">
        <li>Communities (8)</li>
        <li>Extended Communities (16)</li>
        <li>Large BGP Communities (32)</li>
        <li>BGPsec_Path (33)</li>
        <li>Only To Customer (OTC) (35)</li>
      </ul>

      <t>BGP features required to support a given AFI/SAFI MUST also be included
      when that address family is configured.  An example of this is the BGP-LS
      attribute (29) when the BGP-LS feature is in use.</t>

      <t>Other BGP features desiring eBGP distribution MAY include their bits in
      the capability when their procedures require it.  It is RECOMMENDED that
      this require explicit configuration to prevent attribute escape.</t>
    </section>
    
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>This document requests a new BGP Capability Code to be allocated from
      the First Come First Served range of the Capability Codes registry.</t>
    </section>
    
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>The motivation for this feature is to attempt to address the numerous
      BGP security implications where BGP Path Attributes propagate beyond
      their intended scope.</t>

      <t>The definition of a feature that limits the distribution of BGP Path
      Attributes unfortunately moves BGP's default behavior away  from "distribute unknown things
      easily" and thus hampers incremental deployment of new features.  However,
      operators have already begun indiscriminate filtering of Path Attributes
      they do not themselves require.  This feature attempts to provide a more
      flexible negotiated mode to permit such filtering while at the same time
      not completely precluding incremental deployment of new features.</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.4271.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5492.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6783.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7606.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        
      </references>
 
      <references>
        <name>Informative References</name>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.haas-idr-bgp-attribute-escape.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4760.xml"/>
       
      </references>
    </references>
    
    <section anchor="Acknowledgements" numbered="false">
      <!-- [REPLACE/DELETE] an Acknowledgements section is optional -->
      <name>Acknowledgements</name>
      <t>TBD.</t>
    </section>
    
    <section anchor="Contributors" numbered="false">
      <!-- [REPLACE/DELETE] a Contributors section is optional -->
      <name>Contributors</name>
      <t>TBD.</t>
    </section>
    
 </back>
</rfc>
