idnits 2.17.1 draft-ietf-idr-flow-spec-v6-21.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == The 'Updates: ' line in the draft header should list only the _numbers_ of the RFCs which will be updated by this document (if approved); it should not include the word 'RFC' in the list. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 24, 2020) is 1241 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 664 Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 IDR Working Group C. Loibl, Ed. 3 Internet-Draft next layer Telekom GmbH 4 Updates: I-D.ietf-idr-rfc5575bis (if R. Raszuk, Ed. 5 approved) Bloomberg LP 6 Intended status: Standards Track S. Hares, Ed. 7 Expires: May 28, 2021 Huawei 8 November 24, 2020 10 Dissemination of Flow Specification Rules for IPv6 11 draft-ietf-idr-flow-spec-v6-21 13 Abstract 15 Dissemination of Flow Specification Rules I-D.ietf-idr-rfc5575bis 16 provides a Border Gateway Protocol extension for the propagation of 17 traffic flow information for the purpose of rate limiting or 18 filtering IPv4 protocol data packets. 20 This document extends I-D.ietf-idr-rfc5575bis with IPv6 21 functionality. It also updates I-D.ietf-idr-rfc5575bis by changing 22 the IANA Flow Spec Component Types registry. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at https://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on May 28, 2021. 41 Copyright Notice 43 Copyright (c) 2020 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (https://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 1.1. Definitions of Terms Used in This Memo . . . . . . . . . 3 60 2. IPv6 Flow Specification encoding in BGP . . . . . . . . . . . 3 61 3. IPv6 Flow Specification components . . . . . . . . . . . . . 3 62 3.1. Type 1 - Destination IPv6 Prefix . . . . . . . . . . . . 4 63 3.2. Type 2 - Source IPv6 Prefix . . . . . . . . . . . . . . . 4 64 3.3. Type 3 - Upper-Layer Protocol . . . . . . . . . . . . . . 5 65 3.4. Type 7 - ICMPv6 Type . . . . . . . . . . . . . . . . . . 5 66 3.5. Type 8 - ICMPv6 Code . . . . . . . . . . . . . . . . . . 5 67 3.6. Type 12 - Fragment . . . . . . . . . . . . . . . . . . . 6 68 3.7. Type 13 - Flow Label (new) . . . . . . . . . . . . . . . 7 69 3.8. Encoding Example . . . . . . . . . . . . . . . . . . . . 7 70 4. Ordering of Flow Specifications . . . . . . . . . . . . . . . 9 71 5. Validation Procedure . . . . . . . . . . . . . . . . . . . . 10 72 6. IPv6 Traffic Filtering Action changes . . . . . . . . . . . . 10 73 6.1. Redirect IPv6 (rt-redirect-ipv6) Type/Sub-Type 0x80/TBD . 10 74 7. Security Considerations . . . . . . . . . . . . . . . . . . . 10 75 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 76 8.1. Flow Spec IPv6 Component Types . . . . . . . . . . . . . 11 77 8.1.1. Registry Template . . . . . . . . . . . . . . . . . . 11 78 8.1.2. Registry Contents . . . . . . . . . . . . . . . . . . 11 79 8.2. Extended Community Flow Spec IPv6 Actions . . . . . . . . 13 80 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 14 81 10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 14 82 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 14 83 11.1. Normative References . . . . . . . . . . . . . . . . . . 14 84 11.2. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 16 85 Appendix A. Example python code: flow_rule_cmp_v6 . . . . . . . 16 86 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 19 88 1. Introduction 90 The growing amount of IPv6 traffic in private and public networks 91 requires the extension of tools used in IPv4-only networks to also 92 support IPv6 data packets. 94 This document analyzes the differences between describing IPv6 95 [RFC8200] flows and those of IPv4 packets. It specifies new Border 96 Gateway Protocol [RFC4271] encoding formats to enable Dissemination 97 of Flow Specification Rules [I-D.ietf-idr-rfc5575bis] for IPv6. 99 This specification is an extension of the base 100 [I-D.ietf-idr-rfc5575bis]. It only defines the delta changes 101 required to support IPv6 while all other definitions and operation 102 mechanisms of Dissemination of Flow Specification Rules will remain 103 in the main specification and will not be repeated here. 105 1.1. Definitions of Terms Used in This Memo 107 AFI - Address Family Identifier. 109 AS - Autonomous System. 111 NLRI - Network Layer Reachability Information. 113 SAFI - Subsequent Address Family Identifier. 115 VRF - Virtual Routing and Forwarding instance. 117 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 118 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 119 "OPTIONAL" in this document are to be interpreted as described in BCP 120 14 [RFC2119] [RFC8174] when, and only when, they appear in all 121 capitals, as shown here. 123 2. IPv6 Flow Specification encoding in BGP 125 [I-D.ietf-idr-rfc5575bis] defines SAFIs 133 (Dissemination of Flow 126 Specification) and 134 (L3VPN Dissemination of Flow Specification) in 127 order to carry the corresponding Flow Specification. 129 Implementations wishing to exchange IPv6 Flow Specifications MUST use 130 BGP's Capability Advertisement facility to exchange the Multiprotocol 131 Extension Capability Code (Code 1) as defined in [RFC4760]. The 132 (AFI, SAFI) pair carried in the Multiprotocol Extension Capability 133 MUST be: (AFI=2, SAFI=133) for IPv6 Flow Specification, and (AFI=2, 134 SAFI=134) for VPNv6 Flow Specification. 136 3. IPv6 Flow Specification components 138 The encoding of each of the components begins with a type field (1 139 octet) followed by a variable length parameter. The following 140 sections define component types and parameter encodings for IPv6. 142 Types 4 (Port), 5 (Destination Port), 6 (Source Port), 9 (TCP flags), 143 10 (Packet length) and 11 (DSCP), as defined in 145 [I-D.ietf-idr-rfc5575bis], also apply to IPv6. Note that IANA is 146 requested to update the "Flow Spec Component Types" registry in order 147 to contain both IPv4 and IPv6 Flow Specification component type 148 numbers in a single registry (Section 8). 150 3.1. Type 1 - Destination IPv6 Prefix 152 Encoding: 155 Defines the destination prefix to match. The offset has been defined 156 to allow for flexible matching to portions of an IPv6 address where 157 one is required to skip over the first N bits of the address (these 158 bits skipped are often indicated as "don't care" bits). This can be 159 especially useful where part of the IPv6 address consists of an 160 embedded IPv4 address and matching needs to happen only on the 161 embedded IPv4 address. The encoded pattern contains enough octets 162 for the bits used in matching (length minus offset bits). 164 length - The length field indicates the N-th most significant bit in 165 the address where bitwise pattern matching stops. 167 offset - The offset field indicates the number of most significant 168 address bits to skip before bitwise pattern matching starts. 170 pattern - Contains the matching pattern. The length of the pattern 171 is defined by the number of bits needed for pattern matching 172 (length minus offset). 174 padding - The minimum number of bits required to pad the component 175 to an octet boundary. Padding bits MUST be 0 on encoding and MUST 176 be ignored on decoding. 178 length = offset = 0 matches every address, otherwise length MUST be 179 in the range offset < length < 129 or the component is malformed. 181 Note: This Flow Specification component can be represented by the 182 notation ipv6address/length if offset is 0, or ipv6address/offset- 183 length. The ipv6address in this notation is the textual IPv6 184 representation of the pattern shifted to the right by the number of 185 offset bits. See also Section 3.8. 187 3.2. Type 2 - Source IPv6 Prefix 189 Encoding: 191 Defines the source prefix to match. The length, offset, pattern and 192 padding are the same as in Section 3.1. 194 3.3. Type 3 - Upper-Layer Protocol 196 Encoding: 198 Contains a list of {numeric_op, value} pairs that are used to match 199 the first Next Header value octet in IPv6 packets that is not an 200 extension header and thus indicates that the next item in the packet 201 is the corresponding upper-layer header (see [RFC8200] Section 4). 203 This component uses the Numeric Operator (numeric_op) described in 204 [I-D.ietf-idr-rfc5575bis] Section 4.2.1.1. Type 3 component values 205 SHOULD be encoded as single octet (numeric_op len=00). 207 Note: While IPv6 allows for more than one Next Header field in the 208 packet, the main goal of the Type 3 Flow Specification component is 209 to match on the first upper-layer IP protocol value. Therefore the 210 definition is limited to match only on this specific Next Header 211 field in the packet. 213 3.4. Type 7 - ICMPv6 Type 215 Encoding: 217 Defines a list of {numeric_op, value} pairs used to match the type 218 field of an ICMPv6 packet (see also [RFC4443] Section 2.1). 220 This component uses the Numeric Operator (numeric_op) described in 221 [I-D.ietf-idr-rfc5575bis] Section 4.2.1.1. Type 7 component values 222 SHOULD be encoded as single octet (numeric_op len=00). 224 In case of the presence of the ICMPv6 Type component only ICMPv6 225 packets can match the entire Flow Specification. The ICMPv6 Type 226 component, if present, never matches when the packet's upper-layer IP 227 protocol value is not 58 (ICMPv6), if the packet is fragmented and 228 this is not the first fragment, or if the system is unable to locate 229 the transport header. Different implementations may or may not be 230 able to decode the transport header. 232 3.5. Type 8 - ICMPv6 Code 234 Encoding: 236 Defines a list of {numeric_op, value} pairs used to match the code 237 field of an ICMPv6 packet (see also [RFC4443] Section 2.1). 239 This component uses the Numeric Operator (numeric_op) described in 240 [I-D.ietf-idr-rfc5575bis] Section 4.2.1.1. Type 8 component values 241 SHOULD be encoded as single octet (numeric_op len=00). 243 In case of the presence of the ICMPv6 Code component only ICMPv6 244 packets can match the entire Flow Specification. The ICMPv6 code 245 component, if present, never matches when the packet's upper-layer IP 246 protocol value is not 58 (ICMPv6), if the packet is fragmented and 247 this is not the first fragment, or if the system is unable to locate 248 the transport header. Different implementations may or may not be 249 able to decode the transport header. 251 3.6. Type 12 - Fragment 253 Encoding: 255 Defines a list of {bitmask_op, bitmask} pairs used to match specific 256 IP fragments. 258 This component uses the Bitmask Operator (bitmask_op) described in 259 [I-D.ietf-idr-rfc5575bis] Section 4.2.1.2. The Type 12 component 260 bitmask MUST be encoded as single octet bitmask (bitmask_op len=00). 262 0 1 2 3 4 5 6 7 263 +---+---+---+---+---+---+---+---+ 264 | 0 | 0 | 0 | 0 |LF |FF |IsF| 0 | 265 +---+---+---+---+---+---+---+---+ 267 Figure 1: Fragment Bitmask Operand 269 Bitmask values: 271 IsF - Is a fragment other than the first - match if IPv6 Fragment 272 Header ([RFC8200] Section 4.5) Fragment Offset is not 0 274 FF - First fragment - match if IPv6 Fragment Header ([RFC8200] 275 Section 4.5) Fragment Offset is 0 AND M flag is 1 277 LF - Last fragment - match if IPv6 Fragment Header ([RFC8200] 278 Section 4.5) Fragment Offset is not 0 AND M flag is 0 280 0 - MUST be set to 0 on NLRI encoding, and MUST be ignored during 281 decoding 283 3.7. Type 13 - Flow Label (new) 285 Encoding: 287 Contains a list of {numeric_op, value} pairs that are used to match 288 the 20-bit Flow Label IPv6 header field ([RFC8200] Section 3). 290 This component uses the Numeric Operator (numeric_op) described in 291 [I-D.ietf-idr-rfc5575bis] Section 4.2.1.1. Type 13 component values 292 SHOULD be encoded as 4-octet quantities (numeric_op len=10). 294 3.8. Encoding Example 296 3.8.1. Example 1 298 The following example demonstrates the prefix encoding for: "packets 299 from ::1234:5678:9a00:0/64-104 to 2001:db8::/32 and upper-layer- 300 protocol tcp". 302 +--------+----------------------+-------------------------+----------+ 303 | length | destination | source | ul-proto | 304 +--------+----------------------+-------------------------+----------+ 305 | 0x12 | 01 20 00 20 01 0D B8 | 02 68 40 12 34 56 78 9A | 03 81 06 | 306 +--------+----------------------+-------------------------+----------+ 308 Decoded: 310 +-------+------------+-------------------------------+ 311 | Value | | | 312 +-------+------------+-------------------------------+ 313 | 0x12 | length | 18 octets (len<240 1-octet) | 314 | 0x01 | type | Type 1 - Dest. IPv6 Prefix | 315 | 0x20 | length | 32 bit | 316 | 0x00 | offset | 0 bit | 317 | 0x20 | pattern | | 318 | 0x01 | pattern | | 319 | 0x0D | pattern | | 320 | 0xB8 | pattern | (no padding needed) | 321 | 0x02 | type | Type 2 - Source IPv6 Prefix | 322 | 0x68 | length | 104 bit | 323 | 0x40 | offset | 64 bit | 324 | 0x12 | pattern | | 325 | 0x34 | pattern | | 326 | 0x56 | pattern | | 327 | 0x78 | pattern | | 328 | 0x9A | pattern | (no padding needed) | 329 | 0x03 | type | Type 3 - upper-layer-proto | 330 | 0x81 | numeric_op | end-of-list, value size=1, == | 331 | 0x06 | value | 06 | 332 +-------+------------+-------------------------------+ 334 This constitutes a NLRI with a NLRI length of 18 octets. 336 Padding is not needed either for the destination prefix pattern 337 (length - offset = 32 bit) or for the source prefix pattern (length - 338 offset = 40 bit), as both patterns end on an octet boundary. 340 3.8.2. Example 2 342 The following example demonstrates the prefix encoding for: "all 343 packets from ::1234:5678:9a00:0/65-104 to 2001:db8::/32". 345 +--------+----------------------+-------------------------+ 346 | length | destination | source | 347 +--------+----------------------+-------------------------+ 348 | 0x0f | 01 20 00 20 01 0D B8 | 02 68 41 24 68 ac f1 34 | 349 +--------+----------------------+-------------------------+ 351 Decoded: 353 +-------+-------------+-------------------------------+ 354 | Value | | | 355 +-------+-------------+-------------------------------+ 356 | 0x0f | length | 15 octets (len<240 1-octet) | 357 | 0x01 | type | Type 1 - Dest. IPv6 Prefix | 358 | 0x20 | length | 32 bit | 359 | 0x00 | offset | 0 bit | 360 | 0x20 | pattern | | 361 | 0x01 | pattern | | 362 | 0x0D | pattern | | 363 | 0xB8 | pattern | (no padding needed) | 364 | 0x02 | type | Type 2 - Source IPv6 Prefix | 365 | 0x68 | length | 104 bit | 366 | 0x41 | offset | 65 bit | 367 | 0x24 | pattern | | 368 | 0x68 | pattern | | 369 | 0xac | pattern | | 370 | 0xf1 | pattern | | 371 | 0x34 | pattern/pad | (contains 1 bit padding) | 372 +-------+-------------+-------------------------------+ 374 This constitutes a NLRI with a NLRI length of 15 octets. 376 The source prefix pattern is 104 - 65 = 39 bits in length. After the 377 pattern one bit of padding needs to be added so that the component 378 ends on a octet boundary. However, only the first 39 bits are 379 actually used for bitwise pattern matching starting with a 65 bit 380 offset from the topmost bit of the address. 382 4. Ordering of Flow Specifications 384 The definition for the order of traffic filtering rules from 385 [I-D.ietf-idr-rfc5575bis] Section 5.1 is reused with new 386 consideration for the IPv6 prefix offset. As long as the offsets are 387 equal, the comparison is the same, retaining longest-prefix-match 388 semantics. If the offsets are not equal, the lowest offset has 389 precedence, as this Flow Specification matches the most significant 390 bit. 392 The code in Appendix A shows a Python3 implementation of the 393 resulting comparison algorithm. The full code was tested with Python 394 3.7.2 and can be obtained at https://github.com/stoffi92/draft-ietf- 395 idr-flow-spec-v6/tree/master/flowspec-cmp [1]. 397 5. Validation Procedure 399 The validation procedure is the same as specified in 400 [I-D.ietf-idr-rfc5575bis] Section 6 with the exception that item a) 401 of the validation procedure should now read as follows: 403 a) A destination prefix component with offset=0 is embedded in the 404 Flow Specification 406 6. IPv6 Traffic Filtering Action changes 408 Traffic Filtering Actions from [I-D.ietf-idr-rfc5575bis] Section 7 409 can also be applied to IPv6 Flow Specifications. To allow an IPv6 410 address specific route-target, a new Traffic Filtering Action IPv6 411 address specific extended community is specified in Section 6.1 412 below. 414 6.1. Redirect IPv6 (rt-redirect-ipv6) Type/Sub-Type 0x80/TBD 416 The redirect IPv6 address specific extended community allows the 417 traffic to be redirected to a VRF routing instance that lists the 418 specified IPv6 address specific route-target in its import policy. 419 If several local instances match this criteria, the choice between 420 them is a local matter (for example, the instance with the lowest 421 Route Distinguisher value can be elected). 423 This extended community uses the same encoding as the IPv6 address 424 specific Route Target extended community [RFC5701] Section 2 with the 425 high-order octet of the Type always set to 0x80 and the Sub-Type 426 always TBD. 428 The Local Administrator sub-field contains a number from a numbering 429 space that is administered by the organization to which the IP 430 address carried in the Global Administrator sub-field has been 431 assigned by an appropriate authority. 433 Interferes with: All BGP Flow Specification redirect Traffic 434 Filtering Actions (with itself and those specified in 435 [I-D.ietf-idr-rfc5575bis] Section 7.4). 437 7. Security Considerations 439 This document extends the functionality in [I-D.ietf-idr-rfc5575bis] 440 to be applicable to IPv6 data packets. The same Security 441 Considerations from [I-D.ietf-idr-rfc5575bis] now also apply to IPv6 442 networks. 444 [RFC7112] describes the impact of oversized IPv6 header chains when 445 trying to match on the transport header; [RFC8200] Section 4.5 also 446 requires that the first fragment must include the upper-layer header 447 but there could be wrongly formatted packets not respecting 448 [RFC8200]. IPv6 Flow Specification component type 3 (Section 3.3) 449 will not be enforced for those illegal packets. Moreover, there are 450 hardware limitations in several routers ([RFC8883] Section 1) that 451 may make it impossible to enforce a policy signaled by a type 3 Flow 452 Specification component or Flow Specification components that match 453 on upper-layer properties of the packet. 455 8. IANA Considerations 457 This section complies with [RFC7153]. 459 8.1. Flow Spec IPv6 Component Types 461 IANA has created and maintains a registry entitled "Flow Spec 462 Component Types". IANA is requested to add [this document] to the 463 reference for this registry. Furthermore the registry should be 464 rewritten to also contain the IPv6 Flow Specification Component Types 465 as described below. The registration procedure should remain 466 unchanged. 468 8.1.1. Registry Template 470 Type Value: 471 Contains the assigned Flow Specification component type value. 473 IPv4 Name: 474 Contains the associated IPv4 Flow Specification component name 475 as specified in [I-D.ietf-idr-rfc5575bis]. 477 IPv6 Name: 478 Contains the associated IPv6 Flow Specification component name 479 as specified in this document. 481 Reference: 482 Contains referenced to the specifications. 484 8.1.2. Registry Contents 486 + Type Value: 0 487 + IPv4 Name: Reserved 488 + IPv6 Name: Reserved 489 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 490 + Type Value: 1 491 + IPv4 Name: Destination Prefix 492 + IPv6 Name: Destination IPv6 Prefix 493 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 495 + Type Value: 2 496 + IPv4 Name: Source Prefix 497 + IPv6 Name: Source IPv6 Prefix 498 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 500 + Type Value: 3 501 + IPv4 Name: IP Protocol 502 + IPv6 Name: Upper-Layer Protocol 503 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 505 + Type Value: 4 506 + IPv4 Name: Port 507 + IPv6 Name: Port 508 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 510 + Type Value: 5 511 + IPv4 Name: Destination Port 512 + IPv6 Name: Destination Port 513 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 515 + Type Value: 6 516 + IPv4 Name: Source Port 517 + IPv6 Name: Source Port 518 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 520 + Type Value: 7 521 + IPv4 Name: ICMP Type 522 + IPv6 Name: ICMPv6 Type 523 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 525 + Type Value: 8 526 + IPv4 Name: ICMP Code 527 + IPv6 Name: ICMPv6 Code 528 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 529 + Type Value: 9 530 + IPv4 Name: TCP flags 531 + IPv6 Name: TCP flags 532 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 534 + Type Value: 10 535 + IPv4 Name: Packet length 536 + IPv6 Name: Packet length 537 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 539 + Type Value: 11 540 + IPv4 Name: DSCP 541 + IPv6 Name: DSCP 542 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 544 + Type Value: 12 545 + IPv4 Name: Fragment 546 + IPv6 Name: Fragment 547 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 549 + Type Value: 13 550 + IPv4 Name: Unassigned 551 + IPv6 Name: Flow Label 552 + Reference: [this document] 554 + Type Value: 14-254 555 + IPv4 Name: Unassigned 556 + IPv6 Name: Unassigned 557 + Reference: 559 + Type Value: 255 560 + IPv4 Name: Reserved 561 + IPv6 Name: Reserved 562 + Reference: [I-D.ietf-idr-rfc5575bis] [this document] 564 8.2. Extended Community Flow Spec IPv6 Actions 566 IANA maintains a registry entitled "Generic Transitive Experimental 567 Use Extended Community Sub-Types". For the purpose of this work, 568 IANA is requested to assign a new value: 570 +----------------+--------------------------------+-----------------+ 571 | Sub-Type Value | Name | Reference | 572 +----------------+--------------------------------+-----------------+ 573 | TBD | Flow spec rt-redirect-ipv6 | [this document] | 574 | | format | | 575 +----------------+--------------------------------+-----------------+ 577 Table 1: Registry: Generic Transitive Experimental Use Extended 578 Community Sub-Types 580 9. Acknowledgements 582 Authors would like to thank Pedro Marques, Hannes Gredler, Bruno 583 Rijsman, Brian Carpenter, and Thomas Mangin for their valuable input. 585 10. Contributors 587 Danny McPherson 588 Verisign, Inc. 590 Email: dmcpherson@verisign.com 592 Burjiz Pithawala 593 Individual 595 Email: burjizp@gmail.com 597 Andy Karch 598 Cisco Systems 599 170 West Tasman Drive 600 San Jose, CA 95134 601 USA 603 Email: akarch@cisco.com 605 11. References 607 11.1. Normative References 609 [I-D.ietf-idr-rfc5575bis] 610 Loibl, C., Hares, S., Raszuk, R., McPherson, D., and M. 611 Bacher, "Dissemination of Flow Specification Rules", 612 draft-ietf-idr-rfc5575bis-27 (work in progress), October 613 2020. 615 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 616 Requirement Levels", BCP 14, RFC 2119, 617 DOI 10.17487/RFC2119, March 1997, 618 . 620 [RFC4271] Rekhter, Y., Ed., Li, T., Ed., and S. Hares, Ed., "A 621 Border Gateway Protocol 4 (BGP-4)", RFC 4271, 622 DOI 10.17487/RFC4271, January 2006, 623 . 625 [RFC4443] Conta, A., Deering, S., and M. Gupta, Ed., "Internet 626 Control Message Protocol (ICMPv6) for the Internet 627 Protocol Version 6 (IPv6) Specification", STD 89, 628 RFC 4443, DOI 10.17487/RFC4443, March 2006, 629 . 631 [RFC4760] Bates, T., Chandra, R., Katz, D., and Y. Rekhter, 632 "Multiprotocol Extensions for BGP-4", RFC 4760, 633 DOI 10.17487/RFC4760, January 2007, 634 . 636 [RFC5701] Rekhter, Y., "IPv6 Address Specific BGP Extended Community 637 Attribute", RFC 5701, DOI 10.17487/RFC5701, November 2009, 638 . 640 [RFC7112] Gont, F., Manral, V., and R. Bonica, "Implications of 641 Oversized IPv6 Header Chains", RFC 7112, 642 DOI 10.17487/RFC7112, January 2014, 643 . 645 [RFC7153] Rosen, E. and Y. Rekhter, "IANA Registries for BGP 646 Extended Communities", RFC 7153, DOI 10.17487/RFC7153, 647 March 2014, . 649 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 650 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 651 May 2017, . 653 [RFC8200] Deering, S. and R. Hinden, "Internet Protocol, Version 6 654 (IPv6) Specification", STD 86, RFC 8200, 655 DOI 10.17487/RFC8200, July 2017, 656 . 658 [RFC8883] Herbert, T., "ICMPv6 Errors for Discarding Packets Due to 659 Processing Limits", RFC 8883, DOI 10.17487/RFC8883, 660 September 2020, . 662 11.2. URIs 664 [1] https://github.com/stoffi92/draft-ietf-idr-flow-spec- 665 v6/tree/master/flowspec-cmp 667 Appendix A. Example python code: flow_rule_cmp_v6 669 670 """ 671 Copyright (c) 2020 IETF Trust and the persons identified as authors 672 of the code. All rights reserved. 674 Redistribution and use in source and binary forms, with or without 675 modification, is permitted pursuant to, and subject to the license 676 terms contained in, the Simplified BSD License set forth in Section 677 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents 678 (https://trustee.ietf.org/license-info). 679 """ 681 import itertools 682 import collections 683 import ipaddress 685 EQUAL = 0 686 A_HAS_PRECEDENCE = 1 687 B_HAS_PRECEDENCE = 2 688 IP_DESTINATION = 1 689 IP_SOURCE = 2 691 FS_component = collections.namedtuple('FS_component', 692 'component_type value') 694 class FS_IPv6_prefix_component: 695 def __init__(self, prefix, offset=0, 696 component_type=IP_DESTINATION): 697 self.offset = offset 698 self.component_type = component_type 699 # make sure if offset != 0 that none of the 700 # first offset bits are set in the prefix 701 self.value = prefix 702 if offset != 0: 703 i = ipaddress.IPv6Interface( 704 (self.value.network_address, offset)) 705 if i.network.network_address != \ 706 ipaddress.ip_address('0::0'): 707 raise ValueError('Bits set in the offset') 709 class FS_nlri(object): 710 """ 711 FS_nlri class implementation that allows sorting. 713 By calling .sort() on an array of FS_nlri objects these 714 will be sorted according to the flow_rule_cmp algorithm. 716 Example: 717 nlri = [ FS_nlri(components=[ 718 FS_component(component_type=4, 719 value=bytearray([0,1,2,3,4,5,6])), 720 ]), 721 FS_nlri(components=[ 722 FS_component(component_type=5, 723 value=bytearray([0,1,2,3,4,5,6])), 724 FS_component(component_type=6, 725 value=bytearray([0,1,2,3,4,5,6])), 726 ]), 727 ] 728 nlri.sort() # sorts the array according to the algorithm 729 """ 730 def __init__(self, components = None): 731 """ 732 components: list of type FS_component 733 """ 734 self.components = components 736 def __lt__(self, other): 737 # use the below algorithm for sorting 738 result = flow_rule_cmp_v6(self, other) 739 if result == B_HAS_PRECEDENCE: 740 return True 741 else: 742 return False 744 def flow_rule_cmp_v6(a, b): 745 """ 746 Implementation of the flowspec sorting algorithm in 747 draft-ietf-idr-flow-spec-v6. 748 """ 749 for comp_a, comp_b in itertools.zip_longest(a.components, 750 b.components): 751 # If a component type does not exist in one rule 752 # this rule has lower precedence 753 if not comp_a: 754 return B_HAS_PRECEDENCE 755 if not comp_b: 757 return A_HAS_PRECEDENCE 758 # Higher precedence for lower component type 759 if comp_a.component_type < comp_b.component_type: 760 return A_HAS_PRECEDENCE 761 if comp_a.component_type > comp_b.component_type: 762 return B_HAS_PRECEDENCE 763 # component types are equal -> type specific comparison 764 if comp_a.component_type in (IP_DESTINATION, IP_SOURCE): 765 if comp_a.offset < comp_b.offset: 766 return A_HAS_PRECEDENCE 767 if comp_a.offset > comp_b.offset: 768 return B_HAS_PRECEDENCE 769 # both components have the same offset 770 # assuming comp_a.value, comp_b.value of type 771 # ipaddress.IPv6Network 772 # and the offset bits are reset to 0 (since they are 773 # not represented in the NLRI) 774 if comp_a.value.overlaps(comp_b.value): 775 # longest prefixlen has precedence 776 if comp_a.value.prefixlen > \ 777 comp_b.value.prefixlen: 778 return A_HAS_PRECEDENCE 779 if comp_a.value.prefixlen < \ 780 comp_b.value.prefixlen: 781 return B_HAS_PRECEDENCE 782 # components equal -> continue with next 783 # component 784 elif comp_a.value > comp_b.value: 785 return B_HAS_PRECEDENCE 786 elif comp_a.value < comp_b.value: 787 return A_HAS_PRECEDENCE 788 else: 789 # assuming comp_a.value, comp_b.value of type 790 # bytearray 791 if len(comp_a.value) == len(comp_b.value): 792 if comp_a.value > comp_b.value: 793 return B_HAS_PRECEDENCE 794 if comp_a.value < comp_b.value: 795 return A_HAS_PRECEDENCE 796 # components equal -> continue with next 797 # component 798 else: 799 common = min(len(comp_a.value), 800 len(comp_b.value)) 801 if comp_a.value[:common] > \ 802 comp_b.value[:common]: 803 return B_HAS_PRECEDENCE 804 elif comp_a.value[:common] < \ 805 comp_b.value[:common]: 806 return A_HAS_PRECEDENCE 807 # the first common bytes match 808 elif len(comp_a.value) > len(comp_b.value): 809 return A_HAS_PRECEDENCE 810 else: 811 return B_HAS_PRECEDENCE 812 return EQUAL 813 815 Authors' Addresses 817 Christoph Loibl (editor) 818 next layer Telekom GmbH 819 Mariahilfer Guertel 37/7 820 Vienna 1150 821 AT 823 Phone: +43 664 1176414 824 Email: cl@tix.at 826 Robert Raszuk (editor) 827 Bloomberg LP 828 731 Lexington Ave 829 New York City, NY 10022 830 USA 832 Email: robert@raszuk.net 834 Susan Hares (editor) 835 Huawei 836 7453 Hickory Hill 837 Saline, MI 48176 838 USA 840 Email: shares@ndzh.com