draft-ietf-idr-rfc5575bis-17.txt   draft-ietf-idr-rfc5575bis-18.txt 
IDR Working Group C. Loibl IDR Working Group C. Loibl
Internet-Draft Next Layer Communications Internet-Draft Next Layer Communications
Obsoletes: 5575,7674 (if approved) S. Hares Obsoletes: 5575,7674 (if approved) S. Hares
Intended status: Standards Track Huawei Intended status: Standards Track Huawei
Expires: December 20, 2019 R. Raszuk Expires: May 7, 2020 R. Raszuk
Bloomberg LP Bloomberg LP
D. McPherson D. McPherson
Verisign Verisign
M. Bacher M. Bacher
T-Mobile Austria T-Mobile Austria
June 18, 2019 November 4, 2019
Dissemination of Flow Specification Rules Dissemination of Flow Specification Rules
draft-ietf-idr-rfc5575bis-17 draft-ietf-idr-rfc5575bis-18
Abstract Abstract
This document obsoletes both RFC5575 and RFC7674.
This document defines a Border Gateway Protocol Network Layer This document defines a Border Gateway Protocol Network Layer
Reachability Information (BGP NLRI) encoding format that can be used Reachability Information (BGP NLRI) encoding format, that can be used
to distribute traffic Flow Specifications. This allows the routing to distribute traffic Flow Specifications. This allows the routing
system to propagate information regarding more specific components of system to propagate information regarding more specific components of
the traffic aggregate defined by an IP destination prefix. the traffic aggregate defined by an IP destination prefix.
It specifies IPv4 traffic Flow Specifications via a BGP NLRI which It also specifies BGP Extended Community encoding formats, that can
carries traffic Flow Specification filter, and an Extended community be used to propagate Traffic Filtering Actions along with the Flow
value which encodes actions a routing system can take if the packet Specification NLRI. Those Traffic Filtering Actions encode actions a
matches the traffic flow filters. The flow filters and the actions routing system can take if the packet matches the Flow Specification.
are processed in a fixed order. Other drafts specify IPv6, MPLS
addresses, L2VPN addresses, and NV03 encapsulation of IP addresses.
This document obsoletes RFC5575 and RFC7674 to correct unclear Additionally, it defines two applications of that encoding format:
specifications in the flow filters. one that can be used to automate inter-domain coordination of traffic
filtering, such as what is required in order to mitigate
(distributed) denial-of-service attacks, and a second application to
provide traffic filtering in the context of a BGP/MPLS VPN service.
Other applications (ie. centralized control of traffic in a SDN or
NFV context) are also possible. Other drafts specify IPv6, MPLS
addresses, L2VPN addresses, and NV03 encapsulation of IP addresses as
Flow Specification extensions.
Applications which use the bgp Flow Specification are: 1) application The information is carried via the BGP, thereby reusing protocol
which automate inter-domain coordination of traffic filtering, such algorithms, operational experience, and administrative processes such
as what is required in order to mitigate (distributed) denial-of- as inter-provider peering agreements.
service attacks; 2) applications which control traffic filtering in
the context of a BGP/MPLS VPN service, and 3) applications with
centralized control of traffic in a SDN or NFV context. Some
deployments of these three applications can be handled by the strict
ordering of the BGP NLRI traffic flow filters, and the strict actions
encoded in the extended community Flow Specification actions.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 20, 2019. This Internet-Draft will expire on May 7, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Definitions of Terms Used in This Memo . . . . . . . . . . . 5 2. Definitions of Terms Used in This Memo . . . . . . . . . . . 5
3. Flow Specifications . . . . . . . . . . . . . . . . . . . . . 6 3. Flow Specifications . . . . . . . . . . . . . . . . . . . . . 5
4. Dissemination of IPv4 FLow Specification Information . . . . 7 4. Dissemination of IPv4 FLow Specification Information . . . . 6
4.1. Length Encoding . . . . . . . . . . . . . . . . . . . . . 7 4.1. Length Encoding . . . . . . . . . . . . . . . . . . . . . 7
4.2. NLRI Value Encoding . . . . . . . . . . . . . . . . . . . 8 4.2. NLRI Value Encoding . . . . . . . . . . . . . . . . . . . 7
4.2.1. Type 1 - Destination Prefix . . . . . . . . . . . . . 8 4.2.1. Operators . . . . . . . . . . . . . . . . . . . . . . 7
4.2.2. Type 2 - Source Prefix . . . . . . . . . . . . . . . 8 4.2.2. Components . . . . . . . . . . . . . . . . . . . . . 9
4.2.3. Type 3 - IP Protocol . . . . . . . . . . . . . . . . 8
4.2.4. Type 4 - Port . . . . . . . . . . . . . . . . . . . . 10
4.2.5. Type 5 - Destination Port . . . . . . . . . . . . . . 10
4.2.6. Type 6 - Source Port . . . . . . . . . . . . . . . . 10
4.2.7. Type 7 - ICMP type . . . . . . . . . . . . . . . . . 11
4.2.8. Type 8 - ICMP code . . . . . . . . . . . . . . . . . 11
4.2.9. Type 9 - TCP flags . . . . . . . . . . . . . . . . . 11
4.2.10. Type 10 - Packet length . . . . . . . . . . . . . . . 12
4.2.11. Type 11 - DSCP (Diffserv Code Point) . . . . . . . . 12
4.2.12. Type 12 - Fragment . . . . . . . . . . . . . . . . . 12
4.3. Examples of Encodings . . . . . . . . . . . . . . . . . . 13 4.3. Examples of Encodings . . . . . . . . . . . . . . . . . . 13
5. Traffic Filtering . . . . . . . . . . . . . . . . . . . . . . 14 5. Traffic Filtering . . . . . . . . . . . . . . . . . . . . . . 16
5.1. Ordering of Traffic Filtering Rules . . . . . . . . . . . 15 5.1. Ordering of Flow Specifications . . . . . . . . . . . . . 17
6. Validation Procedure . . . . . . . . . . . . . . . . . . . . 17 6. Validation Procedure . . . . . . . . . . . . . . . . . . . . 18
7. Traffic Filtering Actions . . . . . . . . . . . . . . . . . . 18 7. Traffic Filtering Actions . . . . . . . . . . . . . . . . . . 19
7.1. Traffic Rate in Bytes (traffic-rate-bytes) sub-type 0x06 19 7.1. Traffic Rate in Bytes (traffic-rate-bytes) sub-type 0x06 20
7.2. Traffic Rate in Packets (traffic-rate-packets) sub-type 7.2. Traffic Rate in Packets (traffic-rate-packets) sub-type
TBD . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 TBD . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3. Traffic-action (traffic-action) sub-type 0x07 . . . . . . 20 7.3. Traffic-action (traffic-action) sub-type 0x07 . . . . . . 21
7.4. RT Redirect (rt-redirect) sub-type 0x08 . . . . . . . . . 21 7.4. RT Redirect (rt-redirect) sub-type 0x08 . . . . . . . . . 22
7.5. Traffic Marking (traffic-marking) sub-type 0x09 . . . . . 21 7.5. Traffic Marking (traffic-marking) sub-type 0x09 . . . . . 22
7.6. Considerations on Traffic Action Interference . . . . . . 21 7.6. Interaction with other Filtering Mechanisms in Routers . 23
8. Dissemination of Traffic Filtering in BGP/MPLS VPN Networks . 22 7.7. Considerations on Traffic Filtering Action Interference . 23
8.1. Validation Procedures for BGP/MPLS VPNs . . . . . . . . . 23 8. Dissemination of Traffic Filtering in BGP/MPLS VPN Networks . 24
8.2. Traffic Actions Rules . . . . . . . . . . . . . . . . . . 23 9. Traffic Monitoring . . . . . . . . . . . . . . . . . . . . . 25
9. Limitations of Previous Traffic Filtering Efforts . . . . . . 23 10. Error-Handling . . . . . . . . . . . . . . . . . . . . . . . 25
9.1. Limitations in Previous DDoS Traffic Filtering Efforts . 23 11. Future NLRI Extensions . . . . . . . . . . . . . . . . . . . 25
9.2. Limitations in Previous BGP/MPLS Traffic Filtering 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26
Efforts . . . . . . . . . . . . . . . . . . . . . . . . . 24 12.1. AFI/SAFI Definitions . . . . . . . . . . . . . . . . . . 26
10. Traffic Monitoring . . . . . . . . . . . . . . . . . . . . . 24 12.2. Flow Component Definitions . . . . . . . . . . . . . . . 26
11. Error-Handling and Future NLRI Extensions . . . . . . . . . . 24 12.3. Extended Community Flow Specification Actions . . . . . 27
12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 25 13. Security Considerations . . . . . . . . . . . . . . . . . . . 30
12.1. AFI/SAFI Definitions . . . . . . . . . . . . . . . . . . 25 14. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 31
12.2. Flow Component Definitions . . . . . . . . . . . . . . . 25 15. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 31
12.3. Extended Community Flow Specification Actions . . . . . 26 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 32
13. Security Considerations . . . . . . . . . . . . . . . . . . . 29 16.1. Normative References . . . . . . . . . . . . . . . . . . 32
14. Operational Security Considerations . . . . . . . . . . . . . 30 16.2. Informative References . . . . . . . . . . . . . . . . . 33
15. Original authors . . . . . . . . . . . . . . . . . . . . . . 30 16.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 34
16. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 30 Appendix A. Python code: flow_rule_cmp . . . . . . . . . . . . . 34
17. References . . . . . . . . . . . . . . . . . . . . . . . . . 30 Appendix B. Comparison with RFC 5575 . . . . . . . . . . . . . . 36
17.1. Normative References . . . . . . . . . . . . . . . . . . 30 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 37
17.2. Informative References . . . . . . . . . . . . . . . . . 32
17.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Appendix A. Comparison with RFC 5575 . . . . . . . . . . . . . . 32
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 33
1. Introduction 1. Introduction
This document obsoletes both
"Dissemination of Flow Specification Rules" [RFC5575] and
"Clarification of the Flowspec Redirect Extended Community"[RFC7674].
Modern IP routers contain both the capability to forward traffic Modern IP routers contain both the capability to forward traffic
according to IP prefixes as well as to classify, shape, rate limit, according to IP prefixes as well as to classify, shape, rate limit,
filter, or redirect packets based on administratively defined filter, or redirect packets based on administratively defined
policies. policies. These traffic policy mechanisms allow the operator to
define match rules that operate on multiple fields of the packet
These traffic policy mechanisms allow the router to define match header. Actions such as the ones described above can be associated
rules that operate on multiple fields of the packet header. Actions with each rule.
such as the ones described above can be associated with each rule.
The n-tuple consisting of the matching criteria defines an aggregate The n-tuple consisting of the matching criteria defines an aggregate
traffic Flow Specification. The matching criteria can include traffic Flow Specification. The matching criteria can include
elements such as source and destination address prefixes, IP elements such as source and destination address prefixes, IP
protocol, and transport protocol port numbers. protocol, and transport protocol port numbers.
This document defines a general procedure to encode flow Section 4 of this document defines a general procedure to encode Flow
specification rules for aggregated traffic flows so that they can be Specification for aggregated traffic flows so that they can be
distributed as a BGP [RFC4271] NLRI. Additionally, we define the distributed as a BGP [RFC4271] NLRI. Additionally, Section 7 of this
required mechanisms to utilize this definition to the problem of document defines the required Traffic Filtering Actions BGP Extended
immediate concern to the authors: intra- and inter-provider Communities and mechanisms to use BGP for intra- and inter-provider
distribution of traffic filtering rules to filter (distributed) distribution of traffic filtering rules to filter (distributed)
denial-of-service (DoS) attacks. denial-of-service (DoS) attacks.
By expanding routing information with Flow Specifications, the By expanding routing information with Flow Specifications, the
routing system can take advantage of the ACL (Access Control List) or routing system can take advantage of the ACL (Access Control List) or
firewall capabilities in the router's forwarding path. Flow firewall capabilities in the router's forwarding path. Flow
specifications can be seen as more specific routing entries to a Specifications can be seen as more specific routing entries to a
unicast prefix and are expected to depend upon the existing unicast unicast prefix and are expected to depend upon the existing unicast
data information. data information.
A Flow Specification received from an external autonomous system will A Flow Specification received from an external autonomous system will
need to be validated against unicast routing before being accepted. need to be validated against unicast routing before being accepted
If the aggregate traffic flow defined by the unicast destination (Section 6). The flow specification received from an internal BGP
prefix is forwarded to a given BGP peer, then the local system can peer within the same autonomous system (per [RFC4271]) is assumed to
install more specific flow rules that may result in different have been validated prior to transmission within the iBGP mesh of an
forwarding behavior, as requested by this system. autonomous system. If the aggregate traffic flow defined by the
unicast destination prefix is forwarded to a given BGP peer, then the
The key technology components required to address the class of local system can install more specific Flow Specifications that may
problems targeted by this document are: result in different forwarding behavior, as requested by this system.
1. Efficient point-to-multipoint distribution of control plane
information.
2. Inter-domain capabilities and routing policy support.
3. Tight integration with unicast routing, for verification
purposes.
Items 1 and 2 have already been addressed using BGP for other types
of control plane information. Close integration with BGP also makes
it feasible to specify a mechanism to automatically verify flow
information against unicast routing. These factors are behind the
choice of BGP as the carrier of Flow Specification information.
As with previous extensions to BGP, this specification makes it
possible to add additional information to Internet routers. These
are limited in terms of the maximum number of data elements they can
hold as well as the number of events they are able to process in a
given unit of time. The authors believe that, as with previous
extensions, service providers will be careful to keep information
levels below the maximum capacity of their devices.
Experience with previous BGP extensions has also shown that the
maximum capacity of BGP speakers has been gradually increased
according to expected loads. For example Internet unicast routing as
well as other BGP applications increased their maximum capacity as
they gain popularity.
From an operational perspective, the utilization of BGP as the From an operational perspective, the utilization of BGP as the
carrier for this information allows a network service provider to carrier for this information allows a network service provider to
reuse both internal route distribution infrastructure (e.g., route reuse both internal route distribution infrastructure (e.g., route
reflector or confederation design) and existing external reflector or confederation design) and existing external
relationships (e.g., inter-domain BGP sessions to a customer relationships (e.g., inter-domain BGP sessions to a customer
network). network).
While it is certainly possible to address this problem using other While it is certainly possible to address this problem using other
mechanisms, this solution has been utilized in deployments because of mechanisms, this solution has been utilized in deployments because of
the substantial advantage of being an incremental addition to already the substantial advantage of being an incremental addition to already
deployed mechanisms. deployed mechanisms.
In current deployments, the information distributed by the flow-spec In current deployments, the information distributed by this extension
extension is originated both manually as well as automatically. The is originated both manually as well as automatically. The latter by
latter by systems that are able to detect malicious flows. When systems that are able to detect malicious traffic flows. When
automated systems are used, care should be taken to ensure their automated systems are used, care should be taken to ensure their
correctness as well as to limit the number and advertisement rate of correctness as well as the limitations of the systems that receive
flow routes. and process the advertised Flow Specifications (see also Section 13).
This specification defines required protocol extensions to address This specification defines required protocol extensions to address
most common applications of IPv4 unicast and VPNv4 unicast filtering. most common applications of IPv4 unicast and VPNv4 unicast filtering.
The same mechanism can be reused and new match criteria added to The same mechanism can be reused and new match criteria added to
address similar filtering needs for other BGP address families such address similar filtering needs for other BGP address families such
as IPv6 families [I-D.ietf-idr-flow-spec-v6], as IPv6 families [I-D.ietf-idr-flow-spec-v6].
2. Definitions of Terms Used in This Memo 2. Definitions of Terms Used in This Memo
AFI - Address Family Identifier.
AS - Autonomous System.
Loc-RIB - The Loc-RIB contains the routes that have been selected
by the local BGP speaker's Decision Process.
NLRI - Network Layer Reachability Information. NLRI - Network Layer Reachability Information.
RIB - Routing Information Base. PE - Provider Edge router.
Loc-RIB - Local RIB. RIB - Routing Information Base.
AS - Autonomous System. SAFI - Subsequent Address Family Identifier.
VRF - Virtual Routing and Forwarding instance. VRF - Virtual Routing and Forwarding instance.
PE - Provider Edge router
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
3. Flow Specifications 3. Flow Specifications
A Flow Specification is an n-tuple consisting of several matching A Flow Specification is an n-tuple consisting of several matching
criteria that can be applied to IP traffic. A given IP packet is criteria that can be applied to IP traffic. A given IP packet is
said to match the defined flow if it matches all the specified said to match the defined Flow Specification if it matches all the
criteria. This n-tuple is encoded into a BGP NLRI defined below. specified criteria. This n-tuple is encoded into a BGP NLRI defined
below.
A given flow may be associated with a set of attributes, depending on A given Flow Specification may be associated with a set of
the particular application; such attributes may or may not include attributes, depending on the particular application; such attributes
reachability information (i.e., NEXT_HOP). Well-known or AS-specific may or may not include reachability information (i.e., NEXT_HOP).
community attributes can be used to encode a set of predetermined Well-known or AS-specific community attributes can be used to encode
actions. a set of predetermined actions.
A particular application is identified by a specific (Address Family A particular application is identified by a specific (Address Family
Identifier, Subsequent Address Family Identifier (AFI, SAFI)) pair Identifier, Subsequent Address Family Identifier (AFI, SAFI)) pair
[RFC4760] and corresponds to a distinct set of RIBs. Those RIBs [RFC4760] and corresponds to a distinct set of RIBs. Those RIBs
should be treated independently from each other in order to assure should be treated independently from each other in order to assure
non-interference between distinct applications. non-interference between distinct applications.
BGP itself treats the NLRI as an key to an entry in its databases. BGP itself treats the NLRI as a key to an entry in its databases.
Entries that are placed in the Loc-RIB are then associated with a Entries that are placed in the Loc-RIB are then associated with a
given set of semantics, which is application dependent. This is given set of semantics, which is application dependent. This is
consistent with existing BGP applications. For instance, IP unicast consistent with existing BGP applications. For instance, IP unicast
routing (AFI=1, SAFI=1) and IP multicast reverse-path information routing (AFI=1, SAFI=1) and IP multicast reverse-path information
(AFI=1, SAFI=2) are handled by BGP without any particular semantics (AFI=1, SAFI=2) are handled by BGP without any particular semantics
being associated with them until installed in the Loc-RIB. being associated with them until installed in the Loc-RIB.
Standard BGP policy mechanisms, such as UPDATE filtering by NLRI Standard BGP policy mechanisms, such as UPDATE filtering by NLRI
prefix as well as community matching and manipulation, MUST apply to prefix as well as community matching and manipulation, must apply to
the Flow Specification defined NLRI-type, especially in an inter- the Flow Specification defined NLRI-type, especially in an inter-
domain environment. Network operators can also control propagation domain environment. Network operators can also control propagation
of such routing updates by enabling or disabling the exchange of a of such routing updates by enabling or disabling the exchange of a
particular (AFI, SAFI) pair on a given BGP peering session. particular (AFI, SAFI) pair on a given BGP peering session.
4. Dissemination of IPv4 FLow Specification Information 4. Dissemination of IPv4 FLow Specification Information
We define a "Flow Specification" NLRI type (Figure 1) that may This document defines a Flow Specification NLRI type (Figure 1) that
include several components such as destination prefix, source prefix, may include several components such as destination prefix, source
protocol, ports, and others (see Section 4.2 below). prefix, protocol, ports, and others (see Section 4.2 below).
This NLRI information is encoded using MP_REACH_NLRI and This NLRI information is encoded using MP_REACH_NLRI and
MP_UNREACH_NLRI attributes as defined in [RFC4760]. Whenever the MP_UNREACH_NLRI attributes as defined in [RFC4760]. Whenever the
corresponding application does not require Next-Hop information, this corresponding application does not require Next Hop information, this
shall be encoded as a 0-octet length Next Hop in the MP_REACH_NLRI shall be encoded as a 0-octet length Next Hop in the MP_REACH_NLRI
attribute and ignored on receipt. attribute (if a non 0-octet Next Hop is present it should be ignored
on receipt).
The NLRI field of the MP_REACH_NLRI and MP_UNREACH_NLRI is encoded as The NLRI field of the MP_REACH_NLRI and MP_UNREACH_NLRI is encoded as
a 1- or 2-octet NLRI length field followed by a variable-length NLRI a 1- or 2-octet NLRI length field followed by a variable-length NLRI
value. The NLRI length is expressed in octets. value. The NLRI length is expressed in octets.
+------------------------------+ +-------------------------------+
| length (0xnn or 0xfn nn) | | length (0xnn or 0xfnnn) |
+------------------------------+ +-------------------------------+
| NLRI value (variable) | | NLRI value (variable) |
+------------------------------+ +-------------------------------+
Figure 1: Flow-spec NLRI for IPv4 Figure 1: Flow Specification NLRI for IPv4
Implementations wishing to exchange Flow Specification rules MUST use Implementations wishing to exchange Flow Specification MUST use BGP's
BGP's Capability Advertisement facility to exchange the Multiprotocol Capability Advertisement facility to exchange the Multiprotocol
Extension Capability Code (Code 1) as defined in [RFC4760]. The Extension Capability Code (Code 1) as defined in [RFC4760]. The
(AFI, SAFI) pair carried in the Multiprotocol Extension Capability (AFI, SAFI) pair carried in the Multiprotocol Extension Capability
MUST be (AFI=1, SAFI=133) for IPv4 Flow Specification, and (AFI=1, MUST be (AFI=1, SAFI=133) for IPv4 Flow Specification, and (AFI=1,
SAFI=134) for VPNv4 Flow Specification. SAFI=134) for VPNv4 Flow Specification.
4.1. Length Encoding 4.1. Length Encoding
o If the NLRI length value is smaller than 240 (0xf0 hex), the o If the NLRI length is smaller than 240 (0xf0 hex) octets, the
length field can be encoded as a single octet. length field can be encoded as a single octet.
o Otherwise, it is encoded as an extended-length 2-octet value in o Otherwise, it is encoded as an extended-length 2-octet value in
which the most significant nibble of the first byte is all ones. which the most significant nibble of the first byte is all ones.
In figure 1 above, values less-than 240 are encoded using two hex In Figure 1 above, values less-than 240 are encoded using two hex
digits (0xnn). Values above 239 are encoded using 3 hex digits digits (0xnn). Values above 239 are encoded using 3 hex digits
(0xfnnn). The highest value that can be represented with this (0xfnnn). The highest value that can be represented with this
encoding is 4095. The value 241 is encoded as 0xf0f1. encoding is 4095. For example the length value of 239 is encoded as
0xef (single octet) while 240 is encoded as 0xf0f0 (2-octet).
4.2. NLRI Value Encoding 4.2. NLRI Value Encoding
The Flow Specification NLRI-type consists of several optional The Flow Specification NLRI value consists of a list of optional
subcomponents. A specific packet is considered to match the flow components and is encoded as follows:
specification when it matches the intersection (AND) of all the
components present in the specification.
The encoding of each of the NLRI components begins with a type field
(1 octet) followed by a variable length parameter. Section 4.2.1 to
Section 4.2.12 define component types and parameter encodings for the
IPv4 IP layer and transport layer headers. IPv6 NLRI component types
are described in [I-D.ietf-idr-flow-spec-v6].
Flow Specification components must follow strict type ordering by
increasing numerical order. A given component type may (exactly
once) or may not be present in the specification. If present, it
MUST precede any component of higher numeric type value.
All combinations of component types within a single NLRI are allowed,
even if the combination makes no sense from a semantical perspective.
If a given component type within a prefix in unknown, the prefix in
question cannot be used for traffic filtering purposes by the
receiver. Since a Flow Specification has the semantics of a logical
AND of all components, if a component is FALSE, by definition it
cannot be applied. However, for the purposes of BGP route
propagation, this prefix should still be transmitted since BGP route
distribution is independent on NLRI semantics.
4.2.1. Type 1 - Destination Prefix
Encoding: <type (1 octet), prefix length (1 octet), prefix>
Defines: the destination prefix to match. Prefixes are encoded as Encoding: <[component]+>
in BGP UPDATE messages, a length in bits is followed by enough
octets to contain the prefix information.
4.2.2. Type 2 - Source Prefix A specific packet is considered to match the Flow Specification when
it matches the intersection (AND) of all the components present in
the Flow Specification.
Encoding: <type (1 octet), prefix-length (1 octet), prefix> Components must follow strict type ordering by increasing numerical
order. A given component type may (exactly once) or may not be
present in the Flow Specification. If present, it MUST precede any
component of higher numeric type value.
Defines the source prefix to match. All combinations of components within a single Flow Specification are
allowed. However, some combinations cannot match any packets (ie.
"ICMP Type AND Port" will never match any packets), and thus SHOULD
NOT be propagated by BGP.
4.2.3. Type 3 - IP Protocol 4.2.1. Operators
Encoding:<type (1 octet), [op, value]+> Most of the components described below make use of comparison
operators. Which of the two operators is used is defined by the
components in Section 4.2.2. The operators are encoded as a single
octet.
Contains a set of {operator, value} pairs that are used to match 4.2.1.1. Numeric Operator (numeric_op)
the IP protocol value byte in IP packets.
The operator byte is encoded as: This operator is encoded as shown in Figure 2.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| e | a | len | 0 |lt |gt |eq | | e | a | len | 0 |lt |gt |eq |
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
Numeric operator Figure 2: Numeric Operator (numeric_op)
e - end-of-list bit. Set in the last {op, value} pair in the e - end-of-list bit: Set in the last {op, value} pair in the list.
list.
a - AND bit. If unset, the previous term is logically ORed with a - AND bit: If unset, the previous term is logically ORed with the
the current one. If set, the operation is a logical AND. In the current one. If set, the operation is a logical AND. In the
first operator byte of a sequence it SHOULD be encoded as unset first operator byte of a sequence it SHOULD be encoded as unset
and and MUST be treated as always unset on decoding. The AND and and MUST be treated as always unset on decoding. The AND
operator has higher priority than OR for the purposes of operator has higher priority than OR for the purposes of
evaluating logical expressions. evaluating logical expressions.
len - length of the value field for this operator given as (1 << len - length: The length of the value field for this operator given
len). This encodes 1 (00) - 8 (11) bytes. Type 3 flow component as (1 << len). This encodes 1 (len=00), 2 (len=01), 4 (len=10), 8
values SHOULD be encoded as single byte (len = 00). (len=11) bytes.
0 - SHOULD be set to 0 on NLRI encoding, and MUST be ignored 0 - SHOULD be set to 0 on NLRI encoding, and MUST be ignored during
during decoding decoding
lt - less than comparison between data and value. lt - less than comparison between data and value.
gt - greater than comparison between data and value. gt - greater than comparison between data and value.
eq - equality between data and value. eq - equality between data and value.
The bits lt, gt, and eq can be combined to produce common relational The bits lt, gt, and eq can be combined to produce common relational
operators such as "less or equal", "greater or equal", and "not equal operators such as "less or equal", "greater or equal", and "not equal
to". to" as shown in Table 1.
+----+----+----+----------------------------------+ +----+----+----+----------------------------------+
| lt | gt | eq | Resulting operation | | lt | gt | eq | Resulting operation |
+----+----+----+----------------------------------+ +----+----+----+----------------------------------+
| 0 | 0 | 0 | false (independent of the value) | | 0 | 0 | 0 | false (independent of the value) |
| 0 | 0 | 1 | == (equal) | | 0 | 0 | 1 | == (equal) |
| 0 | 1 | 0 | > (greater than) | | 0 | 1 | 0 | > (greater than) |
| 0 | 1 | 1 | >= (greater than or equal) | | 0 | 1 | 1 | >= (greater than or equal) |
| 1 | 0 | 0 | < (less than) | | 1 | 0 | 0 | < (less than) |
| 1 | 0 | 1 | <= (less than or equal) | | 1 | 0 | 1 | <= (less than or equal) |
| 1 | 1 | 0 | != (not equal value) | | 1 | 1 | 0 | != (not equal value) |
| 1 | 1 | 1 | true (independent of the value) | | 1 | 1 | 1 | true (independent of the value) |
+----+----+----+----------------------------------+ +----+----+----+----------------------------------+
Table 1: Comparison operation combinations Table 1: Comparison operation combinations
4.2.4. Type 4 - Port 4.2.1.2. Bitmask Operator (bitmask_op)
Encoding:<type (1 octet), [op, value]+> This operator is encoded as shown in Figure 3.
Defines a list of {operator, value} pairs that matches source OR 0 1 2 3 4 5 6 7
destination TCP/UDP ports. This list is encoded using the numeric +---+---+---+---+---+---+---+---+
operator format defined in Section 4.2.3. Values SHOULD be | e | a | len | 0 | 0 |not| m |
encoded as 1- or 2-byte quantities. +---+---+---+---+---+---+---+---+
Port, source port, and destination port components evaluate to Figure 3: Bitmask Operator (bitmask_op)
FALSE if the IP protocol field of the packet has a value other
than TCP or UDP, if the packet is fragmented and this is not the
first fragment, or if the system in unable to locate the transport
header. Different implementations may or may not be able to
decode the transport header in the presence of IP options or
Encapsulating Security Payload (ESP) NULL [RFC4303] encryption.
4.2.5. Type 5 - Destination Port e, a, len - Most significant nibble: (end-of-list bit, AND bit, and
length field), as defined in the Numeric Operator format in
Section 4.2.1.1.
Encoding:<type (1 octet), [op, value]+> not - NOT bit: If set, logical negation of operation.
Defines a list of {operator, value} pairs used to match the m - Match bit: If set, this is a bitwise match operation defined as
destination port of a TCP or UDP packet. This list is encoded "(data AND value) == value"; if unset, (data AND value) evaluates
using the numeric operator format defined in Section 4.2.3. to TRUE if any of the bits in the value mask are set in the data
Values SHOULD be encoded as 1- or 2-byte quantities.
4.2.6. Type 6 - Source Port 0 - all 0 bits: SHOULD be set to 0 on NLRI encoding, and MUST be
ignored during decoding
Encoding:<type (1 octet), [op, value]+> 4.2.2. Components
Defines a list of {operator, value} pairs used to match the source The encoding of each of the components begins with a type field (1
port of a TCP or UDP packet. This list is encoded using the octet) followed by a variable length parameter. The following
numeric operator format defined in Section 4.2.3. Values SHOULD sections define component types and parameter encodings for the IPv4
be encoded as 1- or 2-byte quantities. IP layer and transport layer headers. IPv6 NLRI component types are
described in [I-D.ietf-idr-flow-spec-v6].
4.2.7. Type 7 - ICMP type 4.2.2.1. Type 1 - Destination Prefix
Encoding:<type (1 octet), [op, value]+> Encoding: <type (1 octet), length (1 octet), prefix (variable)>
Defines a list of {operator, value} pairs used to match the type Defines the destination prefix to match. The length and prefix
field of an ICMP packet. This list is encoded using the numeric fields are encoded as in BGP UPDATE messages [RFC4271]
operator format defined in Section 4.2.3. Values SHOULD be
encoded using a single byte.
The ICMP type specifiers evaluate to FALSE whenever the protocol 4.2.2.2. Type 2 - Source Prefix
value is not ICMP.
4.2.8. Type 8 - ICMP code Encoding: <type (1 octet), length (1 octet), prefix (variable)>
Encoding:<type (1 octet), [op, value]+> Defines the source prefix to match. The length and prefix fields are
encoded as in BGP UPDATE messages [RFC4271]
Defines a list of {operator, value} pairs used to match the code 4.2.2.3. Type 3 - IP Protocol
field of an ICMP packet. This list is encoded using the numeric
operator format defined in Section 4.2.3. Values SHOULD be
encoded using a single byte.
The ICMP code specifiers evaluate to FALSE whenever the protocol Encoding: <type (1 octet), [numeric_op, value]+>
value is not ICMP.
4.2.9. Type 9 - TCP flags Contains a list of {numeric_op, value} pairs that are used to match
the IP protocol value byte in IP packet header (see [RFC0791]
Section 3.1).
Encoding:<type (1 octet), [op, bitmask]+> This component uses the Numeric Operator (numeric_op) described in
Section 4.2.1.1. Type 3 component values SHOULD be encoded as single
byte (numeric_op len=00).
Bitmask values can be encoded as a 1- or 2-byte bitmask. When a 4.2.2.4. Type 4 - Port
single byte is specified, it matches byte 13 of the TCP header
[RFC0793], which contains bits 8 though 15 of the 4th 32-bit word.
When a 2-byte encoding is used, it matches bytes 12 and 13 of the
TCP header with the data offset field having a "don't care" value.
This component evaluates to FALSE for packets that are not TCP Encoding: <type (1 octet), [numeric_op, value]+>
packets.
This type uses the bitmask operator format, which differs from the Defines a list of {numeric_op, value} pairs that matches source OR
numeric operator format in the lower nibble. destination TCP/UDP ports (see [RFC0793] Section 3.1 and [RFC0768]
Section "Format"). This component matches if either the destination
port OR the source port of a IP packet matches the value.
0 1 2 3 4 5 6 7 This component uses the Numeric Operator (numeric_op) described in
+---+---+---+---+---+---+---+---+ Section 4.2.1.1. Type 4 component values SHOULD be encoded as 1- or
| e | a | len | 0 | 0 |not| m | 2-byte quantities (numeric_op len=00 or len=01).
+---+---+---+---+---+---+---+---+
Bitmask operator In case of the presence of the port (destination-port, source-port)
component only TCP or UDP packets can match the entire Flow
Specification. The port component, if present, never matches when
the packet's IP protocol value is not 6 (TCP) or 17 (UDP), if the
packet is fragmented and this is not the first fragment, or if the
system is unable to locate the transport header. Different
implementations may or may not be able to decode the transport header
in the presence of IP options or Encapsulating Security Payload (ESP)
NULL [RFC4303] encryption.
e, a, len - Most significant nibble: (end-of-list bit, AND bit, and 4.2.2.5. Type 5 - Destination Port
length field), as defined for in the numeric operator format in
Section 4.2.3.
not - NOT bit. If set, logical negation of operation. Encoding: <type (1 octet), [numeric_op, value]+>
m - Match bit. If set, this is a bitwise match operation defined Defines a list of {numeric_op, value} pairs used to match the
as "(data AND value) == value"; if unset, (data AND value) destination port of a TCP or UDP packet (see also [RFC0793]
evaluates to TRUE if any of the bits in the value mask are set in Section 3.1 and [RFC0768] Section "Format").
the data
0 - all 0 bits SHOULD be set to 0 on NLRI encoding, and MUST be This component uses the Numeric Operator (numeric_op) described in
ignored during decoding Section 4.2.1.1. Type 5 component values SHOULD be encoded as 1- or
2-byte quantities (numeric_op len=00 or len=01).
4.2.10. Type 10 - Packet length The last paragraph of Section 4.2.2.4 also applies to this component.
Encoding:<type (1 octet), [op, value]+> 4.2.2.6. Type 6 - Source Port
Defines a list of {operator, value} pairs used to match on the Encoding: <type (1 octet), [numeric_op, value]+>
total IP packet length (excluding Layer 2 but including IP
header). This list is encoded using the numeric operator format
defined in Section 4.2.3. Values SHOULD be encoded using 1- or
2-byte quantities.
4.2.11. Type 11 - DSCP (Diffserv Code Point) Defines a list of {numeric_op, value} pairs used to match the source
port of a TCP or UDP packet (see also [RFC0793] Section 3.1 and
[RFC0768] Section "Format").
Encoding:<type (1 octet), [op, value]+> This component uses the Numeric Operator (numeric_op) described in
Section 4.2.1.1. Type 6 component values SHOULD be encoded as 1- or
2-byte quantities (numeric_op len=00 or len=01).
Defines a list of {operator, value} pairs used to match the 6-bit The last paragraph of Section 4.2.2.4 also applies to this component.
DSCP field [RFC2474]. This list is encoded using the numeric
operator format defined in Section 4.2.3. Values SHOULD be
encoded using a single byte. The six least significant bits
contain the DSCP value. All other bits SHOULD be encoded as zero
and ignored on decoding.
4.2.12. Type 12 - Fragment 4.2.2.7. Type 7 - ICMP type
Encoding:<type (1 octet), [op, bitmask]+> Encoding: <type (1 octet), [numeric_op, value]+>
Uses bitmask operator format defined in Section 4.2.9. Defines a list of {numeric_op, value} pairs used to match the type
field of an ICMP packet (see also [RFC0792] Section "Message
Formats").
0 1 2 3 4 5 6 7 This component uses the Numeric Operator (numeric_op) described in
+---+---+---+---+---+---+---+---+ Section 4.2.1.1. Type 7 component values SHOULD be encoded as single
| 0 | 0 | 0 | 0 |LF |FF |IsF|DF | byte (numeric_op len=00).
+---+---+---+---+---+---+---+---+
Bitmask values: In case of the presence of the ICMP type (code) component only ICMP
packets can match the entire Flow Specification. The ICMP type
(code) component, if present, never matches when the packet's IP
protocol value is not 1 (ICMP), if the packet is fragmented and this
is not the first fragment, or if the system is unable to locate the
transport header. Different implementations may or may not be able
to decode the transport header in the presence of IP options or
Encapsulating Security Payload (ESP) NULL [RFC4303] encryption.
Bit 7 - Don't fragment (DF) 4.2.2.8. Type 8 - ICMP code
Bit 6 - Is a fragment (IsF) Encoding: <type (1 octet), [numeric_op, value]+>
Bit 5 - First fragment (FF) Defines a list of {numeric_op, value} pairs used to match the code
field of an ICMP packet (see also [RFC0792] Section "Message
Formats").
Bit 4 - Last fragment (LF) This component uses the Numeric Operator (numeric_op) described in
Section 4.2.1.1. Type 8 component values SHOULD be encoded as single
byte (numeric_op len=00).
Bit 0-3 - SHOULD be set to 0 on NLRI encoding, and MUST be The last paragraph of Section 4.2.2.7 also applies to this component.
ignored during decoding
4.2.2.9. Type 9 - TCP flags
Encoding: <type (1 octet), [bitmask_op, bitmask]+>
Defines a list of {bitmask_op, bitmask} pairs used to match TCP
Control Bits (see also [RFC0793] Section 3.1).
This component uses the Bitmask Operator (bitmask_op) described in
Section 4.2.1.2. Type 9 component bitmasks MUST be encoded as 1- or
2-byte bitmask (bitmask_op len=00 or len=01).
When a single byte (bitmask_op len=00) is specified, it matches byte
14 of the TCP header (see also [RFC0793] Section 3.1), which contains
the TCP Control Bits. When a 2-byte (bitmask_op len=01) encoding is
used, it matches bytes 13 and 14 of the TCP header with the data
offset (leftmost 4 bits) always treated as 0.
In case of the presence of the TCP flags component only TCP packets
can match the entire Flow Specification. The TCP flags component, if
present, never matches when the packet's IP protocol value is not 6
(TCP), if the packet is fragmented and this is not the first
fragment, or if the system is unable to locate the transport header.
Different implementations may or may not be able to decode the
transport header in the presence of IP options or Encapsulating
Security Payload (ESP) NULL [RFC4303] encryption.
4.2.2.10. Type 10 - Packet length
Encoding: <type (1 octet), [numeric_op, value]+>
Defines a list of {numeric_op, value} pairs used to match on the
total IP packet length (excluding Layer 2 but including IP header).
This component uses the Numeric Operator (numeric_op) described in
Section 4.2.1.1. Type 10 component values SHOULD be encoded as 1- or
2-byte quantities (numeric_op len=00 or len=01).
4.2.2.11. Type 11 - DSCP (Diffserv Code Point)
Encoding: <type (1 octet), [numeric_op, value]+>
Defines a list of {numeric_op, value} pairs used to match the 6-bit
DSCP field (see also [RFC2474]).
This component uses the Numeric Operator (numeric_op) described in
Section 4.2.1.1. Type 11 component values MUST be encoded as single
byte (numeric_op len=00).
The six least significant bits contain the DSCP value. All other
bits SHOULD be treated as 0.
4.2.2.12. Type 12 - Fragment
Encoding: <type (1 octet), [bitmask_op, bitmask]+>
Defines a list of {bitmask_op, bitmask} pairs used to match specific
IP fragments.
This component uses the Bitmask Operator (bitmask_op) described in
Section 4.2.1.2. The Type 12 component bitmask MUST be encoded as
single byte bitmask (bitmask_op len=00).
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 |LF |FF |IsF|DF |
+---+---+---+---+---+---+---+---+
Figure 4: Fragment Bitmask Operand
Bitmask values:
DF - Don't fragment - match if [RFC0791] IP Header Flags Bit-1 (DF)
is 1
IsF - Is a fragment - match if [RFC0791] IP Header Fragment Offset
is not 0
FF - First fragment - match if [RFC0791] IP Header Fragment Offset
is 0 AND Flags Bit-2 (MF) is 1
LF - Last fragment - match if [RFC0791] IP Header Fragment Offset is
not 0 AND Flags Bit-2 (MF) is 0
0 - SHOULD be set to 0 on NLRI encoding, and MUST be ignored during
decoding
4.3. Examples of Encodings 4.3. Examples of Encodings
An example of a Flow Specification encoding for: "all packets to 4.3.1. Example 1
10.0.1/24 and TCP port 25".
+------------------+----------+----------+ An example of a Flow Specification NLRI encoding for: "all packets to
| destination | proto | port | 192.0.2.0/24 and TCP port 25".
+------------------+----------+----------+
| 0x01 18 0a 00 01 | 03 81 06 | 04 81 19 |
+------------------+----------+----------+
Decode for protocol: +--------+----------------+----------+----------+
| length | destination | protocol | port |
+--------+----------------+----------+----------+
| 0x0b | 01 18 c0 00 02 | 03 81 06 | 04 81 19 |
+--------+----------------+----------+----------+
+-------+----------+------------------------------+ Decoded:
| Value | | |
+-------+----------+------------------------------+
| 0x03 | type | |
| 0x81 | operator | end-of-list, value size=1, = |
| 0x06 | value | |
+-------+----------+------------------------------+
An example of a Flow Specification encoding for: "all packets to +-------+------------+------------------------------+
10.1.1/24 from 192/8 and port {range [137, 139] or 8080}". | Value | | |
+-------+------------+------------------------------+
| 0x0b | length | 11 octets (len<240 1-octet) |
| 0x01 | type | Type 1 - Destination Prefix |
| 0x18 | length | 24 bit |
| 0xc0 | prefix | 192 |
| 0x00 | prefix | 0 |
| 0x02 | prefix | 2 |
| 0x03 | type | Type 3 - IP Protocol |
| 0x81 | numeric_op | end-of-list, value size=1, = |
| 0x06 | value | IP Protocol 6 = TCP |
| 0x04 | type | Type 4 - Port |
| 0x81 | numeric_op | end-of-list, value size=1, = |
| 0x19 | value | 25 |
+-------+------------+------------------------------+
+------------------+----------+-------------------------+ This constitutes a NLRI with a NLRI length of 11 octets.
| destination | source | port |
+------------------+----------+-------------------------+
| 0x01 18 0a 01 01 | 02 08 c0 | 04 03 89 45 8b 91 1f 90 |
+------------------+----------+-------------------------+
Decode for port: 4.3.2. Example 2
+--------+----------+------------------------------+ An example of a Flow Specification NLRI encoding for: "all packets to
| Value | | | 192.0.2.0/24 from 203.0.113.0/24 and port {range [137, 139] or
+--------+----------+------------------------------+ 8080}".
| 0x04 | type | |
| 0x03 | operator | size=1, >= |
| 0x89 | value | 137 |
| 0x45 | operator | "AND", value size=1, <= |
| 0x8b | value | 139 |
| 0x91 | operator | end-of-list, value-size=2, = |
| 0x1f90 | value | 8080 |
+--------+----------+------------------------------+
This constitutes an NLRI with an NLRI length of 16 octets. +--------+----------------+----------------+-------------------------+
| length | destination | source | port |
+--------+----------------+----------------+-------------------------+
| 0x12 | 01 18 c0 00 02 | 02 18 cb 00 71 | 04 03 89 45 8b 91 1f 90 |
+--------+----------------+----------------+-------------------------+
Decoded:
+--------+------------+------------------------------+
| Value | | |
+--------+------------+------------------------------+
| 0x12 | length | 18 octets (len<240 1-octet) |
| 0x01 | type | Type 1 - Destination Prefix |
| 0x18 | length | 24 bit |
| 0xc0 | prefix | 192 |
| 0x00 | prefix | 0 |
| 0x02 | prefix | 2 |
| 0x02 | type | Type 2 - Source Prefix |
| 0x18 | length | 24 bit |
| 0xcb | prefix | 203 |
| 0x00 | prefix | 0 |
| 0x71 | prefix | 113 |
| 0x04 | type | Type 4 - Port |
| 0x03 | numeric_op | value size=1, >= |
| 0x89 | value | 137 |
| 0x45 | numeric_op | "AND", value size=1, <= |
| 0x8b | value | 139 |
| 0x91 | numeric_op | end-of-list, value size=2, = |
| 0x1f90 | value | 8080 |
+--------+------------+------------------------------+
This constitutes a NLRI with a NLRI length of 18 octets.
4.3.3. Example 3
An example of a Flow Specification NLRI encoding for: "all packets to
192.0.2.1/32 and fragment { DF or FF } (matching packet with DF bit
set or First Fragments)
+--------+-------------------+----------+
| length | destination | fragment |
+--------+-------------------+----------+
| 0x09 | 01 20 c0 00 02 01 | 0c 80 05 |
+--------+-------------------+----------+
Decoded:
+-------+------------+------------------------------+
| Value | | |
+-------+------------+------------------------------+
| 0x09 | length | 9 octets (len<240 1-octet) |
| 0x01 | type | Type 1 - Destination Prefix |
| 0x20 | length | 32 bit |
| 0xc0 | prefix | 192 |
| 0x00 | prefix | 0 |
| 0x02 | prefix | 2 |
| 0x01 | prefix | 1 |
| 0x0c | type | Type 12 - Fragment |
| 0x80 | bitmask_op | end-of-list, value size=1 |
| 0x05 | bitmask | DF=1, FF=1 |
+-------+------------+------------------------------+
This constitutes a NLRI with a NLRI length of 9 octets.
5. Traffic Filtering 5. Traffic Filtering
Traffic filtering policies have been traditionally considered to be Traffic filtering policies have been traditionally considered to be
relatively static. Limitations of the static mechanisms caused this relatively static. Limitations of these static mechanisms caused
mechanism to be designed for the three new applications of traffic this new dynamic mechanism to be designed for the three new
filtering (prevention of traffic-based, denial-of-service (DOS) applications of traffic filtering:
attacks, traffic filtering in the context of BGP/MPLS VPN service,
and centralized traffic control for SDN/NFV networks) requires
coordination among service providers and/or coordination among the AS
within a service provider. Section 9 has details on the limitation
of previous mechanisms and why BGP Flow Specification provides a
solution for to prevent DOS and aid BGP/MPLS VPN filtering rules.
This Flow Specification NLRI defined above to convey information o Prevention of traffic-based, denial-of-service (DOS) attacks.
o Traffic filtering in the context of BGP/MPLS VPN service.
o Centralized traffic control for SDN/NFV networks.
These applications require coordination among service providers and/
or coordination among the AS within a service provider.
The Flow Specification NLRI defined in Section 4 conveys information
about traffic filtering rules for traffic that should be discarded or about traffic filtering rules for traffic that should be discarded or
handled in manner specified by a set of pre-defined actions (which handled in a manner specified by a set of pre-defined actions (which
are defined in BGP Extended Communities). This mechanism is are defined in BGP Extended Communities). This mechanism is
primarily designed to allow an upstream autonomous system to perform primarily designed to allow an upstream autonomous system to perform
inbound filtering in their ingress routers of traffic that a given inbound filtering in their ingress routers of traffic that a given
downstream AS wishes to drop. downstream AS wishes to drop.
In order to achieve this goal, this draft specifies two application In order to achieve this goal, this draft specifies two application
specific NLRI identifiers that provide traffic filters, and a set of specific NLRI identifiers that provide traffic filters, and a set of
actions encoding in BGP Extended Communities. The two application actions encoding in BGP Extended Communities. The two application
specific NLRI identifiers are: specific NLRI identifiers are:
o IPv4 Flow Specification identifier (AFI=1, SAFI=133) along with o IPv4 Flow Specification identifier (AFI=1, SAFI=133) along with
specific semantic rules for IPv4 routes, and specific semantic rules for IPv4 routes, and
o VPNv4 Flow Specification identifier (AFI=1, SAFI=134) value, which o VPNv4 Flow Specification identifier (AFI=1, SAFI=134) value, which
can be used to propagate traffic filtering information in a BGP/ can be used to propagate traffic filtering information in a BGP/
MPLS VPN environment. MPLS VPN environment.
Distribution of the IPv4 Flow Specification is described in Encoding of the NLRI is described in Section 4 for IPv4 Flow
Section 6, and distibution of BGP/MPLS traffic Flow Specification is Specification and in Section 8 for VPNv4 Flow Specification. The
described in Section 8. The traffic filtering actions are described filtering actions are described in Section 7.
in Section 7.
5.1. Ordering of Traffic Filtering Rules 5.1. Ordering of Flow Specifications
With traffic filtering rules, more than one rule may match a More than one Flow Specification may match a particular traffic flow.
particular traffic flow. Thus, it is necessary to define the order Thus, it is necessary to define the order in which Flow
at which rules get matched and applied to a particular traffic flow. Specifications get matched and actions being applied to a particular
This ordering function must be such that it must not depend on the traffic flow. This ordering function is such that it does not depend
arrival order of the Flow Specification's rules and must be on the arrival order of the Flow Specification via BGP and thus is
consistent in the network. consistent in the network.
The relative order of two Flow Specification rules is determined by The relative order of two Flow Specifications is determined by
comparing their respective components. The algorithm starts by comparing their respective components. The algorithm starts by
comparing the left-most components of the rules. If the types comparing the left-most components (lowest component type value) of
differ, the rule with lowest numeric type value has higher precedence the Flow Specifications. If the types differ, the Flow Specification
(and thus will match before) than the rule that doesn't contain that with lowest numeric type value has higher precedence (and thus will
match before) than the Flow Specification that doesn't contain that
component type. If the component types are the same, then a type- component type. If the component types are the same, then a type-
specific comparison is performed (see below) if the types are equal specific comparison is performed (see below) if the types are equal
the algorithm continues with the next component. the algorithm continues with the next component.
For IP prefix values (IP destination or source prefix): If the For IP prefix values (IP destination or source prefix): If one of the
prefixes overlap, the one with the longer prefix-length has higher two prefixes to compare is a more specific prefix of the other, the
precedence. If they do not overlap the one with the lowest IP value more specific prefix has higher precedence. Otherwise the one with
has higher precedence. the lowest IP value has higher precedence.
For all other component types, unless otherwise specified, the For all other component types, unless otherwise specified, the
comparison is performed by comparing the component data as a binary comparison is performed by comparing the component data as a binary
string using the memcmp() function as defined by the ISO C standard. string using the memcmp() function as defined by [ISO_IEC_9899]. For
For strings with equal lengths the lowest string (memcmp) has higher strings with equal lengths the lowest string (memcmp) has higher
precedence. For strings of different lengths, the common prefix is precedence. For strings of different lengths, the common prefix is
compared. If the common prefix is not equal the string with the compared. If the common prefix is not equal the string with the
lowest prefix has higher precedence. If the common prefix is equal, lowest prefix has higher precedence. If the common prefix is equal,
the longest string is considered to have higher precedence than the the longest string is considered to have higher precedence than the
shorter one. shorter one.
The code below shows a Python3 implementation of the comparison The code in Appendix A shows a Python3 implementation of the
algorithm. The full code was tested with Python 3.6.3 and can be comparison algorithm. The full code was tested with Python 3.6.3 and
obtained at https://github.com/stoffi92/flowspec-cmp [1]. can be obtained at https://github.com/stoffi92/flowspec-cmp [1].
<CODE BEGINS>
import itertools
import ipaddress
def flow_rule_cmp(a, b):
for comp_a, comp_b in itertools.zip_longest(a.components,
b.components):
# If a component type does not exist in one rule
# this rule has lower precedence
if not comp_a:
return B_HAS_PRECEDENCE
if not comp_b:
return A_HAS_PRECEDENCE
# higher precedence for lower component type
if comp_a.component_type < comp_b.component_type:
return A_HAS_PRECEDENCE
if comp_a.component_type > comp_b.component_type:
return B_HAS_PRECEDENCE
# component types are equal -> type specific comparison
if comp_a.component_type in (IP_DESTINATION, IP_SOURCE):
# assuming comp_a.value, comp_b.value of type ipaddress
if comp_a.value.overlaps(comp_b.value):
# longest prefixlen has precedence
if comp_a.value.prefixlen > comp_b.value.prefixlen:
return A_HAS_PRECEDENCE
if comp_a.value.prefixlen < comp_b.value.prefixlen:
return B_HAS_PRECEDENCE
# components equal -> continue with next component
elif comp_a.value > comp_b.value:
return B_HAS_PRECEDENCE
elif comp_a.value < comp_b.value:
return A_HAS_PRECEDENCE
else:
# assuming comp_a.value, comp_b.value of type bytearray
if len(comp_a.value) == len(comp_b.value):
if comp_a.value > comp_b.value:
return B_HAS_PRECEDENCE
if comp_a.value < comp_b.value:
return A_HAS_PRECEDENCE
# components equal -> continue with next component
else:
common = min(len(comp_a.value), len(comp_b.value))
if comp_a.value[:common] > comp_b.value[:common]:
return B_HAS_PRECEDENCE
elif comp_a.value[:common] < comp_b.value[:common]:
return A_HAS_PRECEDENCE
# the first common bytes match
elif len(comp_a.value) > len(comp_b.value):
return A_HAS_PRECEDENCE
else:
return B_HAS_PRECEDENCE
return EQUAL
<CODE ENDS>
6. Validation Procedure 6. Validation Procedure
Flow Specifications received from a BGP peer that are accepted in the Flow Specifications received from a BGP peer that are accepted in the
respective Adj-RIB-In are used as input to the route selection respective Adj-RIB-In are used as input to the route selection
process. Although the forwarding attributes of two routes for the process. Although the forwarding attributes of two routes for the
same Flow Specification prefix may be the same, BGP is still required same Flow Specification prefix may be the same, BGP is still required
to perform its path selection algorithm in order to select the to perform its path selection algorithm in order to select the
correct set of attributes to advertise. correct set of attributes to advertise.
The first step of the BGP Route Selection procedure (Section 9.1.2 of The first step of the BGP Route Selection procedure (Section 9.1.2 of
[RFC4271] is to exclude from the selection procedure routes that are [RFC4271] is to exclude from the selection procedure routes that are
considered non-feasible. In the context of IP routing information, considered non-feasible. In the context of IP routing information,
this step is used to validate that the NEXT_HOP attribute of a given this step is used to validate that the NEXT_HOP attribute of a given
route is resolvable. route is resolvable.
The concept can be extended, in the case of Flow Specification NLRI, The concept can be extended, in the case of the Flow Specification
to allow other validation procedures. NLRI, to allow other validation procedures.
A Flow Specification NLRI must be validated such that it is The validation process described below validates Flow Specifications
considered feasible if and only if all of the below is true: against unicast routes received over the same AFI but the associated
unicast routing information SAFI:
Flow specification received over SAFI=133 will be validated
against routes received over SAFI=1
Flow specification received over SAFI=134 will be validated
against routes received over SAFI=128
By default a Flow Specification NLRI MUST be validated such that it
is considered feasible if and only if all of the below is true:
a) A destination prefix component is embedded in the Flow a) A destination prefix component is embedded in the Flow
Specification. Specification.
b) The originator of the Flow Specification matches the originator b) The originator of the Flow Specification matches the originator
of the best-match unicast route for the destination prefix of the best-match unicast route for the destination prefix
embedded in the Flow Specification. embedded in the Flow Specification (this is the unicast route with
the longest possible prefix length covering the destination prefix
embedded in the Flow Specification).
c) There are no more specific unicast routes, when compared with c) There are no more specific unicast routes, when compared with
the flow destination prefix, that has been received from a the flow destination prefix, that have been received from a
different neighboring AS than the best-match unicast route, which different neighboring AS than the best-match unicast route, which
has been determined in rule b). has been determined in rule b).
Rule a) MAY be relaxed by configuration, permitting Flow However, rule a) MAY be relaxed by explicit configuration, permitting
Specifications that include no destination prefix component. If such Flow Specifications that include no destination prefix component. If
is the case, rules b) and c) are moot and MUST be disregarded. such is the case, rules b) and c) are moot and MUST be disregarded.
By originator of a BGP route, we mean either the BGP originator path By originator of a BGP route, we mean either the address of the
attribute, as used by route reflection, or the transport address of originator in the ORIGINATOR_ID Attribute [RFC4456], or the source IP
the BGP peer, if this path attribute is not present. address of the BGP peer, if this path attribute is not present.
BGP implementations MUST also enforce that the AS_PATH attribute of a BGP implementations MUST also enforce that the AS_PATH attribute of a
route received via the External Border Gateway Protocol (eBGP) route received via the External Border Gateway Protocol (eBGP)
contains the neighboring AS in the left-most position of the AS_PATH contains the neighboring AS in the left-most position of the AS_PATH
attribute. While this rule is optional in the BGP specification, it attribute. While this rule is optional in the BGP specification, it
becomes necessary to enforce it for security reasons. becomes necessary to enforce it for security reasons.
The best-match unicast route may change over the time independently The best-match unicast route may change over the time independently
of the Flow Specification NLRI. Therefore, a revalidation of the of the Flow Specification NLRI. Therefore, a revalidation of the
Flow Specification NLRI MUST be performed whenever unicast routes Flow Specification NLRI MUST be performed whenever unicast routes
change. Revalidation is defined as retesting that clause a and change. Revalidation is defined as retesting that clause a and
clause b above are true. clause b above are true.
Explanation: Explanation:
The underlying concept is that the neighboring AS that advertises the The underlying concept is that the neighboring AS that advertises the
best unicast route for a destination is allowed to advertise flow- best unicast route for a destination is allowed to advertise Flow
spec information that conveys a more or equally specific destination Specification information that conveys a more or equally specific
prefix. Thus, as long as there are no more specific unicast routes, destination prefix. Thus, as long as there are no more specific
received from a different neighboring AS, which would be affected by unicast routes, received from a different neighboring AS, which would
that filtering rule. be affected by that Flow Specification.
The neighboring AS is the immediate destination of the traffic The neighboring AS is the immediate destination of the traffic
described by the Flow Specification. If it requests these flows to described by the Flow Specification. If it requests these flows to
be dropped, that request can be honored without concern that it be dropped, that request can be honored without concern that it
represents a denial of service in itself. Supposedly, the traffic is represents a denial of service in itself. Supposedly, the traffic is
being dropped by the downstream autonomous system, and there is no being dropped by the downstream autonomous system, and there is no
added value in carrying the traffic to it. added value in carrying the traffic to it.
7. Traffic Filtering Actions 7. Traffic Filtering Actions
This specification defines a minimum set of filtering actions that it This document defines a minimum set of Traffic Filtering Actions that
standardizes as BGP extended community values [RFC4360]. This is not it standardizes as BGP extended community values [RFC4360]. This is
meant to be an inclusive list of all the possible actions, but only a not meant to be an inclusive list of all the possible actions, but
subset that can be interpreted consistently across the network. only a subset that can be interpreted consistently across the
Additional actions can be defined as either requiring standards or as network. Additional actions can be defined as either requiring
vendor specific. standards or as vendor specific.
Implementations SHOULD provide mechanisms that map an arbitrary BGP
community value (normal or extended) to filtering actions that
require different mappings in different systems in the network. For
instance, providing packets with a worse-than-best-effort, per-hop
behavior is a functionality that is likely to be implemented
differently in different systems and for which no standard behavior
is currently known. Rather than attempting to define it here, this
can be accomplished by mapping a user-defined community value to
platform-/network-specific behavior via user configuration.
The default action for a traffic filtering Flow Specification is to The default action for a matching Flow Specification is to accept the
accept IP traffic that matches that particular rule. packet (treat the packet according to the normal forwarding behaviour
of the system).
This document defines the following extended communities values shown This document defines the following extended communities values shown
in Table 2 in the form 0x8xnn where nn indicates the sub-type. in Table 2 in the form 0xttss where tt indicates the type and ss
Encodings for these extended communities are described below. indicates the sub-type of the extended community. Encodings for
these extended communities are described below.
+-----------+----------------------+--------------------------------+ +--------------+--------------------------+-------------------------+
| community | action | encoding | | community | action | encoding |
+-----------+----------------------+--------------------------------+ | 0xttss | | |
| 0x8006 | traffic-rate-bytes | 2-byte ASN, 4-byte float | +--------------+--------------------------+-------------------------+
| TBD | traffic-rate-packets | 2-byte ASN, 4-byte float | | 0x8006 | traffic-rate-bytes | 2-byte ASN, 4-byte |
| 0x8007 | traffic-action | bitmask | | | (Section 7.1) | float |
| 0x8008 | rt-redirect AS-2byte | 2-octet AS, 4-octet value | | TBD | traffic-rate-packets | 2-byte ASN, 4-byte |
| 0x8108 | rt-redirect IPv4 | 4-octet IPv4 addres, 2-octet | | | (Section 7.1) | float |
| | | value | | 0x8007 | traffic-action (Section | bitmask |
| 0x8208 | rt-redirect AS-4byte | 4-octet AS, 2-octet value | | | 7.3) | |
| 0x8009 | traffic-marking | DSCP value | | 0x8008 | rt-redirect AS-2byte | 2-octet AS, 4-octet |
+-----------+----------------------+--------------------------------+ | | (Section 7.4) | value |
| 0x8108 | rt-redirect IPv4 | 4-octet IPv4 address, |
| | (Section 7.4) | 2-octet value |
| 0x8208 | rt-redirect AS-4byte | 4-octet AS, 2-octet |
| | (Section 7.4) | value |
| 0x8009 | traffic-marking (Section | DSCP value |
| | 7.5) | |
+--------------+--------------------------+-------------------------+
Table 2: Traffic Action Extended Communities Table 2: Traffic Filtering Action Extended Communities
Some traffic action communities may interfere with each other. Multiple Traffic Filtering Actions defined in this document may be
Section 7.6 of this specification provides general considerations on present for a single Flow Specification and SHOULD be applied to the
such traffic action interference. Any additional definition of a traffic flow (for example traffic-rate-bytes and rt-redirect can be
traffic actions specified by additional standards documents or vendor applied to packets at the same time). If not all of the Traffic
documents MUST specify if the traffic action interacts with an Filtering Actions can be applied to a traffic flow they should be
existing traffic actions, and provide error handling per [RFC7606]. treated as interfering Traffic filtering actions (see below).
Multiple traffic actions may be present for a single NLRI. The Some Traffic Filtering Actions may interfere with each other even
traffic actions are processed in ascending order of the sub-type contradict. Section 7.7 of this document provides general
found in the BGP Extended Communities. If not all of them can be considerations on such Traffic Filtering Action interference. Any
processed the filter SHALL NOT be applied at all (for example: if for additional definition of Traffic Filtering Actions SHOULD specify the
a given flow there are the action communities rate-limit-bytes and action to take if those Traffic Filtering Actions interfere (also
traffic-marking attached, and the plattform does not support one of with existing Traffic Filtering Actions).
them also the other shall not be applied for that flow).
All traffic actions are specified as transitive BGP Extended All Traffic Filtering Actions are specified as transitive BGP
Communities. Extended Communities.
7.1. Traffic Rate in Bytes (traffic-rate-bytes) sub-type 0x06 7.1. Traffic Rate in Bytes (traffic-rate-bytes) sub-type 0x06
The traffic-rate-bytes extended community uses the following extended The traffic-rate-bytes extended community uses the following extended
community encoding: community encoding:
The first two octets carry the 2-octet id, which can be assigned from The first two octets carry the 2-octet id, which can be assigned from
a 2-byte AS number. When a 4-byte AS number is locally present, the a 2-byte AS number. When a 4-byte AS number is locally present, the
2 least significant bytes of such an AS number can be used. This 2 least significant bytes of such an AS number can be used. This
value is purely informational and SHOULD NOT be interpreted by the value is purely informational and SHOULD NOT be interpreted by the
implementation. implementation.
The remaining 4 octets carry the maximum rate information in IEEE The remaining 4 octets carry the maximum rate information in IEEE
floating point [IEEE.754.1985] format, units being bytes per second. floating point [IEEE.754.1985] format, units being bytes per second.
A traffic-rate of 0 should result on all traffic for the particular A traffic-rate of 0 should result on all traffic for the particular
flow to be discarded. On encoding the traffic-rate MUST NOT be flow to be discarded. On encoding the traffic-rate MUST NOT be
negative. On decoding negative values MUST be treated as zero negative. On decoding negative values MUST be treated as zero
(discard all traffic). (discard all traffic).
Interferes with: No other BGP Flow Specification traffic action in Interferes with: No other BGP Flow Specification Traffic Filtering
this document. Action in this document.
7.2. Traffic Rate in Packets (traffic-rate-packets) sub-type TBD 7.2. Traffic Rate in Packets (traffic-rate-packets) sub-type TBD
The traffic-rate-packets extended community uses the same encoding as The traffic-rate-packets extended community uses the same encoding as
the traffic-rate-bytes extended community. The floating point value the traffic-rate-bytes extended community. The floating point value
carries the maximum packet rate in packets per second. A traffic- carries the maximum packet rate in packets per second. A traffic-
rate-packets of 0 should result in all traffic for the particular rate-packets of 0 should result in all traffic for the particular
flow to be discarded. On encoding the traffic-rate-packets MUST NOT flow to be discarded. On encoding the traffic-rate-packets MUST NOT
be negative. On decoding negative values MUST be treated as zero be negative. On decoding negative values MUST be treated as zero
(discard all traffic). (discard all traffic).
Interferes with: No other BGP Flow Specification traffic action in Interferes with: No other BGP Flow Specification Traffic Filtering
this document. Action in this document.
7.3. Traffic-action (traffic-action) sub-type 0x07 7.3. Traffic-action (traffic-action) sub-type 0x07
The traffic-action extended community consists of 6 bytes of which The traffic-action extended community consists of 6 bytes of which
only the 2 least significant bits of the 6th byte (from left to only the 2 least significant bits of the 6th byte (from left to
right) are currently defined. right) are defined by this document as shown in Figure 5.
40 41 42 43 44 45 46 47 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
| reserved | S | T | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+---+---+---+---+---+---+---+---+ | Traffic Action Field |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Tr. Action Field (cont.) |S|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 5: Traffic-action Extended Community Encoding
where S and T are defined as: where S and T are defined as:
o T: Terminal Action (bit 47): When this bit is set, the traffic o T: Terminal Action (bit 47): When this bit is set, the traffic
filtering engine will apply any subsequent filtering rules (as filtering engine will evaluate any subsequent Flow Specifications
defined by the ordering procedure). If not set, the evaluation of (as defined by the ordering procedure). If not set, the
the traffic filter stops when this rule is applied. evaluation of the traffic filters stops when this Flow
Specification is evaluated.
o S: Sample (bit 46): Enables traffic sampling and logging for this o S: Sample (bit 46): Enables traffic sampling and logging for this
Flow Specification. Flow Specification (only effective when set).
o reserved: should always be set to 0 by the originator and not be o Traffic Action Field: Other Traffic Action Field (see Section 12)
evaluated by the receiving BGP speaker. bits unused in this specification.
The use of the Terminal Action (bit 47) may result in more than one The use of the Terminal Action (bit 47) may result in more than one
filter-rule matching a particular flow. All the flow actions from Flow Specification matching a particular traffic flow. All the
these rules shall be collected and applied. In case of interfering Traffic Filtering Actions from these Flow Specifications shall be
traffic actions it is an implementation decision which actions are collected and applied. In case of interfering Traffic Filtering
selected. See also Section 7.6. Actions it is an implementation decision which Traffic Filtering
Actions are selected. See also Section 7.7.
Interferes with: No other BGP Flow Specification traffic action in Interferes with: No other BGP Flow Specification Traffic Filtering
this document. Action in this document.
7.4. RT Redirect (rt-redirect) sub-type 0x08 7.4. RT Redirect (rt-redirect) sub-type 0x08
The redirect extended community allows the traffic to be redirected The redirect extended community allows the traffic to be redirected
to a VRF routing instance that lists the specified route-target in to a VRF routing instance that lists the specified route-target in
its import policy. If several local instances match this criteria, its import policy. If several local instances match this criteria,
the choice between them is a local matter (for example, the instance the choice between them is a local matter (for example, the instance
with the lowest Route Distinguisher value can be elected). This with the lowest Route Distinguisher value can be elected).
extended community allows 3 different encodings formats for the
route-target (type 0x80, 0x81, 0x82). Is uses the same encoding as
the Route Target extended community [RFC4360].
It should be noted that the low-order nibble of the Redirect's Type This Extended Community allows 3 different encodings formats for the
field corresponds to the Route Target Extended Community format field route-target (type 0x80, 0x81, 0x82). It uses the same encoding as
(Type). (See Sections 3.1, 3.2, and 4 of [RFC4360] plus Section 2 of the Route Target Extended Community in Sections 3.1 (type 0x80:
[RFC5668].) The low-order octet (Sub-Type) of the Redirect Extended 2-octet AS, 4-octet value), 3.2 (type 0x81: 4-octet IPv4 address,
Community remains 0x08 for all three encodings of the BGP Extended 2-octet value) and 4 of [RFC4360] and Section 2 (type 0x82: 4-octet
Communities (AS 2-byte, AS 4-byte, and IPv4 address). AS, 2-octet value) of [RFC5668] with the high-order octet of the Type
field 0x80, 0x81, 0x82 respectively and the low-order of the Type
field (Sub-Type) always 0x08.
Interferes with: All other redirect functions. Interferes with: No other BGP Flow Specification Traffic Filtering
Action in this document.
7.5. Traffic Marking (traffic-marking) sub-type 0x09 7.5. Traffic Marking (traffic-marking) sub-type 0x09
The traffic marking extended community instructs a system to modify The traffic marking extended community instructs a system to modify
the DSCP bits of a transiting IP packet to the corresponding value. the DSCP bits in the IP header ([RFC2474] Section 3) of a transiting
This extended community is encoded as a sequence of 5 zero bytes IP packet to the corresponding value encoded in the 6 least
followed by the DSCP value encoded in the 6 least significant bits of significant bits of the extended community value as shown in
6th byte. Figure 6.
Interferes with: No other BGP Flow Specification traffic action in The extended is encoded as follows:
this document.
7.6. Considerations on Traffic Action Interference 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| reserved | reserved | reserved | reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| reserved | r.| DSCP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Since traffic actions are represented as BGP extended community Figure 6: Traffic Marking Extended Community Encoding
values, traffic actions may interfere with each other (ie. there may
be more than one conflicting traffic-rate action associated with a
single flow-filter). Traffic action interference has no impact on
BGP propagation of flow filters (all communities are propagated
according to policies).
If a flow filter associated with interfering flow actions is selected o DSCP: new DSCP value for the transiting IP packet.
for packet forwarding, it is a implementation decision which of the
interfering traffic actions are selected. Implementors of this
specification SHOULD document the behaviour of their implementation
in such cases.
If required, operators are encouraged to make use of the BGP policy o reserved, r.: SHOULD be set to 0 on encoding, and MUST be ignored
framework supported by their implementation in order to achieve a during decoding.
predictable behaviour (ie. match - replace - delete communities on
administrative boundaries). Interferes with: No other BGP Flow Specification Traffic Filtering
Action in this document.
7.6. Interaction with other Filtering Mechanisms in Routers
Implementations SHOULD provide mechanisms that map an arbitrary BGP
community value (normal or extended) to Traffic Filtering Actions
that require different mappings in different systems in the network.
For instance, providing packets with a worse-than-best-effort, per-
hop behavior is a functionality that is likely to be implemented
differently in different systems and for which no standard behavior
is currently known. Rather than attempting to define it here, this
can be accomplished by mapping a user-defined community value to
platform-/network-specific behavior via user configuration.
7.7. Considerations on Traffic Filtering Action Interference
Since Traffic Filtering Actions are represented as BGP extended
community values, Traffic Filtering Actions may interfere with each
other (e.g. there may be more than one conflicting traffic-rate-bytes
Traffic Filtering Action associated with a single Flow
Specification). Traffic Filtering Action interference has no impact
on BGP propagation of Flow Specifications (all communities are
propagated according to policies).
If a Flow Specification associated with interfering Traffic Filtering
Actions is selected for packet forwarding, it is an implementation
decision which of the interfering Traffic Filtering Actions are
selected. Implementors of this specification SHOULD document the
behaviour of their implementation in such cases.
Operators are encouraged to make use of the BGP policy framework
supported by their implementation in order to achieve a predictable
behaviour (ie. match - replace - delete communities on administrative
boundaries). See also Section 13.
8. Dissemination of Traffic Filtering in BGP/MPLS VPN Networks 8. Dissemination of Traffic Filtering in BGP/MPLS VPN Networks
Provider-based Layer 3 VPN networks, such as the ones using a BGP/ Provider-based Layer 3 VPN networks, such as the ones using a BGP/
MPLS IP VPN [RFC4364] control plane, may have different traffic MPLS IP VPN [RFC4364] control plane, may have different traffic
filtering requirements than Internet service providers. But also filtering requirements than Internet service providers. But also
Internet service providers may use those VPNs for scenarios like Internet service providers may use those VPNs for scenarios like
having the Internet routing table in a VRF, resulting in the same having the Internet routing table in a VRF, resulting in the same
traffic filtering requirements as defined for the global routing traffic filtering requirements as defined for the global routing
table environment within this document. This document proposes an table environment within this document. This document defines an
additional BGP NLRI type (AFI=1, SAFI=134) value, which can be used additional BGP NLRI type (AFI=1, SAFI=134) value, which can be used
to propagate traffic filtering information in a BGP/MPLS VPN to propagate Flow Specification in a BGP/MPLS VPN environment.
environment.
The NLRI format for this address family consists of a fixed-length The NLRI format for this address family consists of a fixed-length
Route Distinguisher field (8 bytes) followed by a Flow Specification, Route Distinguisher field (8 bytes) followed by the Flow
following the encoding defined above in Section 4.2 of this document. Specification NLRI value Section 4.2. The NLRI length field shall
The NLRI length field shall include both the 8 bytes of the Route include both the 8 bytes of the Route Distinguisher as well as the
Distinguisher as well as the subsequent Flow Specification. subsequent Flow Specification NLRI value. The resulting encoding is
shown in Figure 7.
+------------------------------+ +------------------------------+
| length (0xnn or 0xfn nn) | | length (0xnn or 0xfn nn) |
+------------------------------+ +------------------------------+
| Route Distinguisher (8 bytes)| | Route Distinguisher (8 bytes)|
+------------------------------+ +------------------------------+
| NLRI value (variable) | | NLRI value (variable) |
+------------------------------+ +------------------------------+
Flow-spec NLRI for MPLS Figure 7: Flow Specification NLRI for MPLS
Propagation of this NLRI is controlled by matching Route Target Propagation of this NLRI is controlled by matching Route Target
extended communities associated with the BGP path advertisement with extended communities associated with the BGP path advertisement with
the VRF import policy, using the same mechanism as described in "BGP/ the VRF import policy, using the same mechanism as described in BGP/
MPLS IP VPNs" [RFC4364]. MPLS IP VPNs [RFC4364].
Flow Specification rules received via this NLRI apply only to traffic
that belongs to the VRF(s) in which it is imported. By default,
traffic received from a remote PE is switched via an MPLS forwarding
decision and is not subject to filtering.
Contrary to the behavior specified for the non-VPN NLRI, flow rules
are accepted by default, when received from remote PE routers.
8.1. Validation Procedures for BGP/MPLS VPNs
The validation procedures are the same as for IPv4.
8.2. Traffic Actions Rules
The traffic action rules are the same as for IPv4.
9. Limitations of Previous Traffic Filtering Efforts
9.1. Limitations in Previous DDoS Traffic Filtering Efforts
The popularity of traffic-based, denial-of-service (DoS) attacks,
which often requires the network operator to be able to use traffic
filters for detection and mitigation, brings with it requirements
that are not fully satisfied by existing tools.
Increasingly, DoS mitigation requires coordination among several
service providers in order to be able to identify traffic source(s)
and because the volumes of traffic may be such that they will
otherwise significantly affect the performance of the network.
Several techniques are currently used to control traffic filtering of
DoS attacks. Among those, one of the most common is to inject
unicast route advertisements corresponding to a destination prefix
being attacked (commonly known as remote triggered blackhole RTBH).
One variant of this technique marks such route advertisements with a
community that gets translated into a discard Next-Hop by the
receiving router. Other variants attract traffic to a particular
node that serves as a deterministic drop point.
Using unicast routing advertisements to distribute traffic filtering
information has the advantage of using the existing infrastructure
and inter-AS communication channels. This can allow, for instance, a
service provider to accept filtering requests from customers for
address space they own.
There are several drawbacks, however. An issue that is immediately
apparent is the granularity of filtering control: only destination
prefixes may be specified. Another area of concern is the fact that
filtering information is intermingled with routing information.
The mechanism defined in this document is designed to address these
limitations. We use the Flow Specification NLRI defined above to
convey information about traffic filtering rules for traffic that is
subject to modified forwarding behavior (actions). The actions are
defined as extended communities and include (but are not limited to)
rate-limiting (including discard), traffic redirection, packet
rewriting.
9.2. Limitations in Previous BGP/MPLS Traffic Filtering Efforts
Provider-based Layer 3 VPN networks, such as the ones using a BGP/
MPLS IP VPN [RFC4364] control plane, may have different traffic
filtering requirements than Internet service providers.
In these environments, the VPN customer network often has traffic
filtering capabilities towards their external network connections
(e.g., firewall facing public network connection). Less common is
the presence of traffic filtering capabilities between different VPN
attachment sites. In an any-to-any connectivity model, which is the
default, this means that site-to-site traffic is unfiltered.
In circumstances where a security threat does get propagated inside Flow Specifications received via this NLRI apply only to traffic that
the VPN customer network, there may not be readily available belongs to the VRF(s) in which it is imported. By default, traffic
mechanisms to provide mitigation via traffic filter. received from a remote PE is switched via an MPLS forwarding decision
and is not subject to filtering.
But also Internet service providers may use those VPNs for scenarios Contrary to the behavior specified for the non-VPN NLRI, Flow
like having the Internet routing table in a VRF. Therefore, Specifications are accepted by default, when received from remote PE
limitations described in Section 9.1 also apply to this section. routers.
The BGP Flow Specification addresses these limitations. The validation procedure (Section 6) and Traffic Filtering Actions
(Section 7) are the same as for IPv4.
10. Traffic Monitoring 9. Traffic Monitoring
Traffic filtering applications require monitoring and traffic Traffic filtering applications require monitoring and traffic
statistics facilities. While this is an implementation-specific statistics facilities. While this is an implementation specific
choice, implementations SHOULD provide: choice, implementations SHOULD provide:
o A mechanism to log the packet header of filtered traffic. o A mechanism to log the packet header of filtered traffic.
o A mechanism to count the number of matches for a given flow o A mechanism to count the number of matches for a given Flow
specification rule. Specification.
11. Error-Handling and Future NLRI Extensions 10. Error-Handling
In case BGP encounters an error in a Flow Specification UPDATE Error handling according to [RFC7606] SHOULD apply to this
message it SHOULD treat this message as Treat-as-withdraw according specification.
to [RFC7606] Section 2.
Possible reasons for an error are (for more reasons see also This document introduces Traffic Filtering Action Extended
[RFC7606]): Communities. Malformed Traffic Filtering Action Extended Communities
in the sense of [RFC7606] Section 7.14. are Extended Community values
that cannot be decoded according to Section 7 of this document.
o Incorrect implementation of this specification - the encoding/ 11. Future NLRI Extensions
decoding of the NLRI or traffic action extended-communities do not
comply with this specification.
o Unknown Flow Specification extensions - The sending party has Future Flow Specification extensions may introduce new Flow
implemented a Flow Specification NLRI extension unknown to the Specification components. In order to facilitate such extensions of
receiving party. the Flow Specification NLRI, in addition to the cases described in
[RFC7606], if BGP encounters an unknown Flow Specification component
in an UPDATE message, it SHOULD also treat this message as Treat-as-
withdraw as specified in [RFC7606] Section 2.
In order to facilitate future extensions of the Flow Specification The specification of a new Flow Specification Component Type SHOULD
NLRI, such extensions SHOULD specify a way to encode a "always-true" clearly identify what the criteria used to match packets forwarded by
match condition within the newly introduced components. This match the router is. This criteria should be meaningful across router hops
condition can be used to propagate (and apply) certain filters only and not depend on values that change hop-by-hop such as TTL or Layer
if a specific extension is known to the implemenation. 2 encapsulation.
Such extensions SHOULD also specify a way to encode an "always-match"
match condition within the newly introduced components (this is a
match condition, encoded with the newly introduced components: If
present on its own, matches all flows). This match condition can be
used to propagate (and apply) certain Flow Specifications only if a
specific extension is known to the implementation.
12. IANA Considerations 12. IANA Considerations
This section complies with [RFC7153]. This section complies with [RFC7153].
12.1. AFI/SAFI Definitions 12.1. AFI/SAFI Definitions
IANA maintains a registry entitled "SAFI Values". For the purpose of IANA maintains a registry entitled "SAFI Values". For the purpose of
this work, IANA updated the registry and allocated two additional this work, IANA is requested to update the following SAFIs to read
SAFIs: according to the table below (Note: This document obsoletes both
RFC7674 and RFC5575 and all references to those documents should be
deleted from the registry below):
+-------+------------------------------------------+----------------+ +-------+------------------------------------------+----------------+
| Value | Name | Reference | | Value | Name | Reference |
+-------+------------------------------------------+----------------+ +-------+------------------------------------------+----------------+
| 133 | IPv4 dissemination of Flow Specification | [this | | 133 | Dissemination of Flow Specification | [this |
| | rules | document] | | | rules | document] |
| 134 | VPNv4 dissemination of Flow | [this | | 134 | L3VPN Dissemination of Flow | [this |
| | Specification rules | document] | | | Specification rules | document] |
+-------+------------------------------------------+----------------+ +-------+------------------------------------------+----------------+
Table 3: Registry: SAFI Values Table 3: Registry: SAFI Values
12.2. Flow Component Definitions 12.2. Flow Component Definitions
A Flow Specification consists of a sequence of flow components, which A Flow Specification consists of a sequence of flow components, which
are identified by a an 8-bit component type. IANA has created and are identified by a an 8-bit component type. IANA has created and
maintains a registry entitled "Flow Spec Component Types". This maintains a registry entitled "Flow Spec Component Types". IANA is
document defines the following Component Type Codes: requested to update the reference for this registry to [this
document]. Furthermore the references to the values should be
updated according to the table below (Note: This document obsoletes
both RFC7674 and RFC5575 and all references to those documents should
be deleted from the registry below).
+-------+--------------------+-----------------+ +-------+--------------------+-----------------+
| Value | Name | Reference | | Value | Name | Reference |
+-------+--------------------+-----------------+ +-------+--------------------+-----------------+
| 1 | Destination Prefix | [this document] | | 1 | Destination Prefix | [this document] |
| 2 | Source Prefix | [this document] | | 2 | Source Prefix | [this document] |
| 3 | IP Protocol | [this document] | | 3 | IP Protocol | [this document] |
| 4 | Port | [this document] | | 4 | Port | [this document] |
| 5 | Destination port | [this document] | | 5 | Destination port | [this document] |
| 6 | Source port | [this document] | | 6 | Source port | [this document] |
skipping to change at page 26, line 25 skipping to change at page 27, line 25
| 8 | ICMP code | [this document] | | 8 | ICMP code | [this document] |
| 9 | TCP flags | [this document] | | 9 | TCP flags | [this document] |
| 10 | Packet length | [this document] | | 10 | Packet length | [this document] |
| 11 | DSCP | [this document] | | 11 | DSCP | [this document] |
| 12 | Fragment | [this document] | | 12 | Fragment | [this document] |
+-------+--------------------+-----------------+ +-------+--------------------+-----------------+
Table 4: Registry: Flow Spec Component Types Table 4: Registry: Flow Spec Component Types
In order to manage the limited number space and accommodate several In order to manage the limited number space and accommodate several
usages, the following policies defined by [RFC8126] used: usages, the following policies defined by [RFC8126] are used:
+--------------+-------------------------------+ +--------------+-------------------------------+
| Range | Policy | | Type Values | Policy |
+--------------+-------------------------------+ +--------------+-------------------------------+
| 0 | Invalid value | | 0 | Specification required |
| [1 .. 12] | Defined by this specification | | [1 .. 12] | Defined by this specification |
| [13 .. 127] | Specification required | | [13 .. 127] | Specification required |
| [128 .. 255] | First Come First Served | | [128 .. 255] | First Come First Served |
+--------------+-------------------------------+ +--------------+-------------------------------+
Table 5: Flow Spec Component Types Policies Table 5: Flow Spec Component Types Policies
The specification of a particular "Flow Spec Component Type" must
clearly identify what the criteria used to match packets forwarded by
the router is. This criteria should be meaningful across router hops
and not depend on values that change hop-by-hop such as TTL or Layer
2 encapsulation.
12.3. Extended Community Flow Specification Actions 12.3. Extended Community Flow Specification Actions
The Extended Community Flow Specification Action types defined in The Extended Community Flow Specification Action types defined in
this document consist of two parts: this document consist of two parts:
Type (BGP Transitive Extended Community Type) Type (BGP Transitive Extended Community Type)
Sub-Type Sub-Type
For the type-part, IANA maintains a registry entitled "BGP Transitive For the type-part, IANA maintains a registry entitled "BGP Transitive
Extended Community Types". For the purpose of this work (Section 7), Extended Community Types". For the purpose of this work (Section 7),
IANA updated the registry to contain the values listed below: IANA is requested to update the references to the following entries
according to the table below (Note: This document obsoletes both
RFC7674 and RFC5575 and all references to those documents should be
deleted in the registry below):
+-------+-----------------------------------------------+-----------+ +-------+-----------------------------------------------+-----------+
| Type | Name | Reference | | Type | Name | Reference |
| Value | | | | Value | | |
+-------+-----------------------------------------------+-----------+ +-------+-----------------------------------------------+-----------+
| 0x80 | Generic Transitive Experimental Use Extended | [RFC7153] |
| | Community (Sub-Types are defined in the | |
| | "Generic Transitive Experimental Use Extended | |
| | Community Sub-Types" registry) | |
| 0x81 | Generic Transitive Experimental Use Extended | [this | | 0x81 | Generic Transitive Experimental Use Extended | [this |
| | Community Part 2 (Sub-Types are defined in | document] | | | Community Part 2 (Sub-Types are defined in | document] |
| | the "Generic Transitive Experimental Use | [See | | | the "Generic Transitive Experimental Use | |
| | Extended Community Part 2 Sub-Types" | Note-1] | | | Extended Community Part 2 Sub-Types" | |
| | Registry) | | | | Registry) | |
| 0x82 | Generic Transitive Experimental Use Extended | [this | | 0x82 | Generic Transitive Experimental Use Extended | [this |
| | Community Part 3 (Sub-Types are defined in | document] | | | Community Part 3 (Sub-Types are defined in | document] |
| | the "Generic Transitive Experimental Use | [See | | | the "Generic Transitive Experimental Use | |
| | Extended Community Part 3 Sub-Types" | Note-1] | | | Extended Community Part 3 Sub-Types" | |
| | Registry) | | | | Registry) | |
+-------+-----------------------------------------------+-----------+ +-------+-----------------------------------------------+-----------+
Table 6: Registry: Generic Transitive Experimental Use Extended Table 6: Registry: BGP Transitive Extended Community Types
Community Types
Note-1: This document obsoletes RFC7674.
For the sub-type part of the extended community actions IANA For the sub-type part of the extended community Traffic Filtering
maintains and updated the following registries: Actions IANA maintains the following registries. IANA is requested
to update all names and references according to the tables below and
assign a new value for the "Flow spec traffic-rate-packets" Sub-Type
(Note: This document obsoletes both RFC7674 and RFC5575 and all
references to those documents should be deleted from the registries
below).
+----------+-----------------------------------------+--------------+ +----------+--------------------------------------------+-----------+
| Sub-Type | Name | Reference | | Sub-Type | Name | Reference |
| Value | | | | Value | | |
+----------+-----------------------------------------+--------------+ +----------+--------------------------------------------+-----------+
| 0x06 | Flow spec traffic-rate-bytes | [this | | 0x06 | Flow spec traffic-rate-bytes | [this |
| | | document] | | | | document] |
| TBD | Flow spec traffic-rate-packets | [this | | TBD | Flow spec traffic-rate-packets | [this |
| | | document] | | | | document] |
| 0x07 | Flow spec traffic-action (Use of the | [this | | 0x07 | Flow spec traffic-action (Use of the | [this |
| | "Value" field is defined in the | document] | | | "Value" field is defined in the "Traffic | document] |
| | "Traffic Action Fields" registry) | [See Note-2] | | | Action Fields" registry) | |
| 0x08 | Flow spec rt-redirect AS-2byte format | [this | | 0x08 | Flow spec rt-redirect AS-2byte format | [this |
| | | document] | | | | document] |
| 0x09 | Flow spec traffic-remarking | [this | | 0x09 | Flow spec traffic-remarking | [this |
| | | document] | | | | document] |
+----------+-----------------------------------------+--------------+ +----------+--------------------------------------------+-----------+
Table 7: Registry: Generic Transitive Experimental Use Extended Table 7: Registry: Generic Transitive Experimental Use Extended
Community Sub-Types Community Sub-Types
Note-2: This document obsoletes both RFC7674 and RFC5575. +----------------+--------------------------------+-----------------+
| Sub-Type Value | Name | Reference |
+-------------+---------------------------+-------------------------+ +----------------+--------------------------------+-----------------+
| Sub-Type | Name | Reference | | 0x08 | Flow spec rt-redirect IPv4 | [this document] |
| Value | | | | | format | |
+-------------+---------------------------+-------------------------+ +----------------+--------------------------------+-----------------+
| 0x08 | Flow spec rt-redirect | [this document] [See |
| | IPv4 format | Note-3] |
+-------------+---------------------------+-------------------------+
Table 8: Registry: Generic Transitive Experimental Use Extended Table 8: Registry: Generic Transitive Experimental Use Extended
Community Part 2 Sub-Types Community Part 2 Sub-Types
+-------------+----------------------------+------------------------+ +---------------+----------------------------------+----------------+
| Sub-Type | Name | Reference | | Sub-Type | Name | Reference |
| Value | | | | Value | | |
+-------------+----------------------------+------------------------+ +---------------+----------------------------------+----------------+
| 0x08 | Flow spec rt-redirect AS- | [this document] [See | | 0x08 | Flow spec rt-redirect AS-4byte | [this |
| | 4byte format | Note-3] | | | format | document] |
+-------------+----------------------------+------------------------+ +---------------+----------------------------------+----------------+
Table 9: Registry: Generic Transitive Experimental Use Extended Table 9: Registry: Generic Transitive Experimental Use Extended
Community Part 3 Sub-Types Community Part 3 Sub-Types
Note-3: This document obsoletes RFC7674, and becomes the only Furthermore IANA is requested to update the reference for the
reference for this table. registries "Generic Transitive Experimental Use Extended Community
Part 2 Sub-Types" and "Generic Transitive Experimental Use Extended
Community Part 3 Sub-Types" to [this document].
The "traffic-action" extended community (Section 7.3) defined in this The "traffic-action" extended community (Section 7.3) defined in this
document has 46 unused bits, which can be used to convey additional document has 46 unused bits, which can be used to convey additional
meaning. IANA created and maintains a new registry entitled: meaning. IANA created and maintains a registry entitled: "Traffic
"Traffic Action Fields". These values should be assigned via IETF Action Fields". IANA is requested to update the reference for this
Review rules only. The following traffic-action fields have been registry to [this document]. Furthermore IANA is requested to update
allocated: the references according to the table below. These values should be
assigned via IETF Review rules only (Note: This document obsoletes
both RFC7674 and RFC5575 and all references to those documents should
be deleted from the registry below).
+-----+-----------------+-----------------+ +-----+-----------------+-----------------+
| Bit | Name | Reference | | Bit | Name | Reference |
+-----+-----------------+-----------------+ +-----+-----------------+-----------------+
| 47 | Terminal Action | [this document] | | 47 | Terminal Action | [this document] |
| 46 | Sample | [this document] | | 46 | Sample | [this document] |
+-----+-----------------+-----------------+ +-----+-----------------+-----------------+
Table 10: Registry: Traffic Action Fields Table 10: Registry: Traffic Action Fields
13. Security Considerations 13. Security Considerations
As long as Flow Specifications are restricted to match the
corresponding unicast routing paths for the relevant prefixes
(Section 6), the security characteristics of this proposal are
equivalent to the existing security properties of BGP unicast
routing. Any relaxation of the validation procedure described in
Section 6 may allow unwanted Flow Specifications to be propagated and
thus unwanted Traffic Filtering Actions may be applied to flows.
Where the above mechanisms are not in place, this could open the door
to further denial-of-service attacks such as unwanted traffic
filtering, remarking or redirection.
Deployment of specific relaxations of the validation within an
administrative boundary of a network, defined by an AS or an AS-
Confederation boundary, may be useful in some networks for quickly
distributing filters to prevent denial-of-service attacks. For a
network to utilize this relaxation, the BGP policies must support
additional filtering since the origin AS field is empty.
Specifications relaxing the validation restrictions SHOULD contain
security considerations that provide details on the required
additional filtering. For example, the use of [RFC6811] to enhance
filtering within an AS confederation.
Inter-provider routing is based on a web of trust. Neighboring Inter-provider routing is based on a web of trust. Neighboring
autonomous systems are trusted to advertise valid reachability autonomous systems are trusted to advertise valid reachability
information. If this trust model is violated, a neighboring information. If this trust model is violated, a neighboring
autonomous system may cause a denial-of-service attack by advertising autonomous system may cause a denial-of-service attack by advertising
reachability information for a given prefix for which it does not reachability information for a given prefix for which it does not
provide service. provide service (unfiltered address space hijack). Since validation
of the Flow Specification is tied to the announcement of the best
As long as traffic filtering rules are restricted to match the unicast route, this may also cause this validation to fail and
corresponding unicast routing paths for the relevant prefixes, the consequently prevent Flow Specifications from being accepted by a
security characteristics of this proposal are equivalent to the peer. Possible mitigations are [RFC6811] and [RFC8205].
existing security properties of BGP unicast routing. However, this
document also specifies traffic filtering actions that may need
custom additional verification on the receiver side. See Section 14.
Where it is not the case, this would open the door to further denial-
of-service attacks.
Enabling firewall-like capabilities in routers without centralized Enabling firewall-like capabilities in routers without centralized
management could make certain failures harder to diagnose. For management could make certain failures harder to diagnose. For
example, it is possible to allow TCP packets to pass between a pair example, it is possible to allow TCP packets to pass between a pair
of addresses but not ICMP packets. It is also possible to permit of addresses but not ICMP packets. It is also possible to permit
packets smaller than 900 or greater than 1000 bytes to pass between a packets smaller than 900 or greater than 1000 bytes to pass between a
pair of addresses, but not packets whose length is in the range 900- pair of addresses, but not packets whose length is in the range 900-
1000. Such behavior may be confusing and these capabilities should 1000. Such behavior may be confusing and these capabilities should
be used with care whether manually configured or coordinated through be used with care whether manually configured or coordinated through
the protocol extensions described in this document. the protocol extensions described in this document.
14. Operational Security Considerations Flow Specification BGP speakers (e.g. automated DDoS controllers) not
properly programmed, algorithms that are not performing as expected,
or simply rogue systems may announce unintended Flow Specifications,
send updates at a high rate or generate a high number of Flow
Specifications. This may stress the receiving systems, exceed their
maximum capacity or may lead to unwanted Traffic Filtering Actions
being applied to flows.
While the general verification of the traffic filter NLRI is While the general verification of the Flow Specification NLRI is
specified in this document (Section 6) the traffic filtering actions specified in this document (Section 6) the Traffic Filtering Actions
received by a third party may need custom verification or filtering. received by a third party may need custom verification or filtering.
In particular all non traffic-rate actions may allow a third party to In particular all non traffic-rate actions may allow a third party to
modify packet forwarding properties and potentially gain access to modify packet forwarding properties and potentially gain access to
other routing-tables/VPNs or undesired queues. This can be avoided other routing-tables/VPNs or undesired queues. This can be avoided
by proper filtering of action communities at network borders and by by proper filtering/screening of the Traffic Filtering Action
mapping user-defined communities (see Section 7) to expose certain communities at network borders and only exposing a predefined subset
forwarding properties to third parties. of Traffic Filtering Actions (see Section 7) to third parties. One
way to achieve this is by mapping user-defined communities, that can
be set by the third party, to Traffic Filtering Actions and not
accepting Traffic Filtering Action extended communities from third
parties.
Since verfication of the traffic filtering NLRI is tied to the This extension adds additional information to Internet routers.
announcement of the best unicast route, a unfiltered address space These are limited in terms of the maximum number of data elements
hijack (e.g. advertisement of a more specific route) may cause this they can hold as well as the number of events they are able to
verification to fail and consequently prevent Flow Specification process in a given unit of time. Service providers need to consider
filters from being accepted by a peer. the maximum capacity of their devices and may need to limit the
number of Flow Specifications accepted and processed.
15. Original authors 14. Contributors
Barry Greene, Pedro Marques, Jared Mauch, Danny McPherson, and Barry Greene, Pedro Marques, Jared Mauch, Danny McPherson, and
Nischal Sheth were authors on RFC5575, and therefore are contributing Nischal Sheth were authors on [RFC5575], and therefore are
authors on this document. contributing authors on this document.
16. Acknowledgements 15. Acknowledgements
The authors would like to thank Yakov Rekhter, Dennis Ferguson, Chris The authors would like to thank Yakov Rekhter, Dennis Ferguson, Chris
Morrow, Charlie Kaufman, and David Smith for their comments for the Morrow, Charlie Kaufman, and David Smith for their comments for the
comments on the original RFC5575. Chaitanya Kodeboyina helped design comments on the original [RFC5575]. Chaitanya Kodeboyina helped
the flow validation procedure; and Steven Lin and Jim Washburn ironed design the flow validation procedure; and Steven Lin and Jim Washburn
out all the details necessary to produce a working implementation in ironed out all the details necessary to produce a working
the original RFC5575. implementation in the original [RFC5575].
A packet rate flowspec action was also discribed in a flowspec A packet rate Traffic Filtering Action was also described in a Flow
extention draft and the authors like to thank Wesley Eddy, Justin Specification extension draft and the authors like to thank Wesley
Dailey and Gilbert Clark for their work. Eddy, Justin Dailey and Gilbert Clark for their work.
Additional the authors would like to thank Alexander Mayrhofer, Additionally, the authors would like to thank Alexander Mayrhofer,
Nicolas Fevrier, Job Snijders, Jeffrey Haas and Adam Chappell for Nicolas Fevrier, Job Snijders, Jeffrey Haas and Adam Chappell for
their comments and review. their comments and review.
17. References 16. References
17.1. Normative References 16.1. Normative References
[IEEE.754.1985] [IEEE.754.1985]
IEEE, "Standard for Binary Floating-Point Arithmetic", IEEE, "Standard for Binary Floating-Point Arithmetic",
IEEE 754-1985, August 1985. IEEE 754-1985, August 1985.
[ISO_IEC_9899]
ISO, "Information technology -- Programming languages --
C", ISO/IEC 9899:2018, June 2018.
[RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
DOI 10.17487/RFC0768, August 1980,
<https://www.rfc-editor.org/info/rfc768>.
[RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791,
DOI 10.17487/RFC0791, September 1981,
<https://www.rfc-editor.org/info/rfc791>.
[RFC0792] Postel, J., "Internet Control Message Protocol", STD 5,
RFC 792, DOI 10.17487/RFC0792, September 1981,
<https://www.rfc-editor.org/info/rfc792>.
[RFC0793] Postel, J., "Transmission Control Protocol", STD 7, [RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, DOI 10.17487/RFC0793, September 1981, RFC 793, DOI 10.17487/RFC0793, September 1981,
<https://www.rfc-editor.org/info/rfc793>. <https://www.rfc-editor.org/info/rfc793>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black,
skipping to change at page 31, line 33 skipping to change at page 33, line 13
<https://www.rfc-editor.org/info/rfc4271>. <https://www.rfc-editor.org/info/rfc4271>.
[RFC4360] Sangli, S., Tappan, D., and Y. Rekhter, "BGP Extended [RFC4360] Sangli, S., Tappan, D., and Y. Rekhter, "BGP Extended
Communities Attribute", RFC 4360, DOI 10.17487/RFC4360, Communities Attribute", RFC 4360, DOI 10.17487/RFC4360,
February 2006, <https://www.rfc-editor.org/info/rfc4360>. February 2006, <https://www.rfc-editor.org/info/rfc4360>.
[RFC4364] Rosen, E. and Y. Rekhter, "BGP/MPLS IP Virtual Private [RFC4364] Rosen, E. and Y. Rekhter, "BGP/MPLS IP Virtual Private
Networks (VPNs)", RFC 4364, DOI 10.17487/RFC4364, February Networks (VPNs)", RFC 4364, DOI 10.17487/RFC4364, February
2006, <https://www.rfc-editor.org/info/rfc4364>. 2006, <https://www.rfc-editor.org/info/rfc4364>.
[RFC4456] Bates, T., Chen, E., and R. Chandra, "BGP Route
Reflection: An Alternative to Full Mesh Internal BGP
(IBGP)", RFC 4456, DOI 10.17487/RFC4456, April 2006,
<https://www.rfc-editor.org/info/rfc4456>.
[RFC4760] Bates, T., Chandra, R., Katz, D., and Y. Rekhter, [RFC4760] Bates, T., Chandra, R., Katz, D., and Y. Rekhter,
"Multiprotocol Extensions for BGP-4", RFC 4760, "Multiprotocol Extensions for BGP-4", RFC 4760,
DOI 10.17487/RFC4760, January 2007, DOI 10.17487/RFC4760, January 2007,
<https://www.rfc-editor.org/info/rfc4760>. <https://www.rfc-editor.org/info/rfc4760>.
[RFC5668] Rekhter, Y., Sangli, S., and D. Tappan, "4-Octet AS [RFC5668] Rekhter, Y., Sangli, S., and D. Tappan, "4-Octet AS
Specific BGP Extended Community", RFC 5668, Specific BGP Extended Community", RFC 5668,
DOI 10.17487/RFC5668, October 2009, DOI 10.17487/RFC5668, October 2009,
<https://www.rfc-editor.org/info/rfc5668>. <https://www.rfc-editor.org/info/rfc5668>.
skipping to change at page 32, line 14 skipping to change at page 33, line 46
[RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26, Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017, RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/info/rfc8126>. <https://www.rfc-editor.org/info/rfc8126>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
17.2. Informative References 16.2. Informative References
[I-D.ietf-idr-flow-spec-v6] [I-D.ietf-idr-flow-spec-v6]
McPherson, D., Raszuk, R., Pithawala, B., McPherson, D., Raszuk, R., Pithawala, B.,
akarch@cisco.com, a., and S. Hares, "Dissemination of Flow akarch@cisco.com, a., and S. Hares, "Dissemination of Flow
Specification Rules for IPv6", draft-ietf-idr-flow-spec- Specification Rules for IPv6", draft-ietf-idr-flow-spec-
v6-09 (work in progress), November 2017. v6-09 (work in progress), November 2017.
[RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)",
RFC 4303, DOI 10.17487/RFC4303, December 2005, RFC 4303, DOI 10.17487/RFC4303, December 2005,
<https://www.rfc-editor.org/info/rfc4303>. <https://www.rfc-editor.org/info/rfc4303>.
17.3. URIs [RFC5575] Marques, P., Sheth, N., Raszuk, R., Greene, B., Mauch, J.,
and D. McPherson, "Dissemination of Flow Specification
Rules", RFC 5575, DOI 10.17487/RFC5575, August 2009,
<https://www.rfc-editor.org/info/rfc5575>.
[RFC6811] Mohapatra, P., Scudder, J., Ward, D., Bush, R., and R.
Austein, "BGP Prefix Origin Validation", RFC 6811,
DOI 10.17487/RFC6811, January 2013,
<https://www.rfc-editor.org/info/rfc6811>.
[RFC7674] Haas, J., Ed., "Clarification of the Flowspec Redirect
Extended Community", RFC 7674, DOI 10.17487/RFC7674,
October 2015, <https://www.rfc-editor.org/info/rfc7674>.
[RFC8205] Lepinski, M., Ed. and K. Sriram, Ed., "BGPsec Protocol
Specification", RFC 8205, DOI 10.17487/RFC8205, September
2017, <https://www.rfc-editor.org/info/rfc8205>.
16.3. URIs
[1] https://github.com/stoffi92/flowspec-cmp [1] https://github.com/stoffi92/flowspec-cmp
Appendix A. Comparison with RFC 5575 Appendix A. Python code: flow_rule_cmp
This document includes numerous editorial changes to RFC5575. It is <CODE BEGINS>
recommended to read the entire document. The authors, however want """
to point out the following technical changes to RFC5575: Copyright (c) 2019 IETF Trust and the persons identified as authors of
the code. All rights reserved.
Section 1 introduces the Flow Specification NLRI. In RFC5575 this Redistribution and use in source and binary forms, with or without
NLRI was defined as an opaque-key in BGPs database. This modification, is permitted pursuant to, and subject to the license
terms contained in, the Simplified BSD License set forth in Section
4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info).
"""
import itertools
import ipaddress
def flow_rule_cmp(a, b):
for comp_a, comp_b in itertools.zip_longest(a.components,
b.components):
# If a component type does not exist in one rule
# this rule has lower precedence
if not comp_a:
return B_HAS_PRECEDENCE
if not comp_b:
return A_HAS_PRECEDENCE
# higher precedence for lower component type
if comp_a.component_type < comp_b.component_type:
return A_HAS_PRECEDENCE
if comp_a.component_type > comp_b.component_type:
return B_HAS_PRECEDENCE
# component types are equal -> type specific comparison
if comp_a.component_type in (IP_DESTINATION, IP_SOURCE):
# assuming comp_a.value, comp_b.value of type
# ipaddress.IPv4Network
if comp_a.value.overlaps(comp_b.value):
# longest prefixlen has precedence
if comp_a.value.prefixlen > comp_b.value.prefixlen:
return A_HAS_PRECEDENCE
if comp_a.value.prefixlen < comp_b.value.prefixlen:
return B_HAS_PRECEDENCE
# components equal -> continue with next component
elif comp_a.value > comp_b.value:
return B_HAS_PRECEDENCE
elif comp_a.value < comp_b.value:
return A_HAS_PRECEDENCE
else:
# assuming comp_a.value, comp_b.value of type bytearray
if len(comp_a.value) == len(comp_b.value):
if comp_a.value > comp_b.value:
return B_HAS_PRECEDENCE
if comp_a.value < comp_b.value:
return A_HAS_PRECEDENCE
# components equal -> continue with next component
else:
common = min(len(comp_a.value), len(comp_b.value))
if comp_a.value[:common] > comp_b.value[:common]:
return B_HAS_PRECEDENCE
elif comp_a.value[:common] < comp_b.value[:common]:
return A_HAS_PRECEDENCE
# the first common bytes match
elif len(comp_a.value) > len(comp_b.value):
return A_HAS_PRECEDENCE
else:
return B_HAS_PRECEDENCE
return EQUAL
<CODE ENDS>
Appendix B. Comparison with RFC 5575
This document includes numerous editorial changes to [RFC5575]. It
also completely incorporates the redirect action clarification
document [RFC7674]. It is recommended to read the entire document.
The authors, however want to point out the following technical
changes to [RFC5575]:
Section 1 introduces the Flow Specification NLRI. In [RFC5575]
this NLRI was defined as an opaque-key in BGPs database. This
specification has removed all references to a opaque-key property. specification has removed all references to a opaque-key property.
BGP is able understand the NLRI encoding. This change also BGP is able to understand the NLRI encoding. This change also
resulted in a new section regarding error-handling and resulted in a new section regarding error-handling and
extensibility (Section 11). extensibility (Section 10 and Section 11).
Section 4.2.3 defines a numeric operator and comparison bit Section 4.2.2.3 defines a numeric operator and comparison bit
combinations. In RFC5575 the meaning of those bit combination was combinations. In [RFC5575] the meaning of those bit combination
not explicitly defined and left open to the reader. was not explicitly defined and left open to the reader.
Section 4.2.3 - Section 4.2.8, Section 4.2.10, Section 4.2.11 make Section 4.2.2.3 - Section 4.2.2.8, Section 4.2.2.10,
use of the above numeric operator. The allowed length of the Section 4.2.2.11 make use of the above numeric operator. The
comparison value was not consistently defined in RFC5575. allowed length of the comparison value was not consistently
defined in [RFC5575].
Section 7 defines all traffic action extended communities as Section 7 defines all Traffic Filtering Action Extended
transitive extended communities. RFC5575 defined the traffic-rate communities as transitive extended communities. [RFC5575] defined
action to be non-transitive and did not define the transitivity of the traffic-rate action to be non-transitive and did not define
the other action communities at all. the transitivity of the other Traffic Filtering Action communities
at all.
Section 7.2 introduces a new traffic filtering action (traffic- Section 7.2 introduces a new Traffic Filtering Action (traffic-
rate-packets). This action did not exist in RFC5575. rate-packets). This action did not exist in [RFC5575].
Section 7.4 contains the same redirect actions already defined in Section 7.4 contains the same redirect actions already defined in
RFC5575 however, these actions have been renamed to "rt-redirect" [RFC5575] however, these actions have been renamed to "rt-
to make it clearer that the redirection is based on route-target. redirect" to make it clearer that the redirection is based on
route-target. This section also completely incorporates the
[RFC7674] clarifications of the Flowspec Redirect Extended
Community.
Section 7.6 contains general considerations on interfering traffic Section 7.7 contains general considerations on interfering traffic
actions. Section 7.3 also cross-references this section. RFC5575 actions. Section 7.3 also cross-references this section.
did not mention this. [RFC5575] did not mention this.
Section 11 contains a modified error handling to gracefully allow Section 10 contains new error handling.
future extensions of flow specification.
Section 11 describes graceful handling of unknown Flow
Specification components to allow future extensions.
Authors' Addresses Authors' Addresses
Christoph Loibl Christoph Loibl
Next Layer Communications Next Layer Communications
Mariahilfer Guertel 37/7 Mariahilfer Guertel 37/7
Vienna 1150 Vienna 1150
AT AT
Phone: +43 664 1176414 Phone: +43 664 1176414
 End of changes. 223 change blocks. 
799 lines changed or deleted 978 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/