<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>  <!-- Required for schema validation and schema-aware editing -->
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="info"
  docName="draft-ietf-idr-flowspec-interfaceset-06"
  ipr="trust200902"
  obsoletes=""
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">
  <front>
    <title abbrev="flowspec-interfaceset">Applying BGP flowspec rules on a specific interface-set</title>
    <author fullname="Stephane Litkowski" initials="S" surname="Litkowski">
      <organization showOnFrontPage="true">Cisco</organization>
      <address>
	<email>slitkows.ietf@gmail.com</email>
      </address>
    </author>
    <author fullname="Adam Simpson" initials="A" surname="Simpson">
      <organization>Nokia</organization>
      <address>
        <email>adam.1.simpson@nokia.com</email>
      </address>
    </author>
    <author fullname="Keyur Patel" initials="K" surname="Patel">
      <organization>Arrcus, Inc</organization>
      <address>
        <email>keyur@arrcus.com</email>
      </address>
    </author>
    <author fullname="Jeffrey Haas" initials="J" surname="Haas">
      <organization>HPE</organization>
      <address>
        <email>jhaas@juniper.net</email>
      </address>
    </author>
    <date year="2025"/>
    <area/>
    <workgroup>Inter-Domain Routing</workgroup>
    <!-- <keyword/> -->
    <abstract>
      <t>
	The BGP Flow Specification (flowspec) Network Layer Reachability Information (BGP NLRI)
	extension (<xref target="RFC8955"/>) is used to distribute traffic flow specifications into
	BGP.  The primary application of this extension is the distribution of traffic filtering
	policies for the mitigation of distributed denial of service (DDoS) attacks.
      </t>
      <t>
	By default, flow specification filters are applied on all forwarding interfaces that are
	enabled for use by the BGP flowspec extension.  A network operator may wish to apply a given
	filter selectively to a subset of interfaces based on an internal classification scheme.
	Examples of this include "all customer interfaces", "all peer interfaces", "all transit
	interfaces", etc.
      </t>
      <t>
	This document defines BGP Extended Communities (<xref target="RFC4360"/>) that permit such
	filters to be selectively applied to sets of forwarding interfaces sharing a common group
	identifier.  The BGP Extended Communities carrying this group identifier  are referred to as
	the BGP Flowspec "interface-set" Extended Communities.
      </t>
    </abstract>
  </front>
  <middle>
    <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>

    <section anchor="problem-statement" title="Use case">
      <t>
	While a network may provide connectivity to a homogenous class of users, it often provides
	connectivity to different groups of users.  The nature of these different groups, and how
	they're classified, varies based on the purpose of the network.  In an enterprise network,
	connectivity may exist between data centers, offices, and external connectivity.  In a
	virtual private networking (VPN) network, it may consist of customers in different sites
	connected through a VPN, the provider core network, and external networks such as the
	Internet.  In a traditional Internet service provider (ISP) network, the network may consist
	of points of presence (POPs), internal infrastructure networks, customer networks, peer
	networks, and transit networks.
      </t>
      <t>
	The BGP flowspec extension permits traffic filters to be distributed to routers throughout a
	network.  However, these filters often should not be uniformly applied to all network
	interfaces.  As an example, a rate-limiting filter applied to the SMTP protocol may be
	applied to customer networks, but not other networks.  Similarly, a DDoS attack on the SSH
	protocol may be deemed appropriate to drop at upstream peering routers but not customer
	routers.
      </t>
      <t>
	By default, BGP flowspec filters are applied at all interfaces that permit flowspec filters
	to be installed.  What is needed is a way to selectively apply those filters to subsets of
	interfaces in a network.
      </t>
    </section>
    <section anchor="proposal" title="Interface specific filtering using BGP flowspec">
      <t>
	The uses case detailed above require application of different BGP flowspec rules on
	different sets of interfaces.
      </t>
      <t>
	We propose to introduce, within BGP flowspec, a traffic filtering scope that identifies a
	group of interfaces where a particular filter should be applied.
	Identification of interfaces within BGP flowspec will be done through group identifiers. A
	group identifier marks a set of interfaces sharing a common administrative property.
	Like a BGP community, the group identifier itself does not have any significance. It is up
	to the network administrator to associate a particular meaning to a group identifier value
	(e.g. group ID#1 associated to Internet customer interfaces).
	The group identifier is a local interface property. Any interface may be associated with one
	or more group identifiers using manual configuration.
      </t>
      <t>
	When a filtering rule advertised through BGP flowspec must be applied only to particular
	sets of interfaces,
	the BGP flowspec BGP UPDATE will contain the identifiers associated with the relevant sets
	of interfaces.
	In addition to the group identifiers, it will also contain the direction the filtering rule
	must be applied in (see <xref target="extct"/>).
      </t>
      <t>
	Configuration of group identifiers associated to interfaces may change over time.
	An implementation MUST ensure that the filtering rules (learned from BGP flowspec) applied
	to a particular interface are always updated when the group identifier mapping is changing.
      </t>
      <t>
	As an example, we can imagine the following design :
      </t>
      <ul>
	<li>
	  Internet customer interfaces are associated with group-identifier 1.
	</li>
	<li>
	  VPN customer interfaces are associated with group-identifier 2.
	</li>
	<li>
	  All customer interfaces are associated with group-identifier 3.
	</li>
	<li>
	  Peer interfaces are associated with group-identifier 4.
	</li>
	<li>
	  Transit interfaces are associated with group-identifier 5.
	</li>
	<li>
	  All external provider interfaces are associated with group-identifier 6.
	</li>
	<li>
	  All interfaces are associated with group-identifier 7.
	</li>
      </ul>
      <t>
	If the service provider wants to deploy a specific inbound filtering on external provider
	interfaces only, the provider can send the BGP flow specification using group-identifier 6
	for the inbound direction.
      </t>
      <t>
	There are some cases where nodes are dedicated to specific functions (Internet peering,
	Internet Edge, VPN Edge, Service Edge ...), in this kind of scenario, there is an interest
	for a constrained distribution of filtering rules that are using the interface specific
	filtering.  Without the constrained route distribution, all nodes will received all the
	filters even if they are not interested in those filters.  Constrained route distribution of
	flowspec filters would allow for a more optimized distribution.
      </t>
    </section>
    <section anchor="extct" title="Interface-set extended community">
      <t>
	This document proposes a new BGP Route Target extended community called the "flowspec
	interface-set". This document expands the definition of the Route Target extended
	community to allow a new value of high order octet (Type field) to be 0x07 for the
	transitive flowspec interface-set extended community, or 0x47 for the non-transitive
	flowspec interface-set extended community.  These are in addition to the values specified in
	<xref target="RFC4360"/>.
      </t>
      <t>
       This new BGP Route Target extended community is encoded as follows :
      </t>
      <figure><artwork>

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | 0x07 or 0x47  |      0x02     |    Autonomous System Number   :
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   :     AS Number (cont.)         |O|I|      Group Identifier     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


      </artwork></figure>
      <t>
        The Autonmous System number should be the locally configured AS number, or AS_TRANS
	(<xref target="RFC6793" section="9" sectionFormat="comma"/>) if the local AS number cannot
	be encoded in two octets.  This AS number MAY be used by the BGP speaker for local policy
	purposes.
      </t>
      <t>
	The flags are :
      </t>
      <ul>
	<li>
	  O : If set, the flow specification rule MUST be applied in outbound direction to the
	  interface-set referenced by the following group-identifier.
	</li>
	<li>
	  I : If set, the flow specification rule MUST be applied in inbound direction to the
	  interface-set referenced by the following group-identifier.
	</li>
      </ul>
      <t>
	Both flags can be set at the same time in the interface-set extended community leading to
        flow rule to be applied in both directions. An interface-set extended community with both
        flags set to zero MUST be treated as an error and as consequence, the flowspec route is
	malformed and MUST be given treat-as-withdraw behavior
	(<xref target="RFC7606" section="2" sectionFormat="comma"/>).
      </t>
      <t>
	The Group Identifier is encoded as a 14-bit number, values 0..16383.
      </t>
      <t>
	Multiple instances of the interface-set extended community may be present in a BGP UPDATE.
	This may occur if the flowspec rule needs to be applied to multiple sets of interfaces.
      </t>
      <t>
	Multiple instances of the extended community in a BGP UPDATE MUST be interpreted as an "OR" operation.
	For example, if a BGP UPDATE contains two interface-set extended communities with group ID 1
	and group ID 2, the filter would need to be installed on interfaces belonging to Group ID 1
	or Group ID 2.
      </t>
      <t>
	Similar to using a Route Target extended community, route distribution of flowspec NLRI with
	interface-set extended communities may be subject to constrained distribution as defined in
	<xref target="RFC4684"/>.
      </t>
    </section>
    <section anchor="scaling" title="Scaling of per-interface rules">
      <t>
	In the absence of an interface-set extended community, a flowspec filter is applied to all
	flowspec enabled interfaces.  When interface-set extended communities are present, different
	interfaces may have different filtering rules, with different terms and actions.
	These differing rules may make it harder to share forwarding instructions within the
	forwarding plane.
      </t>
      <t>
	Flowspec implementations supporting the interface-set extended community SHOULD take care to
	minimize the scaling impact in such circumstances.  How this is accomplished is out of the
	scope of this document.
      </t>
    </section>
    <section anchor="operation" title="Deployment Considerations">
      <section title="Add-Paths">
	<t>
	  There are some cases where a particular BGP flowspec NLRI may be advertised to different
	  interface groups with a different action.
	  For example, a service provider may want to discard all ICMP traffic from customer interfaces
	  to infrastructure addresses and want to rate-limit the same traffic when it comes from some
	  internal platforms.  These particular cases require ADD-PATH (<xref target="RFC7911"/>) to
	  be deployed in order to ensure that all paths (NLRI+interface-set group-id+actions) are
	  propagated within the BGP control plane.  Without ADD-PATH, only a single
	  "NLRI+interface-set group-id+actions" will be propagated, so some filtering rules will never
	  be applied.
	</t>
      </section>
      <section title="Inter-domain Considerations">
	<t>
	  The Group Identifier used by the interface-set extended community has local significance to
	  its provisioning Autonomous System.  While <xref target="RFC8955"/> permits inter-as
	  advertisement of flowspec NLRI, care must be taken to not accept these communities when they
	  would result in unacceptable filtering policies.
	</t>
	<t>
	  Filtering of interface-set extended communities at Autonomous System border routers
	  (ASBRs) may thus be desirable.
	  <!-- XXX JMH - should we ignore an interface-set unless it's for an AS number that's us? -->
	</t>
	<t>
	  Note that the default behavior without the interface-set feature would to have been to
	  install the flowspec filter on all flowspec enabled interfaces.
	</t>
      </section>
    </section>
    <section anchor="Security" title="Security Considerations">
      <t>
	This document extends the Security Considerations of <xref target="RFC8955"/> by permitting
	flowspec filters to be selectively applied to subsets of network interfaces in a particular
	direction.  Care must be taken to not permit the inadvertant manipulation of the
	interface-set extended community to bypass expected traffic manipulation.
      </t>
    </section>
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>
	Authors would like to thanks Wim Hendrickx and Robert Raszuk for their valuable comments.
      </t>
    </section>
    <section anchor="IANA" title="IANA Considerations">
      <section title="FlowSpec Transitive Extended Communities">
	<t>
	  This document requests a new type from the "BGP Transitive Extended Community Types"
	  extended community registry from the First Come First Served range.
	  This type name shall be 'FlowSpec Transitive Extended Communities'.
	  IANA has assigned the value 0x07 to this type.
	</t>
	<t>
	  This document requests creation of a new registry called "FlowSpec Transitive Extended
	  Community Sub-Types".
	  This registry contains values of the second octet (the "Sub-Type" field) of an extended
	  community when the value of the first octet (the "Type" field) is the value allocated in
	  this document.
	  The registration procedure for values in this registry shall be First Come First Served.
	</t>
      </section>
      <section title="FlowSpec Non-Transitive Extended Communities">
	<t>
	  This document requests a new type from the "BGP Non-Transitive Extended Community Types"
	  extended community registry from the First Come First Served range.
	  This type name shall be 'FlowSpec Non-Transitive Extended Communities'.
	  IANA has assigned the value 0x47 to this type.
	</t>
	<t>
	  This document requests creation of a new registry called "FlowSpec Non-Transitive Extended
	  Community Sub-Types".
	  This registry contains values of the second octet (the "Sub-Type" field) of an extended
	  community when the value of the first octet (the "Type" field) is the value allocated in
	  this document.
	  The registration procedure for values in this registry shall be First Come First Served.
	</t>
      </section>
      <section title="FlowSpec interface-set Extended Community">
	<t>
	  Within the two new registries above, this document requests a new subtype (suggested value
	  0x02). This sub-type shall be named "interface-set", with a reference to this document.
	</t>
      </section>
      <section title="Allocation Advice to IANA">
	<t>
	  IANA is requested to allocate the values of the FlowSpec Transitive and Non-Transitive
	  Extended Communities such that their values are identical when ignoring the second
	  high-order bit (Transitive).  See section 2, <xref target="RFC4360"/>.
	</t>
	<t>
	  It is suggested to IANA that, when possible, allocations from the FlowSpec
	  Transitive/Non-Transitive Extended Community Sub-Types registries are made for transitive or
	  non-transitive versions of features (section 2, <xref target="RFC4360"/>) that their code
	  point in both registries is identical.
	</t>
      </section>
    </section>
  </middle>
  <back>
    <references title="Normative References">
      <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.4360.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.7911.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8955.xml"/>
    </references>
    <references title="Informative References">
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4684.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6793.xml"/>
    </references>
    <section>
      <name>Contributors</name>
      <contact fullname="Lucy Yong" initials="L" surname="Yong">
	<organization>Huawei</organization>
	<!-- address>
	  <email>lucy.yong@huawei.com</email>
	</address -->
      </contact>
    </section>
  </back>
</rfc>
