<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2578 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2578.xml">
<!ENTITY RFC4271 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4271.xml">
<!ENTITY RFC5492 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5492.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8955 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8955.xml">
<!ENTITY RFC8956 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8956.xml">
<!ENTITY FLOWSPECV2 SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.hares-idr-flowspec-v2.xml">
<!ENTITY EXTOPT SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-ext-opt-param.xml">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- used by XSLT processors -->
<!-- OPTIONS, known as processing instructions (PIs) go here. -->
<!-- For a complete list and description of PIs,
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable PIs that most I-Ds might want to use. -->
<?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 popular PIs -->
<rfc category="std" docName="draft-haas-flowspec-capability-bits-02" ipr="trust200902" updates="8955">
  <front>
    <title abbrev="flowspec-capability-bits">BGP Flowspec Capability Bits</title>
    <author fullname="Jeffrey Haas" initials="J" surname="Haas">
      <organization>Juniper Networks</organization>
      <address>
        <email>jhaas@juniper.net</email>
      </address>
    </author>
    <date year="2021"/>
    <area/>
    <workgroup>Inter-Domain Routing</workgroup>
    <!-- <keyword/> -->
    <abstract>
      <t>
        BGP Flowspec (RFC 8955) provides the ability to filter traffic using various matching
	components.  The NLRI format currently defined does not permit incremental deployment of new
	BGP Flowspec components.  This draft defines a new BGP Capability to permit incremental
	deployment of such new Flowspec component types.
      </t>
    </abstract>
    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD 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 Flowspec <xref target="RFC8955"/> provides a mechanism to distribute traffic flow
	spcifications into BGP.  One general purpose of these flow specifications is for the
	distribution of firewall rules to receiving routers, particularly for mitigating distributed
	denial of service (DDoS) attacks.  The flow specification rules are encoded as BGP NLRI
	<xref target="RFC4271"/>.
      </t>
      <t>
        The matching components of a flow specification NLRI is a serialized set of optional
	components.  The components are documented in <xref target="RFC8955"/>, Section 3.
	<xref target="RFC8956"/> defines IPv6-specific components.  The full set
	of Flowspec component types is maintained in an IANA registry located at the
	<eref target="https://www.iana.org/assignments/flow-spec/flow-spec.xhtml">IANA Flow Spec
	Component Types registry</eref>.
      </t>
      <t>
	Unknown Flowspec component types require treatment as a malformed NLRI 
	(<xref target="RFC8955"/>, Section 4.2).  This is due to the lack of a mandatory length
	element for the components in the NLRI.  Without such a length, it is not possible to
	determine how to properly decode unknown components in the Flowspec NLRI.
      </t>
      <t>
        There has been active interest in the IDR Working Group to extend BGP Flowspec for
	additional purposes.  However, with this difficulty in being able to handle unknown
	components, those new features are unable to be deployed in a BGP Flowspec domain in an
	incremental fashion.  Either a carefully managed "flag day" deployment is required to avoid
	disrupting existing sessions, or the Flowspec domain is carefully managed such that devices
	with incompatible sets of known/unknown components are carefully separated in a "ships in
	the night" scenario.  Both options are fragile and operationally cumbersome.
      </t>
      <t>
        Some initial discussion has begun for a version 2 of Flowspec in 
	<xref target="I-D.hares-idr-flowspec-v2"/>.  That document may eventually address this
	incremental deployment issue, along with a number of other items.
      </t>
      <t>
        This document proposes to address the issues of incremental deployment of new BGP Flowspec
	component types via a new BGP Capability <xref target="RFC5492"/>, the BGP Flowpec
	Capability Bits.
      </t>
    </section>
    <section title="BGP Flowspec Capability Bits">
      <t>
	BGP Flowspec component types are one octet in length with values in the  range from 0..255.
	The BGP Flowspec Capability Bits encode a bit-string where each supported component type has
	its respective bit set when the BGP Speaker is willing to receive BGP Flowspec NLRI that
	contain that component type.
      </t>
      <t>
        The BGP Flowspec Capability Bits Capability is encoded as follows:
	<list style="symbols">
	  <t>Capability Code of (TBD).</t>
	  <t>Capability Length of 1..32.</t>
	  <t>Capability Value contains a bit-string where a bit is set if the underlying BGP
	  Flowspec component is willing to be accepted by BGP Speaker advertising this
	  capability.</t>
	</list>
      </t>
      <t>
        <figure>
	<artwork>
            Example encoding for Capability Value:

              0                   1
              0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |0|1|1|1|1|1|1|1|1|1|1|1|1|1|0|0|
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Bit 0 set to 0, bits 1..13 set to 1 showing support for all 
   capabilities for IPv6 Flowspec, bits 14 and 15 are set to 0.
        </artwork>
	</figure>
      </t>
    </section>
    <section title="Operation">
      <t>
	BGP Flowspec Capability Bits not advertised in the encoded bit-string are treated as if they
	were sent with a value of zero for that bit.
      </t>
      <t>
        The Capability Length reflects the number of octets it takes to encode the BGP Flowspec
	Capability Bits.  While the total number of octets required to represent the entire range of
	component types is only 32 octets, implementations SHOULD limit the number of octets
	transmitted to those required to encode the final one-bit.  Space in BGP Capabilities may be
	limited in some implementations depending on the number of capabilities to be sent.  (See 
	<xref target="I-D.ietf-idr-ext-opt-param"/> for discussion on a feature to address this
	point.)
      </t>
      <t>
        Bit-values 0 and 255 SHOULD be set to zero as they are RESERVED.
      </t>
      <t>
        The BGP Flowspec Capability Bits Capability SHOULD be sent by a BGP Speaker utilizing any
	AFI/SAFI using BGP Flowspec encoding as defined in <xref target="RFC8955"/>, 
	or <xref target="RFC8956"/>.
      </t>
      <t>
        The BGP Flowspec Capability Bits Capability MUST be sent by a BGP Speaker utilizing BGP
	Flowspec encoding with a component type not defined in those documents previously mentioned.
	(I.e. component types not in the range 1..13.)
      </t>
      <t>
        A BGP Speaker that has received the BGP Flowspec Capability Bits Capability MUST NOT
	originate or propagate a BGP Flowspec encoded NLRI that contains a component types that is
	not present in the received bit-string.
      </t>
      <t>
        A BGP Speaker that has received a BGP Flowspec related AFI/SAFI without this Capability MUST
	treat the absence as equivalent to having received the Capability Bits covered by the base
	specification for its defining RFC, <xref target="RFC8955"/> or <xref target="RFC8956"/>.
      </t>
    </section>
    <section title="Propagation of Known Components and Mismatch with Local Filtering Capabilities">
      <t>
        There may be circumstances where a BGP Speaker is capable of parsing Flowspec components
	that it is not capable of implementing as filters.  Section 4.2 of <xref target="RFC8955"/>
	specifies that:
	<list><t>
	  "All combinations of components within a single Flow Specification are allowed.  However,
	  some combinations cannot match any packets (e.g., "ICMP Type AND Port" will never match
	  any packets) and thus SHOULD NOT be propagated by BGP."
	</t></list>
      </t>
      <t>
        This document updates that text to:
	<list><t>
	  "All combinations of components within a single Flow Specification are allowed.  However,
	  some combinations cannot match any packets (e.g., "ICMP Type AND Port" will never match
	  any packets) and thus SHOULD NOT be propagated by BGP.
	  </t>
	  <t>
	  "When BGP Flowspec component types are understood and the operator determines that
	  deployment-wide filtering intent would not be comporomised by propagating Flowepec routes
	  that cannot match any packets, it SHOULD propagate the route in BGP.  This permits NLRI
	  with known components to be propagated to downstream BGP Speakers in the deployment."
	</t></list>
      </t>
    </section>
    <section title="BGP Flowspec Implications for Filtered NLRI">
      <t>
        BGP Flowspec NLRI encode match operations for traffic filtering rules.  Filtering is an
	ordered operation.  Since the current encoding of the NLRI does not supply explicit
	filtering order, the protocol imposes a forwarding order based on the contents of the NLRI.
      </t>
      <t>
        When a BGP Flowspec NLRI is not propagated due to filtering by this feature, or by user
	policy, there is the potential that the network-wide filtering intent may be compromised by
	the missing rules.  The exact impact of this on filtering will depend on the relative
	independence of the full set of BGP Flowspec routes in the BGP Flowspec routing domain.
      </t>
      <t>
        Operators must exercise care when deploying BGP Flowspec features with new component types
	to understand the propagation of such routes in their deployment, and the impact that
	filtering may have on the routes they wish to originate.
      </t>
    </section>

    <section title="Error Handling">
      <t>
        If a BGP Speaker implementing this document has transmitted BGP Flowspec Capability Bits to
	its peer and receives a BGP Flowspec NLRI with an unacceptable component (not in its
	bit-string), it MAY terminate the BGP session by sending a NOTIFICATION message.
      </t>
    </section>
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>
	Thanks to Aseem Choudhary, Jakob Heitz, Christoph Loibl, Robert Raszuk for their comments on
	this proposal.
      </t>
    </section>
    <section title="Security Considerations">
      <t>
        All of the Security Considerations for 
	<xref target="RFC8955"/> and <xref target="RFC8956"/>
	still apply.
      </t>
      <t>
        Additionally, the BGP Flowspec Capability Bits may cause implicit filtering of some BGP
	Flowspec NLRI in a Flowspec domain.  Depending on the relative independence of the traffic
	matched by the BGP Flowspec rules in the ordering required by their specifications, such
	filtered NLRI may result in impact to the desired domain-wide filtering behaviors.
      </t>
    </section>
    <section title="IANA Considerations">
      <t>
        IANA is requested to assign a new BGP Capability to the Capability Codes registry from the
	First Come, First Served pool.  The Reference for the registration is this document.  The
	Change Controller is IETF.
      </t>
    </section>
  </middle>
  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC5492;
      &RFC8174;
      &RFC8955;
      &RFC8956;
    </references>
    <references title="Informative References">
      &RFC2578;
      &RFC4271;
      &FLOWSPECV2;
      &EXTOPT;
    </references>
    <section title="Encoding of the Bit-String">
      <t>
        IETF has a mixed history in terms of how bit numbering is described.  The format as used in
	this document, where the left-most bit sent on the wire is bit zero, is consistent with IETF
	PDU diagrams and also the SNMP BITS construct <xref target="RFC2578"/>, Section 7.1.4.
      </t>
      <t>
        That said, the author is aware of how annoying the code for that construct can be.
      </t>
    </section>
    <section title="Open Issues">
      <t>
        <list style="symbols">
	<t>
          Are there circumstances where advertising capability bits for BGP Flowspec NLRI that need
	  to vary on a per AFI-SAFI basis?  Currently, the IANA registry is a single name space for
	  all supported and proposed BGP address families.  As an example, the Flowspec for NVO3
	  feature has components that are defined that do not have incremental deployment issues due
	  to being well formed with a length field.  However, since it still includes existing
	  Flowspec filtering for the outer and inner IP headers, the issues addressed by this
	  proposal still apply.
        </t>
	</list>
      </t>
    </section>
  </back>
</rfc>
