idnits 2.17.1 draft-ietf-idr-tunnel-encaps-02.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords -- however, there's a paragraph with a matching beginning. Boilerplate error? (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (May 31, 2016) is 2879 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) ** Obsolete normative reference: RFC 5512 (Obsoleted by RFC 9012) == Outdated reference: A later version (-27) exists of draft-ietf-idr-bgp-prefix-sid-02 Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 IDR Working Group E. Rosen, Ed. 3 Internet-Draft Juniper Networks, Inc. 4 Obsoletes: 5512 (if approved) K. Patel 5 Intended status: Standards Track Cisco Systems 6 Expires: December 2, 2016 G. Van de Velde 7 Nokia 8 May 31, 2016 10 The BGP Tunnel Encapsulation Attribute 11 draft-ietf-idr-tunnel-encaps-02 13 Abstract 15 RFC 5512 defines a BGP Path Attribute known as the "Tunnel 16 Encapsulation Attribute". This attribute allows one to specify a set 17 of tunnels. For each such tunnel, the attribute can provide the 18 information needed to create the tunnel and the corresponding 19 encapsulation header. The attribute can also provide information 20 that aids in choosing whether a particular packet is to be sent 21 through a particular tunnel. RFC 5512 states that the attribute is 22 only carried in BGP UPDATEs that have the "Encapsulation Subsequent 23 Address Family (Encapsulation SAFI)". This document deprecates the 24 Encapsulation SAFI (which has never been used), and specifies 25 semantics for the attribute when it is carried in UPDATEs of certain 26 other SAFIs. This document adds support for additional tunnel types, 27 and allows a remote tunnel endpoint address to be specified for each 28 tunnel. This document also provides support for specifying fields of 29 any inner or outer encapsulations that may be used by a particular 30 tunnel. 32 This document obsoletes RFC 5512. 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at http://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on December 2, 2016. 50 Copyright Notice 52 Copyright (c) 2016 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents 57 (http://trustee.ietf.org/license-info) in effect on the date of 58 publication of this document. Please review these documents 59 carefully, as they describe your rights and restrictions with respect 60 to this document. Code Components extracted from this document must 61 include Simplified BSD License text as described in Section 4.e of 62 the Trust Legal Provisions and are provided without warranty as 63 described in the Simplified BSD License. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 68 1.1. Brief Summary of RFC 5512 . . . . . . . . . . . . . . . . 4 69 1.2. Deficiencies in RFC 5512 . . . . . . . . . . . . . . . . 4 70 1.3. Brief Summary of Changes from RFC 5512 . . . . . . . . . 5 71 2. The Tunnel Encapsulation Attribute . . . . . . . . . . . . . 6 72 3. Tunnel Encapsulation Attribute Sub-TLVs . . . . . . . . . . . 7 73 3.1. The Remote Endpoint Sub-TLV . . . . . . . . . . . . . . . 8 74 3.2. Encapsulation Sub-TLVs for Particular Tunnel Types . . . 10 75 3.2.1. VXLAN . . . . . . . . . . . . . . . . . . . . . . . . 10 76 3.2.2. VXLAN-GPE . . . . . . . . . . . . . . . . . . . . . . 11 77 3.2.3. NVGRE . . . . . . . . . . . . . . . . . . . . . . . . 12 78 3.2.4. L2TPv3 . . . . . . . . . . . . . . . . . . . . . . . 14 79 3.2.5. GTP . . . . . . . . . . . . . . . . . . . . . . . . . 14 80 3.2.6. GRE . . . . . . . . . . . . . . . . . . . . . . . . . 15 81 3.2.7. MPLS-in-GRE . . . . . . . . . . . . . . . . . . . . . 16 82 3.3. Outer Encapsulation Sub-TLVs . . . . . . . . . . . . . . 16 83 3.3.1. IPv4 DS Field . . . . . . . . . . . . . . . . . . . . 17 84 3.3.2. UDP Destination Port . . . . . . . . . . . . . . . . 17 85 3.4. Sub-TLVs for Aiding Tunnel Selection . . . . . . . . . . 17 86 3.4.1. Protocol Type Sub-TLV . . . . . . . . . . . . . . . . 17 87 3.4.2. Color Sub-TLV . . . . . . . . . . . . . . . . . . . . 18 88 3.5. Embedded Label Handling Sub-TLV . . . . . . . . . . . . . 18 89 3.6. MPLS Label Stack Sub-TLV . . . . . . . . . . . . . . . . 19 90 3.7. Prefix-SID Sub-TLV . . . . . . . . . . . . . . . . . . . 20 91 4. Extended Communities Related to the Tunnel Encapsulation 92 Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . 21 93 4.1. Encapsulation Extended Community . . . . . . . . . . . . 21 94 4.2. Router's MAC Extended Community . . . . . . . . . . . . . 22 95 4.3. Color Extended Community . . . . . . . . . . . . . . . . 22 97 5. Semantics and Usage of the Tunnel Encapsulation 98 attribute . . . . . . . . . . . . . . . . . . . . . . . . . . 23 99 6. Routing Considerations . . . . . . . . . . . . . . . . . . . 26 100 6.1. No Impact on BGP Decision Process . . . . . . . . . . . . 26 101 6.2. Looping, Infinite Stacking, Etc. . . . . . . . . . . . . 27 102 7. Recursive Next Hop Resolution . . . . . . . . . . . . . . . . 27 103 8. Use of Virtual Network Identifiers and Embedded Labels 104 when Imposing a Tunnel Encapsulation . . . . . . . . . . . . 28 105 8.1. Tunnel Types without a Virtual Network Identifier 106 Field . . . . . . . . . . . . . . . . . . . . . . . . . . 28 107 8.2. Tunnel Types with a Virtual Network Identifier Field . . 29 108 8.2.1. Unlabeled Address Families . . . . . . . . . . . . . 29 109 8.2.2. Labeled Address Families . . . . . . . . . . . . . . 30 110 8.2.2.1. When a Valid VNI has been Signaled . . . . . . . 30 111 8.2.2.2. When a Valid VNI has not been Signaled . . . . . 30 112 9. Applicability Restrictions . . . . . . . . . . . . . . . . . 31 113 10. Scoping . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 114 11. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 32 115 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 33 116 12.1. Subsequent Address Family Identifiers . . . . . . . . . 33 117 12.2. BGP Path Attributes . . . . . . . . . . . . . . . . . . 33 118 12.3. Extended Communities . . . . . . . . . . . . . . . . . . 33 119 12.4. BGP Tunnel Encapsulation Attribute Sub-TLVs . . . . . . 34 120 12.5. Tunnel Types . . . . . . . . . . . . . . . . . . . . . . 35 121 13. Security Considerations . . . . . . . . . . . . . . . . . . . 35 122 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 36 123 15. Contributor Addresses . . . . . . . . . . . . . . . . . . . . 36 124 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 37 125 16.1. Normative References . . . . . . . . . . . . . . . . . . 37 126 16.2. Informative References . . . . . . . . . . . . . . . . . 37 127 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 39 129 1. Introduction 131 This document obsoletes RFC 5512. The deficiencies of RFC 5512, and 132 a summary of the changes made, are discussed in Sections 1.1-1.3. 133 The material from RFC 5512 that is retained has been incorporated 134 into this document. 136 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 137 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 138 "OPTIONAL", when and only when appearing in all capital letters, are 139 to be interpreted as described in [RFC2119]. 141 1.1. Brief Summary of RFC 5512 143 [RFC5512] defines a BGP Path Attribute known as the Tunnel 144 Encapsulation attribute. This attribute consists of one or more 145 TLVs. Each TLV identifies a particular type of tunnel. Each TLV 146 also contains one or more sub-TLVs. Some of the sub-TLVs, e.g., the 147 "Encapsulation sub-TLV", contain information that may be used to form 148 the encapsulation header for the specified tunnel type. Other sub- 149 TLVs, e.g., the "color sub-TLV" and the "protocol sub-TLV", contain 150 information that aids in determining whether particular packets 151 should be sent through the tunnel that the TLV identifies. 153 [RFC5512] only allows the Tunnel Encapsulation attribute to be 154 attached to BGP UPDATE messages that have the "Encapsulation SAFI" 155 (i.e., UPDATE messages with AFI/SAFI 1/7 or 2/7). In an UPDATE of 156 the Encapsulation SAFI, the NLRI is an address of the BGP speaker 157 originating the UPDATE. Consider the following scenario: 159 o BGP speaker R1 has received and installed UPDATE U; 161 o UPDATE U's SAFI is the Encapsulation SAFI; 163 o UPDATE U has the address R2 as its NLRI; 165 o UPDATE U has a Tunnel Encapsulation attribute. 167 o R1 has a packet, P, to transmit to destination D; 169 o R1's best path to D is a BGP route that has R2 as its next hop; 171 In this scenario, when R1 transmits packet P, it should transmit it 172 to R2 through one of the tunnels specified in U's Tunnel 173 Encapsulation attribute. The IP address of the remote endpoint of 174 each such tunnel is R2. Packet P is known as the tunnel's "payload". 176 1.2. Deficiencies in RFC 5512 178 While the ability to specify tunnel information in a BGP UPDATE is 179 useful, the procedures of [RFC5512] have certain limitations: 181 o The requirement to use the "Encapsulation SAFI" presents an 182 unfortunate operational cost, as each BGP session that may need to 183 carry tunnel encapsulation information needs to be reconfigured to 184 support the Encapsulation SAFI. The Encapsulation SAFI has never 185 been used, and this requirement has served only to discourage the 186 use of the Tunnel Encapsulation attribute. 188 o There is no way to use the Tunnel Encapsulation attribute to 189 specify the remote endpoint address of a given tunnel; [RFC5512] 190 assumes that the remote endpoint of each tunnel is specified as 191 the NLRI of an UPDATE of the Encapsulation-SAFI. 193 o If the respective best paths to two different address prefixes 194 have the same next hop, [RFC5512] does not provide a 195 straightforward method to associate each prefix with a different 196 tunnel. 198 o If a particular tunnel type requires an outer IP or UDP 199 encapsulation, there is no way to signal the values of any of the 200 fields of the outer encapsulation. 202 o In [RFC5512]'s specification of the sub-TLVs, each sub-TLV has 203 one-octet length field. In some cases, a two-octet length field 204 may be needed. 206 1.3. Brief Summary of Changes from RFC 5512 208 In this document we address these deficiencies by: 210 o Deprecating the Encapsulation SAFI. 212 o Defining a new "Remote Endpoint Address sub-TLV" that can be 213 included in any of the TLVs contained in the Tunnel Encapsulation 214 attribute. This sub-TLV can be used to specify the remote 215 endpoint address of a particular tunnel. 217 o Allowing the Tunnel Encapsulation attribute to be carried by BGP 218 UPDATEs of additional AFI/SAFIs. Appropriate semantics are 219 provided for this way of using the attribute. 221 o Defining a number of new sub-TLVs that provide additional 222 information that is useful when forming the encapsulation header 223 used to send a packet through a particular tunnel. 225 o Defining the sub-TLV type field so that a sub-TLV whose type is in 226 the range from 1 to 127 inclusive has a one-octet length field, 227 but a sub-TLV whose type is in the range from 128 to 254 inclusive 228 has a two-octet length field. 230 One of the sub-TLVs defined in [RFC5512] is the "Encapsulation sub- 231 TLV". For a given tunnel, the encapsulation sub-TLV specifies some 232 of the information needed to construct the encapsulation header used 233 when sending packets through that tunnel. This document defines 234 encapsulation sub-TLVs for a number of tunnel types not discussed in 235 [RFC5512]: VXLAN, VXLAN-GPE, NVGRE, GTP, and MPLS-in-GRE. MPLS-in- 236 UDP [RFC7510] is also supported, but an Encapsulation sub-TLV for it 237 is not needed. 239 Some of the encapsulations mentioned in the previous paragraph need 240 to be further encapsulated inside UDP and/or IP. [RFC5512] provides 241 no way to specify that certain information is to appear in these 242 outer IP and/or UDP encapsulations. This document provides a 243 framework for including such information in the TLVs of the Tunnel 244 Encapsulation attribute. 246 When the Tunnel Encapsulation attribute is attached to a BGP UPDATE 247 whose AFI/SAFI identifies one of the labeled address families, it is 248 not always obvious whether the label embedded in the NLRI is to 249 appear somewhere in the tunnel encapsulation header (and if so, 250 where), or whether it is to appear in the payload, or whether it can 251 be omitted altogether. This is especially true if the tunnel 252 encapsulation header itself contains a "virtual network identifier". 253 This document provides a mechanism that allows one to signal (by 254 using sub-TLVs of the Tunnel Encapsulation attribute) how one wants 255 to use the embedded label when the tunnel encapsulation has its own 256 virtual network identifier field. 258 [RFC5512] defines a Tunnel Encapsulation Extended Community, that can 259 be used instead of the Tunnel Encapsulation attribute under certain 260 circumstances. This document addresses the issue of how to handle a 261 BGP UPDATE that carries both a Tunnel Encapsulation attribute and one 262 or more Tunnel Encapsulation Extended Communities. 264 2. The Tunnel Encapsulation Attribute 266 The Tunnel Encapsulation attribute is an optional transitive BGP Path 267 attribute. IANA has assigned the value 23 as the type code of the 268 attribute. The attribute is composed of a set of Type-Length-Value 269 (TLV) encodings. Each TLV contains information corresponding to a 270 particular tunnel type. A TLV is structured as shown in Figure 1: 272 0 1 2 3 273 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 274 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 275 | Tunnel Type (2 Octets) | Length (2 Octets) | 276 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 277 | | 278 | Value | 279 | | 280 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 282 Figure 1: Tunnel Encapsulation TLV Value Field 284 o Tunnel Type (2 octets): identifies a type of tunnel. The field 285 contains values from the IANA Registry "BGP Tunnel Encapsulation 286 Attribute Tunnel Types". 288 Note that for tunnel types whose names are of the form "X-in-Y", 289 e.g., "MPLS-in-GRE", only packets of the specified payload type 290 "X" are to be carried through the tunnel of type "Y". This is the 291 equivalent of specifying a tunnel type "Y" and including in its 292 TLV a Protocol Type sub-TLV (see Section 3.4.1 specifying protocol 293 "X". 295 o Length (2 octets): the total number of octets of the value field. 297 o Value (variable): comprised of multiple sub-TLVs. 299 Each sub-TLV consists of three fields: a 1-octet type, 1-octet 300 length, and zero or more octets of value. A sub-TLV is structured as 301 shown in Figure 2: 303 +-----------------------------------+ 304 | Sub-TLV Type (1 Octet) | 305 +-----------------------------------+ 306 | Sub-TLV Length (1 or 2 Octets)| 307 +-----------------------------------+ 308 | Sub-TLV Value (Variable) | 309 | | 310 +-----------------------------------+ 312 Figure 2: Tunnel Encapsulation Sub-TLV Format 314 o Sub-TLV Type (1 octet): each sub-TLV type defines a certain 315 property about the tunnel TLV that contains this sub-TLV. 317 o Sub-TLV Length (1 or 2 octets): the total number of octets of the 318 sub-TLV value field. The Sub-TLV Length field contains 1 octet if 319 the Sub-TLV Type field contains a value in the range from 1-127. 320 The Sub-TLV Length field contains two octets if the Sub-TLV Type 321 field contains a value in the range from 128-254. 323 o Sub-TLV Value (variable): encodings of the value field depend on 324 the sub-TLV type as enumerated above. The following sub-sections 325 define the encoding in detail. 327 3. Tunnel Encapsulation Attribute Sub-TLVs 329 In this section, we specify a number of sub-TLVs. These sub-TLVs can 330 be included in a TLV of the Tunnel Encapsulation attribute. 332 3.1. The Remote Endpoint Sub-TLV 334 The Remote Endpoint sub-TLV is a sub-TLV whose value field contains 335 three sub-fields: 337 1. a four-octet Autonomous System (AS) number sub-field 339 2. a two-octet Address Family sub-field 341 3. an address sub-field, whose length depends upon the Address 342 Family. 344 0 1 2 3 345 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 346 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 347 | Autonomous System Number | 348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 349 | Address Family | Address ~ 350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 351 ~ ~ 352 | | 353 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 355 Figure 3: Remote Endpoint Sub-TLV Value Field 357 The Address Family subfield contains a value from IANA's "Address 358 Family Numbers" registry. In this document, we assume that the 359 Address Family is either IPv4 or IPv6; use of other address families 360 is outside the scope of this document. 362 If the Address Family subfield contains the value for IPv4, the 363 address subfield must contain an IPv4 address (a /32 IPv4 prefix). 364 In this case, the length field of Remote Endpoint sub-TLV must 365 contain the value 10 (0xa). IPv4 broadcast addresses are not valid 366 values of this field. 368 If the Address Family subfield contains the value for IPv6, the 369 address sub-field must contain an IPv6 address (a /128 IPv6 prefix). 370 In this case, the length field of Remote Endpoint sub-TLV must 371 contain the value 22 (0x16). IPv6 link local addresses are not valid 372 values of the IP address field. 374 In a given BGP UPDATE, the address family (IPv4 or IPv6) of a Remote 375 Endpoint sub-TLV is independent of the address family of the UPDATE 376 itself. For example, an UPDATE whose NLRI is an IPv4 address may 377 have a Tunnel Encapsulation attribute containing Remote Endpoint sub- 378 TLVs that contain IPv6 addresses. Also, different tunnels 379 represented in the Tunnel Encapsulation attribute may have Remote 380 Endpoints of different address families. 382 A two-octet AS number can be carried in the AS number field by 383 setting the two high order octets to zero, and carrying the number in 384 the two low order octets of the field. 386 The AS number in the sub-TLV MUST be the number of the AS to which 387 the IP address in the sub-TLV belongs. 389 There is one special case: the Remote Endpoint sub-TLV MAY have a 390 value field whose Address Family subfield contains 0. This means 391 that the tunnel's remote endpoint is the UPDATE's BGP next hop. If 392 the Address Family subfield contains 0, the Address subfield is 393 omitted, and the Autonomous System number field is set to 0. 395 If any of the following conditions hold, the Remote Endpoint sub-TLV 396 is considered to be "malformed": 398 o The sub-TLV contains the value for IPv4 in its Address Family 399 subfield, but the length of the sub-TLV's value field is other 400 than 10 (0xa). 402 o The sub-TLV contains the value for IPv6 in its Address Family 403 subfield, but the length of the sub-TLV's value field is other 404 than 22 (0x16). 406 o The sub-TLV contains the value zero in its Address Family field, 407 but the length of the sub-TLV's value field is other than 6, or 408 the Autonomous System subfield is not set to zero. 410 o The IP address in the sub-TLV's address subfield is not a valid IP 411 address (e.g., it's an IPv4 broadcast address). 413 o It can be determined that the IP address in the sub-TLV's address 414 subfield does not belong to the non-zero AS whose number is in the 415 its Autonomous System subfield. (See section Section 13 for 416 discussion of one way to determine this.) 418 If the Remote Endpoint sub-TLV is malformed, the TLV containing it is 419 also considered to be malformed, and the entire TLV MUST be ignored. 420 However, the Tunnel Encapsulation attribute SHOULD NOT be considered 421 to be malformed in this case; other TLVs in the attribute SHOULD be 422 processed (if they can be parsed correctly). 424 When redistributing a route that is carrying a Tunnel Encapsulation 425 attribute containing a TLV that itself contains a malformed Remote 426 Endpoint sub-TLV, the TLV SHOULD be removed from the attribute before 427 redistribution. 429 See Section 11 for further discussion of how to handle errors that 430 are encountered when parsing the Tunnel Encapsulation attribute. 432 If the Remote Endpoint sub-TLV contains an IPv4 or IPv6 address that 433 is valid but not reachable, the sub-TLV is NOT considered to be 434 malformed, and the containing TLV SHOULD NOT be removed from the 435 attribute before redistribution. However, the tunnel identified by 436 the TLV containing that sub-TLV cannot be used until such time as the 437 address becomes reachable. See Section 5. 439 3.2. Encapsulation Sub-TLVs for Particular Tunnel Types 441 This section defines Tunnel Encapsulation sub-TLVs for the following 442 tunnel types: VXLAN ([RFC7348]), VXLAN-GPE ([VXLAN-GPE]), NVGRE 443 ([RFC7637]), GTP ([GTP-U]), MPLS-in-GRE ([RFC2784], [RFC2890], 444 [RFC4023]), L2TPv3 ([RFC3931]), and GRE ([RFC2784], [RFC2890], 445 [RFC4023]). 447 Rules for forming the encapsulation based on the information in a 448 given TLV are given in Section 8. For some tunnel types, the rules 449 are obvious and not mentioned in this document. There are also 450 tunnel types for which it is not necessary to define an Encapsulation 451 sub-TLV. 453 3.2.1. VXLAN 455 This document defines an encapsulation sub-TLV for VXLAN tunnels. 456 When the tunnel type is VXLAN, the following is the structure of the 457 value field in the encapsulation sub-TLV: 459 0 1 2 3 460 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 461 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 462 |V|M|R|R|R|R|R|R| VN-ID (3 Octets) | 463 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 464 | MAC Address (4 Octets) | 465 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 466 | MAC Address (2 Octets) | Reserved | 467 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 469 Figure 4: VXLAN Encapsulation Sub-TLV 471 V: This bit is set to 1 to indicate that a "valid" VN-ID is 472 present in the encapsulation sub-TLV. Please see Section 8. 474 M: This bit is set to 1 to indicate that a valid MAC Address is 475 present in the encapsulation sub-TLV. 477 R: The remaining bits in the 8-bit flags field are reserved for 478 further use. They SHOULD always be set to 0. 480 VN-ID: If the V bit is set, the VN-id field contains a 3 octet VN- 481 ID value. If the V bit is not set, the VN-id field SHOULD be set 482 to zero. 484 MAC Address: If the M bit is set, this field contains a 6 octet 485 Ethernet MAC address. If the M bit is not set, this field SHOULD 486 be set to all zeroes. 488 Note that, strictly speaking, VXLAN tunnels only carry ethernet 489 frames. To send an IP packet or an MPLS packet through a VXLAN 490 tunnel, it is necessary to form an IP-in-ethernet-in-VXLAN or an 491 MPLS-in-ethernet-in-VXLAN tunnel. 493 When forming the VXLAN encapsulation header: 495 o The values of the V, M, and R bits are NOT copied into the flags 496 field of the VXLAN header. The flags field of the VXLAN header is 497 set as per [RFC7348]. 499 o If the M bit is set, the MAC Address is copied into the Inner 500 Destination MAC Address field of the Inner Ethernet Header (see 501 section 5 of [RFC7348]. 503 If the M bit is not set, and the payload being sent through the 504 VXLAN tunnel is an ethernet frame, the Destination MAC Address 505 field of the Inner Ethernet Header is just the Destination MAC 506 Address field of the payload's ethernet header. 508 If the M bit is not set, and the payload being sent through the 509 VXLAN tunnel is an IP or MPLS packet, the Inner Destination MAC 510 address field is set to a configured value; if there is no 511 configured value, the VXLAN tunnel cannot be used. 513 o See Section 8 to see how the VNI field of the VXLAN encapsulation 514 header is set. 516 3.2.2. VXLAN-GPE 518 This document defines an encapsulation sub-TLV for VXLAN tunnels. 519 When the tunnel type is VXLAN-GPE, the following is the structure of 520 the value field in the encapsulation sub-TLV: 522 0 1 2 3 523 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 524 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 525 |Ver|V|R|R|R|R|R| Reserved | 526 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 527 | VN-ID | Reserved | 528 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 530 Figure 5: VXLAN GPE Encapsulation Sub-TLV 532 V: This bit is set to 1 to indicate that a "valid" VN-ID is 533 present in the encapsulation sub-TLV. Please see Section 8. 535 R: The bits designated "R" above are reserved for future use. 536 They SHOULD always be set to zero. 538 Version (Ver): Indicates VXLAN GPE protocol version. If the 539 indicated version is not supported, the TLV that contains this 540 Encapsulation sub-TLV MUST be treated as specifying an unsupported 541 tunnel type. The value of this field will be copied into the 542 corresponding field of the VXLAN encapsulation header. 544 VN-ID: If the V bit is set, this field contains a 3 octet VN-ID 545 value. If the V bit is not set, this field SHOULD be set to zero. 547 When forming the VXLAN-GPE encapsulation header: 549 o The values of the V and R bits are NOT copied into the flags field 550 of the VXLAN-GPE header. However, the values of the Ver bits are 551 copied into the VXLAN-GPE header. Other bits in the flags field 552 of the VXLAN-GPE header are set as per [VXLAN-GPE]. 554 o See Section 8 to see how the VNI field of the VXLAN-GPE 555 encapsulation header is set. 557 3.2.3. NVGRE 559 This document defines an encapsulation sub-TLV for NVGRE tunnels. 560 When the tunnel type is NVGRE, the following is the structure of the 561 value field in the encapsulation sub-TLV: 563 0 1 2 3 564 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 565 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 566 |V|M|R|R|R|R|R|R| VN-ID (3 Octets) | 567 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 568 | MAC Address (4 Octets) | 569 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 570 | MAC Address (2 Octets) | Reserved | 571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 573 Figure 6: NVGRE Encapsulation Sub-TLV 575 V: This bit is set to 1 to indicate that a "valid" VN-ID is 576 present in the encapsulation sub-TLV. Please see Section 8. 578 M: This bit is set to 1 to indicate that a valid MAC Address is 579 present in the encapsulation sub-TLV. 581 R: The remaining bits in the 8-bit flags field are reserved for 582 further use. They SHOULD always be set to 0. 584 VN-ID: If the V bit is set, the VN-id field contains a 3 octet VN- 585 ID value. If the V bit is not set, the VN-id field SHOULD be set 586 to zero. 588 MAC Address: If the M bit is set, this field contains a 6 octet 589 Ethernet MAC address. If the M bit is not set, this field SHOULD 590 be set to all zeroes. 592 When forming the NVGRE encapsulation header: 594 o The values of the V, M, and R bits are NOT copied into the flags 595 field of the NVGRE header. The flags field of the VXLAN header is 596 set as per [RFC7637]. 598 o If the M bit is set, the MAC Address is copied into the Inner 599 Destination MAC Address field of the Inner Ethernet Header (see 600 section 3.2 of [RFC7637]. 602 If the M bit is not set, and the payload being sent through the 603 NVGRE tunnel is an ethernet frame, the Destination MAC Address 604 field of the Inner Ethernet Header is just the Destination MAC 605 Address field of the payload's ethernet header. 607 If the M bit is not set, and the payload being sent through the 608 NVGRE tunnel is an IP or MPLS packet, the Inner Destination MAC 609 address field is set to a configured value; if there is no 610 configured value, the NVGRE tunnel cannot be used. 612 o See Section 8 to see how the VSID field of the NVGRE encapsulation 613 header is set. 615 3.2.4. L2TPv3 617 When the tunnel type of the TLV is L2TPv3 over IP, the following is 618 the structure of the value field of the encapsulation sub-TLV: 620 0 1 2 3 621 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 622 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 623 | Session ID (4 octets) | 624 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 625 | | 626 | Cookie (Variable) | 627 | | 628 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 630 Figure 7: L2TPv3 Encapsulation Sub-TLV 632 Session ID: a non-zero 4-octet value locally assigned by the 633 advertising router that serves as a lookup key in the incoming 634 packet's context. 636 Cookie: an optional, variable length (encoded in octets -- 0 to 8 637 octets) value used by L2TPv3 to check the association of a 638 received data message with the session identified by the Session 639 ID. Generation and usage of the cookie value is as specified in 640 [RFC3931]. 642 The length of the cookie is not encoded explicitly, but can be 643 calculated as (sub-TLV length - 4). 645 3.2.5. GTP 647 When the tunnel type is GTP [GTP-U], the Encapsulation sub-TLV 648 contains information needed to send data packets through a GTP 649 tunnel, and also contains information needed by the tunnel's remote 650 endpoint to create a "reverse" tunnel back to the transmitter. This 651 allows a bidirectional control connection to be created. The format 652 of the Encapsulation Sub-TLV is: 654 0 1 2 3 655 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 656 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 657 | Remote TEID (4 Octets) | 658 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 659 | Local TEID (4 Octets) | 660 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 661 | Local Endpoint Address (4/16 Octets (IPv4/IPv6)) | 662 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 664 Figure 8: GTP Encapsulation Sub-TLV 666 Remote TEID: Contains the 32-bit Tunnel Endpoint Identifier of the 667 GTP tunnel through which data packets are to be sent. When data 668 packets are sent through the tunnel, the Remote TEID is carried in 669 the GTP encapsulation header. The GTP header is itself 670 encapsulation within an IP header, whose IP destination address 671 field is set to the value of the Remote Endpoint sub-TLV. 673 Local TEID: Contains a 32-bit Tunnel Endpoint Identifier of a GTP 674 tunnel assigned by EPC ([vEPC]). 676 Local Endpoint Address: Contains an IPv4 or IPv6 anycast address. 677 This is used, along with the Local TEID, to set up a tunnel in the 678 reverse direction. See [vEPC] for details. 680 3.2.6. GRE 682 When the tunnel type of the TLV is GRE, the following is the 683 structure of the value field of the encapsulation sub-TLV: 685 0 1 2 3 686 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 687 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 688 | GRE Key (4 octets) | 689 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 691 Figure 9: GRE Encapsulation Sub-TLV 693 GRE Key: 4-octet field [RFC2890] that is generated by the 694 advertising router. The actual method by which the key is 695 obtained is beyond the scope of this document. The key is 696 inserted into the GRE encapsulation header of the payload packets 697 sent by ingress routers to the advertising router. It is intended 698 to be used for identifying extra context information about the 699 received payload. 701 Note that the key is optional. Unless a key value is being 702 advertised, the GRE encapsulation sub-TLV MUST NOT be present. 704 3.2.7. MPLS-in-GRE 706 When the tunnel type is MPLS-in-GRE, the following is the structure 707 of the value field in an optional encapsulation sub-TLV: 709 0 1 2 3 710 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 711 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 712 | GRE-Key (4 Octets) | 713 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 715 Figure 10: MPLS-in-GRE Encapsulation Sub-TLV 717 GRE-Key: 4-octet field [RFC2890] that is generated by the 718 advertising router. The actual method by which the key is 719 obtained is beyond the scope of this document. The key is 720 inserted into the GRE encapsulation header of the payload packets 721 sent by ingress routers to the advertising router. It is intended 722 to be used for identifying extra context information about the 723 received payload. Note that the key is optional. Unless a key 724 value is being advertised, the MPLS-in-GRE encapsulation sub-TLV 725 MUST NOT be present. 727 Note that the GRE tunnel type defined in Section 3.2.6 can be used 728 instead of the MPLS-in-GRE tunnel type when it is necessary to 729 encapsulate MPLS in GRE. Including a TLV of the MPLS-in-GRE tunnel 730 type is equivalent to including a TLV of the GRE tunnel type that 731 also includes a Protocol Type sub-TLV ([RFC5512]) specifying MPLS as 732 the protocol to be encapsulated. That is, if a TLV specifies MPLS- 733 in-GRE or if it includes a Protocol Type sub-TLV specifying MPLS, the 734 GRE tunnel advertised in that TLV MUST NOT be used for carrying IP 735 packets. 737 While it is not really necessary to have both the GRE and MPLS-in-GRE 738 tunnel types, both are included for reasons of backwards 739 compatibility. 741 3.3. Outer Encapsulation Sub-TLVs 743 The Encapsulation sub-TLV for a particular tunnel type allows one to 744 specify the values that are to be placed in certain fields of the 745 encapsulation header for that tunnel type. However, some tunnel 746 types require an outer IP encapsulation, and some also require an 747 outer UDP encapsulation. The Encapsulation sub-TLV for a given 748 tunnel type does not usually provide a way to specify values for 749 fields of the outer IP and/or UDP encapsulations. If it is necessary 750 to specify values for fields of the outer encapsulation, additional 751 sub-TLVs must be used. This document defines two such sub-TLVs. 753 If an outer encapsulation sub-TLV occurs in a TLV for a tunnel type 754 that does not use the corresponding outer encapsulation, the sub-TLV 755 is treated as if it were an unknown type of sub-TLV. 757 3.3.1. IPv4 DS Field 759 Most of the tunnel types that can be specified in the Tunnel 760 Encapsulation attribute require an outer IP encapsulation. The IPv4 761 DS Field sub-TLV can be carried in the TLV of any such tunnel type. 762 It specifies the setting of one-octet Differentiated Services field 763 in the outer IP encapsulation (see [RFC2474]). The value field is 764 always a single octet. 766 3.3.2. UDP Destination Port 768 Some of the tunnel types that can be specified in the Tunnel 769 Encapsulation attribute require an outer UDP encapsulation. 770 Generally there is a standard UDP Destination Port value for a 771 particular tunnel type. However, sometimes it is useful to be able 772 to use a non-standard UDP destination port. If a particular tunnel 773 type requires an outer UDP encapsulation, and it is desired to use a 774 UDP destination port other than the standard one, the port to be used 775 can be specified by including a UDP Destination Port sub-TLV. The 776 value field of this sub-TLV is always a two-octet field, containing 777 the port value. 779 3.4. Sub-TLVs for Aiding Tunnel Selection 781 3.4.1. Protocol Type Sub-TLV 783 The protocol type sub-TLV MAY be included in a given TLV to indicate 784 the type of the payload packets that may be encapsulated with the 785 tunnel parameters that are being signaled in the TLV. The value 786 field of the sub-TLV contains a 2-octet value from IANA's ethertype 787 registry [Ethertypes]. 789 For example, if we want to use three L2TPv3 sessions, one carrying 790 IPv4 packets, one carrying IPv6 packets, and one carrying MPLS 791 packets, the egress router will include three TLVs of L2TPv3 792 encapsulation type, each specifying a different Session ID and a 793 different payload type. The protocol type sub-TLV for these will be 794 IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and 795 MPLS (protocol type = 0x8847), respectively. This informs the 796 ingress routers of the appropriate encapsulation information to use 797 with each of the given protocol types. Insertion of the specified 798 Session ID at the ingress routers allows the egress to process the 799 incoming packets correctly, according to their protocol type. 801 3.4.2. Color Sub-TLV 803 The color sub-TLV MAY be encoded as a way to "color" the 804 corresponding tunnel TLV. The value field of the sub-TLV consists of 805 a Color Extended Community, as defined in Section 4.3. For the use 806 of this sub-TLV and Extended Community, please see Section 7. 808 3.5. Embedded Label Handling Sub-TLV 810 Certain BGP address families (corresponding to particular AFI/SAFI 811 pairs, e.g., 1/4, 2/4, 1/128, 2/128) have MPLS labels embedded in 812 their NLRIs. We will use the term "embedded label" to refer to the 813 MPLS label that is embedded in an NLRI, and the term "labeled address 814 family" to refer to any AFI/SAFI that has embedded labels. 816 Some of the tunnel types (e.g., VXLAN, VXLAN-GPE, and NVGRE) that can 817 be specified in the Tunnel Encapsulation attribute have an 818 encapsulation header containing "Virtual Network" identifier of some 819 sort. The Encapsulation sub-TLVs for these tunnel types may 820 optionally specify a value for the virtual network identifier. 822 Suppose a Tunnel Encapsulation attribute is attached to an UPDATE of 823 an embedded address family, and it is decided to use a particular 824 tunnel (specified in one of the attribute's TLVs) for transmitting a 825 packet that is being forwarded according to that UPDATE. When 826 forming the encapsulation header for that packet, different 827 deployment scenarios require different handling of the embedded label 828 and/or the virtual network identifier. The Embedded Label Handling 829 sub-TLV can be used to control the placement of the embedded label 830 and/or the virtual network identifier in the encapsulation. 832 The Embedded Label Handling sub-TLV may be included in any TLV of the 833 Tunnel Encapsulation attribute. If the Tunnel Encapsulation 834 attribute is attached to an UPDATE of a non-labeled address family, 835 the sub-TLV is treated as a no-op. If the sub-TLV is contained in a 836 TLV whose tunnel type does not have a virtual network identifier in 837 its encapsulation header, the sub-TLV is treated as a no-op. In 838 those cases where the sub-TLV is treated as a no-op, it SHOULD NOT be 839 stripped from the TLV before the UPDATE is forwarded. 841 The sub-TLV's Length field always contains the value 1, and its value 842 field consists of a single octet. The following values are defined: 844 1: The payload will be an MPLS packet with the embedded label at the 845 top of its label stack. 847 2: The embedded label is not carried in the payload, but is carried 848 either in the virtual network identifier field of the 849 encapsulation header, or else is ignored entirely. 851 Please see Section 8 for the details of how this sub-TLV is used when 852 it is carried by an UPDATE of a labeled address family. 854 3.6. MPLS Label Stack Sub-TLV 856 This sub-TLV allows an MPLS label stack to be associated with a 857 particular tunnel. 859 The value field of this sub-TLV is a sequence of MPLS label stack 860 entries. The first entry in the sequence is the "topmost" label, the 861 final entry in the sequence is the "bottommost" label. When this 862 label stack is pushed onto a packet, this ordering MUST be preserved. 864 Each label stack entry has the following format: 866 0 1 2 3 867 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 868 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 869 | Label | ToS |S| TTL | 870 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 872 Figure 11: MPLS Label Stack Sub-TLV 874 If a packet is to be sent through the tunnel identified in a 875 particular TLV, and if that TLV contains an MPLS Label Stack sub-TLV, 876 then the label stack appearing in the sub-TLV MUST be pushed onto the 877 packet. This label stack MUST be pushed onto the packet before any 878 other labels are pushed onto the packet. 880 In particular, if the Tunnel Encapsulation attribute is attached to a 881 BGP UPDATE of a labeled address family, the contents of the MPLS 882 Label Stack sub-TLV MUST be pushed onto the packet before the label 883 embedded in the NLRI is pushed onto the packet. 885 If the MPLS label stack sub-TLV is included in a TLV identifying a 886 tunnel type that uses virtual network identifiers (see Section 8), 887 the contents of the MPLS label stack sub-TLV MUST be pushed onto the 888 packet before the procdures of Section 8 are applied. 890 The number of label stack entries in the sub-TLV MUST be determined 891 from the sub-TLV length field. Thus it is not necessary to set the S 892 bit in any of the label stack entries of the sub-TLV, and the setting 893 of the S bit is ignored when parsing the sub-TLV. When the label 894 stack entries are pushed onto a packet that already has a label 895 stack, the S bits of all the entries MUST be cleared. When the label 896 stack entries are pushed onto a packet that does not already have a 897 label stack, the S bit of the bottommost label stack entry MUST be 898 set, and the S bit of all the other label stack entries MUST be 899 cleared.. 901 By default, the ToS field of each label stack entry is set to 0. 902 This may of course be changed by policy at the originator of the sub- 903 TLV. When pushing the label stack onto a packet, the ToS of the 904 label stack entries is preserved by default. However, local policy 905 at the router that is pushing on the stack MAY cause modification of 906 the ToS values. 908 By default, the TTL field of each label stack entry is set to 255. 909 This may be changed by policy at the originator of the sub-TLV. When 910 pushing the label stack onto a packet, the TTL of the label stack 911 entries is preserved by default. However, local policy at the router 912 that is pushing on the stack MAY cause modification of the TTL 913 values. If any label stack entry in the sub-TLV has a TTL value of 914 zero, the router that is pushing the stack on a packet MUST change 915 the value to a non-zero value. 917 Note that this sub-TLV can be appear within a TLV identifying any 918 type of tunnel, not just within a TLV identifying an MPLS tunnel. 919 However, if this sub-TLV appears within a TLV identifying an MPLS 920 tunnel (or an MPLS-in-X tunnel), this sub-TLV plays the same role 921 that would be played by an MPLS Encapsulation sub-TLV. Therefore, an 922 MPLS Encapsulation sub-TLV is not defined. 924 3.7. Prefix-SID Sub-TLV 926 [Prefix-SID-Attribute] defines a BGP Path attribute known as the 927 "Prefix-SID Attribute". This attribute is defined to contain a 928 sequence of one or more TLVs, where each TLV is either a "Label- 929 Index" TLV, an "IPv6 SID" TLV, or an "Originator SRGB" TLV. 931 In this document, we define a Prefix-SID sub-TLV. The value field of 932 the Prefix-SID sub-TLV can be set to any valid value of the value 933 field of a BGP Prefix-SID attribute, as defined in 934 [Prefix-SID-Attribute]. 936 The Prefix-SID sub-TLV can occur in a TLV identifying any type of 937 tunnel. If an Originator SRGB is specified in the sub-TLV, the SRGB 938 MUST be interpreted to be the SRGB used by the tunnel's Remote 939 Endpoint. The Label-Index, if present, is the Segment Routing SID 940 that the tunnel's Remote Endpoint uses to represent the prefix 941 appearing in the NLRI field of the BGP UPDATE to which the Tunnel 942 Encapsulation attribute is attached. 944 If a Label-Index is present in the prefix-SID sub-TLV, then when a 945 packet is sent through the tunnel identified by the TLV, the 946 corresponding MPLS label MUST be pushed on the packet's label stack. 947 If the Originator SRGB is present, the corresponding MPLS label is 948 computed from the combination of the Label-Index and the Originator 949 SRGB (see [Prefix-SID-Attribute]). If the Originator SRGB is not 950 present, the corresponding MPLS label is just the Label-Index value 951 itself. The corresponding MPLS label is pushed on after the 952 processing of the MPLS Label Stack sub-TLV, if present, as specified 953 in Section 3.6. It is pushed on before any other labels (e.g., a 954 label embedded in UPDATE's NLRI, or a label determined by the 955 procedures of Section 8 are pushed on the stack. 957 The Prefix-SID sub-TLV has slightly different semantics than the 958 Prefix-SID attribute. When the Prefix-SID attribute is attached to a 959 given route, the BGP speaker that originally attached the attribute 960 is expected to be in the same Segment Routing domain as the BGP 961 speakers who receive the route with the attached attribute. The 962 Label-Index tells the receiving BGP speakers that the prefix-SID is 963 for the advertised prefix in that Segment Routing domain. When the 964 Prefix-SID sub-TLV is used, the BGP speaker at the head end of the 965 tunnel need even not be in the same Segment Routing Domain as the 966 tunnel's Remote Endpoint, and there is no implication that the 967 prefix-SID for the advertised prefix is the same in the Segment 968 Routing domains of the BGP speaker that originated the sub-TLV and 969 the BGP speaker that received it. 971 4. Extended Communities Related to the Tunnel Encapsulation Attribute 973 4.1. Encapsulation Extended Community 975 The Encapsulation Extended Community is a Transitive Opaque Extended 976 Community. This Extended Community may be attached to a route of any 977 AFI/SAFI to which the Tunnel Encapsulation attribute may be attached. 978 Each such Extended Community identifies a particular tunnel type. If 979 the Encapsulation Extended Community identifies a particular tunnel 980 type, its semantics are exactly equivalent to the semantics of a 981 Tunnel Encapsulation attribute Tunnel TLV for which the following 982 three conditions all hold: 984 1. it identifies the same tunnel type, 986 2. it has a Remote Endpoint sub-TLV for which one of the following 987 two conditions holds: 989 a. its "Address Family" subfield contains zero, or 991 b. its "Address" subfield contains the same IP address that 992 appears in the next hop field of the route to which the 993 Tunnel Encapsulation attribute is attached 995 3. it has no other sub-TLVs. 997 We will refer to such a Tunnel TLV as a "barebones" Tunnel TLV. 999 The Encapsulation Extended Community was first defined in [RFC5512]. 1000 While it provides only a small subset of the functionality of the 1001 Tunnel Encapsulation attribute, it is used in a number of deployed 1002 applications, and is still needed for backwards compatibility. To 1003 ensure backwards compatibility, this specification establishes the 1004 following rule: 1006 A Tunnel Encapsulation attribute MUST NOT include a barebones 1007 Tunnel TLV. Instead of placing such a TLV in the Tunnel 1008 Encapsulation attribute attached to a particular route, the 1009 corresponding Encapsulation Extended Community MUST be attached to 1010 the route. 1012 Note that for tunnel types of the form "X-in-Y", e.g., MPLS-in-GRE, 1013 the Encapsulation Extended Community implies that only packets of the 1014 specified payload type "X" are to be carried through the tunnel of 1015 type "Y". 1017 In the remainder of this specification, when we speak of a route as 1018 containing a Tunnel Encapsulation attribute with a TLV identifying a 1019 particular tunnel type, we are implicitly including the case where 1020 the route contains a Tunnel Encapsulation Extended Community 1021 identifying that tunnel type. 1023 4.2. Router's MAC Extended Community 1025 [EVPN-Inter-Subnet] defines a Router's MAC Extended Community. This 1026 Extended Community provides information that may conflict with 1027 information in one or more of the Encapsulation Sub-TLVs of a Tunnel 1028 Encapsulation attribute. In case of such a conflict, the information 1029 in the Encapsulation Sub-TLV takes precedence. 1031 4.3. Color Extended Community 1033 The Color Extended Community is a Transitive Opaque Extended 1034 Community with the following encoding: 1036 0 1 2 3 1037 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 1038 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1039 | 0x03 | 0x0b | Reserved | 1040 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1041 | Color Value | 1042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1044 Figure 12: Color Extended Community 1046 For the use of this Extended Community please see Section 7. 1048 5. Semantics and Usage of the Tunnel Encapsulation attribute 1050 [RFC5512] specifies the use of the Tunnel Encapsulation attribute in 1051 BGP UPDATE messages of AFI/SAFI 1/7 and 2/7. That document restricts 1052 the use of this attribute to UPDATE messsages of those SAFIs. This 1053 document removes that restriction. 1055 The BGP Tunnel Encapsulation attribute MAY be carried in any BGP 1056 UPDATE message whose AFI/SAFI is 1/1 (IPv4 Unicast), 2/1 (IPv6 1057 Unicast), 1/4 (IPv4 Labeled Unicast), 2/4 (IPv6 Labeled Unicast), 1058 1/128 (VPN-IPv4 Labeled Unicast), 2/128 (VPN-IPv6 Labeled Unicast), 1059 or 25/70 (EVPN). Use of the Tunnel Encapsulation attribute in BGP 1060 UPDATE messages of other AFI/SAFIs is outside the scope of this 1061 document. 1063 It has been suggested that it may sometimes be useful to attach a 1064 Tunnel Encapsulation attribute to a BGP UPDATE message that is also 1065 carrying a PMSI (Provider Multicast Service Interface) Tunnel 1066 attribute [RFC6514]. If the PMSI Tunnel attribute specifies an IP 1067 tunnel, the Tunnel Encapsulation attribute could be used to provide 1068 additional information about the IP tunnel. The usage of the Tunnel 1069 Encapsulation attribute in combination with the PMSI Tunnel attribute 1070 is outside the scope of this document. 1072 The decision to attach a Tunnel Encapsulation attribute to a given 1073 BGP UPDATE is determined by policy. The set of TLVs and sub-TLVs 1074 contained in the attribute is also determined by policy. 1076 When the Tunnel Encapsulation attribute is carried in an UPDATE of 1077 one of the AFI/SAFIs specified in the previous paragraph, each TLV 1078 MUST have a Remote Endpoint sub-TLV. If a TLV that does not have a 1079 Remote Endpoint sub-TLV, that TLV should be treated as if it had a 1080 malformed Remote Endpoint sub-TLV (see Section 3.1). 1082 Suppose that: 1084 o a given packet P must be forwarded by router R; 1086 o the path along which P is to be forwarded is determined by BGP 1087 UPDATE U; 1089 o UPDATE U has a Tunnel Encapsulation attribute, containing at least 1090 one TLV that identifies a "feasible tunnel" for packet P. A 1091 tunnel is considered feasible if it has the following two 1092 properties: 1094 * The tunnel type is supported (i.e., router R knows how to set 1095 up tunnels of that type, how to create the encapsulation header 1096 for tunnels of that type, etc.) 1098 * The tunnel is of a type that can be used to carry packet P 1099 (e.g., an MPLS-in-UDP tunnel would not be a feasible tunnel for 1100 carrying an IP packet, UNLESS the IP packet can first be 1101 converted to an MPLS packet). 1103 * The tunnel is specified in a TLV whose Remote Endpoint sub-TLV 1104 identifies an IP address that is reachable. 1106 Then router R SHOULD send packet P through one of the feasible 1107 tunnels identified in the Tunnel Encapsulation attribute of UPDATE U. 1109 If the Tunnel Encapsulation attribute contains several TLVs (i.e., if 1110 it specifies several tunnels), router R may choose any one of those 1111 tunnels, based upon local policy. If any of tunnels' TLVs contain 1112 the Color sub-TLV(Section 3.4.2) and/or the Protocol Type sub-TLV 1113 (Section 3.4.1, the choice of tunnel may be influenced by these sub- 1114 TLVs. 1116 Note that if none of the TLVs specifies the MPLS tunnel type, a Label 1117 Switched Path SHOULD NOT be used unless none of the TLVs specifies a 1118 feasible tunnel. 1120 If a particular tunnel is not feasible at some moment because its 1121 Remote Endpoint cannot be reached at that moment, the tunnel may 1122 become feasible at a later time. When this happens, router R SHOULD 1123 reconsider its choice of tunnel to use, and MAY choose to now use the 1124 tunnel. 1126 A TLV specifying a non-feasible tunnel is not considered to be 1127 malformed or erroneous in any way, and the TLV SHOULD NOT be stripped 1128 from the Tunnel Encapsulation attribute before redistribution. 1130 In addition to the sub-TLVs already defined, additional sub-TLVs may 1131 be defined that affect the choice of tunnel to be used, or that 1132 affect the contents of the tunnel encapsulation header. The 1133 documents that define any such additional sub-TLVs must specify the 1134 effect that including the sub-TLV is to have. 1136 If it is determined to send a packet through the tunnel specified in 1137 a particular TLV of a particular Tunnel Encapsulation attribute, then 1138 the tunnel's remote endpoint address is the IP address contained in 1139 the sub-TLV. If the TLV contains a Remote Endpoint sub-TLV whose 1140 value field is all zeroes, then the tunnel's remote endpoint is the 1141 IP address specified as the Next Hop of the BGP Update containing the 1142 Tunnel Encapsulation attribute. 1144 The procedure for sending a packet through a particular tunnel type 1145 to a particular remote endpoint depends upon the tunnel type, and is 1146 outside the scope of this document. The contents of the tunnel 1147 encapsulation header MAY be influenced by the Encapsulation sub-TLV. 1149 Note that some tunnel types may require the execution of an explicit 1150 tunnel setup protocol before they can be used for carrying data. 1151 Other tunnel types may not require any tunnel setup protocol. 1152 Whenever a new Tunnel Type TLV is defined, the specification of that 1153 TLV must describe (or reference) the procedures for creating the 1154 encapsulation header used to forward packets through that tunnel 1155 type. 1157 If a Tunnel Encapsulation attribute specifies several tunnels, the 1158 way in which a router chooses which one to use is a matter of policy, 1159 subject to the following constraint: if a router can determine that a 1160 given tunnel is not functional, it MUST NOT use that tunnel. In 1161 particular, if the tunnel is identified in a TLV that has a Remote 1162 Endpoint sub-TLV, and if the IP address specified in the sub-TLV is 1163 not reachable from router R, then the tunnel SHOULD be considered 1164 non-functional. Other means of determining whether a given tunnel is 1165 functional MAY be used; specification of such means is outside the 1166 scope of this specification. Of course, if a non-functional tunnel 1167 later becomes functional, router R SHOULD reevaluate its choice of 1168 tunnels. 1170 If router R determines that it cannot use any of the tunnels 1171 specified in the Tunnel Encapsulation attribute, it MAY either drop 1172 packet P, or it MAY transmit packet P as it would had the Tunnel 1173 Encapsulation attribute not been present. This is a matter of local 1174 policy. By default, the packet SHOULD be transmitted as if the 1175 Tunnel Encapsulation attribute had not been present. 1177 A Tunnel Encapsulation attribute may contain several TLVs that all 1178 specify the same tunnel type. Each TLV should be considered as 1179 specifying a different tunnel. Two tunnels of the same type may have 1180 different Remote Endpoint sub-TLVs, different Encapsulation sub-TLVs, 1181 etc. Choosing between two such tunnels is a matter of local policy. 1183 Once router R has decided to send packet P through a particular 1184 tunnel, it encapsulates packet P appropriately and then forwards it 1185 according to the route that leads to the tunnel's remote endpoint. 1186 This route may itself be a BGP route with a Tunnel Encapsulation 1187 attribute. If so, the encapsulated packet is treated as the payload 1188 and is encapsulated according to the Tunnel Encapsulation attribute 1189 of that route. That is, tunnels may be "stacked". 1191 Notwithstanding anything said in this document, a BGP speaker MAY 1192 have local policy that influences the choice of tunnel, and the way 1193 the encapsulation is formed. A BGP speaker MAY also have a local 1194 policy that tells it to ignore the Tunnel Encapsulation attribute 1195 entirely or in part. Of course, interoperability issues must be 1196 considered when such policies are put into place. 1198 6. Routing Considerations 1200 6.1. No Impact on BGP Decision Process 1202 The presence of the Tunnel Encapsulation attribute does not affect 1203 the BGP bestpath selection algorithm. 1205 Under certain circumstances, this may lead to counter-intuitive 1206 consequences. For example, suppose: 1208 o router R1 receives a BGP UPDATE message from router R2, such that 1210 * the NLRI of that UPDATE is prefix X, 1212 * the UPDATE contains a Tunnel Encapsulation attribute specifying 1213 two tunnels, T1 and T2, 1215 * R1 cannot use tunnel T1 or tunnel T2, either because the tunnel 1216 remote endpoint is not reachable or because R1 does not support 1217 that kind of tunnel 1219 o router R1 receives a BGP UPDATE message from router R3, such that 1221 * the NLRI of that UPDATE is prefix X, 1223 * the UPDATE contains a Tunnel Encapsulation attribute specifying 1224 two tunnels, T3 and T4, 1226 * R1 can use at least one of the two tunnels 1228 Since the Tunnel Encapsulation attribute does not affect bestpath 1229 selection, R1 may well install the route from R2 rather than the 1230 route from R3, even though R2's route contains no usable tunnels. 1232 This possibility must be kept in mind whenever a Remote Endpoint sub- 1233 TLV carried by a given UPDATE specifies an IP address that is 1234 different than the next hop of that UPDATE. 1236 6.2. Looping, Infinite Stacking, Etc. 1238 Consider a packet destined for address X. Suppose a BGP UPDATE for 1239 address prefix X carries a Tunnel Encapsulation attribute that 1240 specifies a remote tunnel endpoint of Y. And suppose that a BGP 1241 UPDATE for address prefix Y carries a Tunnel Encapsulation attribute 1242 that specifies a Remote Endpoint of X. It is easy to see that this 1243 will cause an infinite number of encapsulation headers to be put on 1244 the given packet. 1246 This could happen as a result of misconfiguration, either accidental 1247 or intentional. It could also happen if the Tunnel Encapsulation 1248 attribute were altered by a malicious agent. Implementations should 1249 be aware of this. 1251 Improper setting (or malicious altering) of the Tunnel Encapsulation 1252 attribute could also cause data packets to loop. Suppose a BGP 1253 UPDATE for address prefix X carries a Tunnel Encapsulation attribute 1254 that specifies a remote tunnel endpoint of Y. Suppose router R 1255 receives and processes the update. When router R receives a packet 1256 destined for X, it will apply the encapsulation and send the 1257 encapsulated packet to Y. Y will decapsulate the packet and forward 1258 it further. If Y is further away from X than is router R, it is 1259 possible that the path from Y to X will traverse R. This would cause 1260 a long-lasting routing loop. 1262 These possibilities must also be kept in mind whenever the Remote 1263 Endpoint for a given prefix differs from the BGP next hop for that 1264 prefix. 1266 7. Recursive Next Hop Resolution 1268 Suppose that: 1270 o a given packet P must be forwarded by router R1; 1272 o the path along which P is to be forwarded is determined by BGP 1273 UPDATE U1; 1275 o UPDATE U1 does not have a Tunnel Encapsulation attribute; 1276 o the next hop of UPDATE U1 is router R2; 1278 o the best path to router R2 is a BGP route that was advertised in 1279 UPDATE U2; 1281 o UPDATE U2 has a Tunnel Encapsulation attribute. 1283 Then packet P SHOULD be sent through one of the tunnels identified in 1284 the Tunnel Encapsulation attribute of UPDATE U2. See Section 5 for 1285 further details. 1287 However, suppose that one of the TLVs in U2's Tunnel Encapsulation 1288 attribute contains the Color Sub-TLV. In that case, packet P SHOULD 1289 NOT be sent through the tunnel identified in that TLV, unless U1 is 1290 carrying the Color Extended Community that is identified in U2's 1291 Color Sub-TLV. 1293 Note that if UPDATE U1 and UPDATE U2 both have Tunnel Encapsulation 1294 attributes, packet P will be carried through a pair of nested 1295 tunnels. P will first be encapsulated based on the Tunnel 1296 Encapsulation attribute of U1. This encapsulated packet then becomes 1297 the payload, and is encapsulated based on the Tunnel Encapsulation 1298 attribute of U2. This is another way of "stacking" tunnels (see also 1299 Section 5. 1301 The procedures in this section presuppose that U1's next hop resolves 1302 to a BGP route, and that U2's next hop resolves (perhaps after 1303 further recursion) to a non-BGP route. 1305 8. Use of Virtual Network Identifiers and Embedded Labels when Imposing 1306 a Tunnel Encapsulation 1308 If the TLV specifying a tunnel contains an MPLS Label Stack sub-TLV, 1309 then when sending a packet through that tunnel, the procedures of 1310 Section 3.6 are applied before the procedures of this section. 1312 If the TLV specifying a tunnel contains a Prefix-SID sub-TLV, the 1313 procedures of Section 3.7 are applied before the procedures of this 1314 section. If the TLV also contains an MPLS Label Stack sub-TLV, the 1315 procedures of Section 3.6 are applied before the procedures of 1316 Section 3.7. 1318 8.1. Tunnel Types without a Virtual Network Identifier Field 1320 If a Tunnel Encapsulation attribute is attached to an UPDATE of a 1321 labeled address family, there will be one or more labels specified in 1322 the UPDATE's NLRI. When a packet is sent through a tunnel specified 1323 in one of the attribute's TLVs, and that tunnel type does not contain 1324 a virtual network identifier field, the label or labels from the NLRI 1325 are pushed on the packet's label stack. The resulting MPLS packet is 1326 then further encapsulated, as specified by the TLV. 1328 8.2. Tunnel Types with a Virtual Network Identifier Field 1330 Three of the tunnel types that can be specified in a Tunnel 1331 Encapsulation TLV have virtual network identifier fields in their 1332 encapsulation headers. In the VXLAN and VXLAN-GPE encapsulations, 1333 this field is called the VNI field; in the NVGRE encapsulation, this 1334 field is called the VSID field. 1336 When one of these tunnel encapsulations is imposed on a packet, the 1337 setting of the virtual network identifier field in the encapsulation 1338 header depends upon the contents of the Encapsulation sub-TLV (if one 1339 is present). When the Tunnel Encapsulation attribute is being 1340 carried on a BGP UPDATE of a labeled address family, the setting of 1341 the virtual network identifier field also depends upon the contents 1342 of the Embedded Label Handling sub-TLV (if present). 1344 This section specifies the procedures for choosing the value to set 1345 in the virtual network identifier field of the encapsulation header. 1346 These procedures apply only when the tunnel type is VXLAN, VXLAN-GPE, 1347 or NVGRE. 1349 8.2.1. Unlabeled Address Families 1351 This sub-section applies when: 1353 o the Tunnel Encapsulation attribute is carried on a BGP UPDATE of 1354 an unlabeled address family, and 1356 o at least one of the attribute's TLVs identifies a tunnel type that 1357 uses a virtual network identifier, and 1359 o it has been determined to send a packet through one of those 1360 tunnels. 1362 If the TLV identifying the tunnel contains an Encapsulation sub-TLV 1363 whose V bit is set, the virtual network identifier field of the 1364 encapsulation header is set to the value of the virtual network 1365 identifier field of the Encapsulation sub-TLV. 1367 Otherwise, the virtual network identifier field of the encapsulation 1368 header is set to a configured value; if there is no configured value, 1369 the tunnel cannot be used. 1371 8.2.2. Labeled Address Families 1373 This sub-section applies when: 1375 o the Tunnel Encapsulation attribute is carried on a BGP UPDATE of a 1376 labeled address family, and 1378 o at least one of the attribute's TLVs identifies a tunnel type that 1379 uses a virtual network identifier, and 1381 o it has been determined to send a packet through one of those 1382 tunnels. 1384 8.2.2.1. When a Valid VNI has been Signaled 1386 If the TLV identifying the tunnel contains an Encapsulation sub-TLV 1387 whose V bit is set, the virtual network identifier field of the 1388 encapsulation header is set as follows: 1390 o If the TLV contains an Embedded Label Handling sub-TLV whose value 1391 is 1, then the virtual network identifier field of the 1392 encapsulation header is set to the value of the virtual network 1393 identifier field of the Encapsulation sub-TLV. 1395 The embedded label (from the NLRI of the route that is carrying 1396 the Tunnel Encapsulation attribute) appears at the top of the MPLS 1397 label stack in the encapsulation payload. 1399 o If the TLV does not contain an Embedded Label Handling sub-TLV, or 1400 if contains an Embedded Label Handling sub-TLV whose value is 2, 1401 the embedded label is ignored entirely, and the virtual network 1402 identifier field of the encapsulation header is set to the value 1403 of the virtual network identifier field of the Encapsulation sub- 1404 TLV. 1406 8.2.2.2. When a Valid VNI has not been Signaled 1408 If the TLV identifying the tunnel does not contain an Encapsulation 1409 sub-TLV whose V bit is set, the virtual network identifier field of 1410 the encapsulation header is set as follows: 1412 o If the TLV contains an Embedded Label Handling sub-TLV whose value 1413 is 1, then the virtual network identifier field of the 1414 encapsulation header is set to a configured value. 1416 If there is no configured value, the tunnel cannot be used. 1418 The embedded label (from the NLRI of the route that is carrying 1419 the Tunnel Encapsulation attribute) appears at the top of the MPLS 1420 label stack in the encapsulation payload. 1422 o If the TLV does not contain an Embedded Label Handling sub-TLV, or 1423 if it contains an Embedded Label Handling sub-TLV whose value is 1424 2, the embedded label is copied into the virtual network 1425 identifier field of the encapsulation header. 1427 In this case, the payload may or may not contain an MPLS label 1428 stack, depending upon other factors. If the payload does contain 1429 an MPLS lable stack, the embedded label does not appear in that 1430 stack. 1432 9. Applicability Restrictions 1434 In a given UPDATE of a labeled address family, the label embedded in 1435 the NLRI is generally a label that is meaningful only to the router 1436 whose address appears as the next hop. Certain of the procedures of 1437 Section 8.2.2.1 or Section 8.2.2.2 cause the embedded label to be 1438 carried by a data packet to the router whose address appears in the 1439 Remote Endpoint sub-TLV. If the Remote Endpoint sub-TLV does not 1440 identify the same router that is the next hop, sending the packet 1441 through the tunnel may cause the label to be misinterpreted at the 1442 tunnel's remote endpoint. This may cause misdelivery of the packet. 1444 Therefore the embedded label MUST NOT be carried by a data packet 1445 traveling through a tunnel unless it is known that the label will be 1446 properly interpreted at the tunnel's remote endpoint. How this is 1447 known is outside the scope of this document. 1449 Note that if the Tunnel Encapsulation attribute is attached to a VPN- 1450 IP route [RFC4364], and if Inter-AS "option b" (see section 10 of 1451 [RFC4364] is being used, and if the Remote Endpoint sub-TLV contains 1452 an IP address that is not in same AS as the router receiving the 1453 route, it is very likely that the embedded label has been changed. 1454 Therefore use of the Tunnel Encapsulation attribute in an "Inter-AS 1455 option b" scenario is not supported. 1457 10. Scoping 1459 The Tunnel Encapsulation attribute is defined as a transitive 1460 attribute, so that it may be passed along by BGP speakers that do not 1461 recognize it. However, it is intended that the Tunnel Encapsulation 1462 attribute be used only within a well-defined scope, e.g., within a 1463 set of Autonomous Systems that belong to a single administrative 1464 entity. If the attribute is distributed beyond its intended scope, 1465 packets may be sent through tunnels in a manner that is not intended. 1467 To prevent the Tunnel Encapsulation attribute from being distributed 1468 beyond its intended scope, any BGP speaker that understands the 1469 attribute MUST be able to filter the attribute from incoming BGP 1470 UPDATE messages. When the attribute is filtered from an incoming 1471 UPDATE, the attribute is neither processed nor redistributed. This 1472 filtering SHOULD be possible on a per-BGP-session basis. For each 1473 session, filtering of the attribute on incoming UPDATEs MUST be 1474 enabled by default. 1476 In addition, any BGP speaker that understands the attribute MUST be 1477 able to filter the attribute from outgoing BGP UPDATE messages. This 1478 filtering SHOULD be possible on a per-BGP-session basis. For each 1479 session, filtering of the attribute on outgoing UPDATEs MUST be 1480 enabled by default. 1482 11. Error Handling 1484 The Tunnel Encapsulation attribute is a sequence of TLVs, each of 1485 which is a sequence of sub-TLVs. The final octet of a TLV is 1486 determined by its length field. Similarly, the final octet of a sub- 1487 TLV is determined by its length field. The final octet of a TLV MUST 1488 also be the final octet of its final sub-TLV. If this is not the 1489 case, the TLV MUST be considered to be malformed. A TLV that is 1490 found to be malformed for this reason MUST NOT be processed, and MUST 1491 be stripped from the Tunnel Encapsulation attribute before the 1492 attribute is propagated. Subsequent TLVs in the Tunnel Encapsulation 1493 attribute may still be valid, in which case they MUST be processed 1494 and redistributed normally. 1496 If a Tunnel Encapsulation attribute does not have any valid TLVs, or 1497 it does not have the transitive bit set, the "Attribute Discard" 1498 procedure of [RFC7606] is applied. 1500 If a Tunnel Encapsulation attribute can be parsed correctly, but 1501 contains a TLV whose tunnel type is not recognized by a particular 1502 BGP speaker, that BGP speaker MUST NOT consider the attribute to be 1503 malformed. Rather, the TLV with the unrecognized tunnel type MUST be 1504 ignored, and the BGP speaker MUST interpret the attribute as if that 1505 TLV had not been present. If the route carrying the Tunnel 1506 Encapsulation attribute is propagated with the attribute, the 1507 unrecognized TLV SHOULD remain in the attribute. 1509 If a TLV of a Tunnel Encapsulation attribute contains a sub-TLV that 1510 is not recognized by a particular BGP speaker, the BGP speaker SHOULD 1511 process that TLV as if the unrecognized sub-TLV had not been present. 1512 If the route carrying the Tunnel Encapsulation attribute is 1513 propagated with the attribute, the unrecognized TLV SHOULD remain in 1514 the attribute. 1516 In general, if a TLV contains a sub-TLV that is malformed (e.g., 1517 contains a length field whose value is not legal for that sub-TLV), 1518 the sub-TLV should be treated as if it were an unrecognized sub-TLV. 1519 This document specifies one exception to this rule -- if a TLV 1520 contains a malformed Remote Endpoint sub-TLV (as defined in 1521 Section 3.1, the entire TLV MUST be ignored, and SHOULD be removed 1522 from the Tunnel Encapsulation attribute before the route carrying 1523 that attribute is redistributed. 1525 A TLV that does not contain the Remote Endpoint sub-TLV MUST be 1526 treated as if it contained a malformed Remote Endpoint sub-TLV. 1528 A TLV identifying a particular tunnel type may contain a sub-TLV that 1529 is meaningless for that tunnel type. For example, perhaps the TLV 1530 contains a "UDP Destination Port" sub-TLV, but the identified tunnel 1531 type does not use UDP encapsulation at all. Sub-TLVs of this sort 1532 SHOULD be treated as no-ops. That is, they SHOULD NOT affect the 1533 creation of the encapsulation header. However, the sub-TLV MUST NOT 1534 be considered to be malformed, and MUST NOT be removed from the TLV 1535 before the route carrying the Tunnel Encapsulation attribute is 1536 redistributed. (This allows for the possibility that such sub-TLVs 1537 may be given a meaning, in the context of the specified tunnel type, 1538 in the future.) 1540 There is no significance to the order in which the TLVs occur within 1541 the Tunnel Encapsulation attribute. Multiple TLVs may occur for a 1542 given tunnel type; each such TLV is regarded as describing a 1543 different tunnel. 1545 12. IANA Considerations 1547 12.1. Subsequent Address Family Identifiers 1549 IANA is requested to modify the "Subsequent Address Family 1550 Identifiers" registry to indicate that the Encapsulation SAFI is 1551 deprecated. This document should be the reference. 1553 12.2. BGP Path Attributes 1555 IANA has assigned value 23 from the "BGP Path Attributes" Registry, 1556 to "Tunnel Encapsulation Attribute". IANA is requested to add this 1557 document as a reference. 1559 12.3. Extended Communities 1561 IANA has assigned values from the "Transitive Opaque Extended 1562 Community" type Registry to the "Color Extended Community" (sub-type 1563 0x0b), and to the "Encapsulation Extended Community"(0x030c). IANA 1564 is requested to add this document as a reference for both 1565 assignments. 1567 12.4. BGP Tunnel Encapsulation Attribute Sub-TLVs 1569 IANA is requested to add the following note to the "BGP Tunnel 1570 Encapsulation Attribute Sub-TLVs" registry: 1572 If the Sub-TLV Type is in the range from 1 to 127 inclusive, the 1573 Sub-TLV Length field contains one octet. If the Sub-TLV Type is 1574 in the range from 128-254 inclusive, the Sub-TLV Length field 1575 contains two octets. 1577 IANA is requested to change the registration policy of the "BGP 1578 Tunnel Encapsulation Attribute Sub-TLVs" registry to the following: 1580 o The values 0 and 255 are reserved. 1582 o The values in the range 1-63 and 128-191 are to be allocated using 1583 the "Standards Action" registration procedure. 1585 o The values in the range 64-125 and 192-252 are to be allocated 1586 using the "First Come, First Served" registration procedure. 1588 o The values in the range 126-127 and 253-254 are reserved for 1589 experimental use; IANA shall not allocate values from this range. 1591 IANA is requested to assign a codepoint, from the range 1-63 of the 1592 "BGP Tunnel Encapsulation Attribute Sub-TLVs" registry, for "Remote 1593 Endpoint", with this document being the reference. 1595 IANA is requested to assign a codepoint, from the range 1-63 of the 1596 "BGP Tunnel Encapsulation Attribute Sub-TLVs" registry, for "IPv4 DS 1597 Field", with this document being the reference. 1599 IANA is requested to assign a codepoint from the "BGP Tunnel 1600 Encapsulation Attribute Sub-TLVs" registry for "UDP Destination 1601 Port", with this document being the reference. 1603 IANA is requested to assign a codepoint, from the range 1-63 of the 1604 "BGP Tunnel Encapsulation Attribute Sub-TLVs" registry, for "Embedded 1605 Label Handling", with this document being the reference. 1607 IANA is requested to assign a codepoint, from the range 1-63 of the 1608 "BGP Tunnel Encapsulation Attribute Sub-TLVs" registry, for "MPLS 1609 Label Stack", with this document being the reference. 1611 IANA is requested to assign a codepoint, from the range 1-63 of the 1612 "BGP Tunnel Encapsulation Attribute Sub-TLVs" registry, for "Prefix 1613 SID", with this document being the reference. 1615 IANA has assigned codepoints from the "BGP Tunnel Encapsulation 1616 Attribute Sub-TLVs" registry for "Encapsulation", "Protocol Type", 1617 and "Color". IANA is requested to add this document as a reference. 1619 12.5. Tunnel Types 1621 IANA is requested to add this document as a reference for tunnel 1622 types 8 (VXLAN), 9 (NVGRE), 11 (MPLS-in-GRE), and 12 (VXLAN-GPE) in 1623 the "BGP Tunnel Encapsulation Tunnel Types" registry. 1625 IANA is requested to assign a codepoint from the "BGP Tunnel 1626 Encapsulation Tunnel Types" registry for "GTP". 1628 IANA is requested to add this document as a reference for tunnel 1629 types 1 (L2TPv3), 2 (GRE), and 7 (IP in IP) in the "BGP Tunnel 1630 Encapsulation Tunnel Types" registry. 1632 13. Security Considerations 1634 The Tunnel Encapsulation attribute can cause traffic to be diverted 1635 from its normal path, especially when the Remote Endpoint sub-TLV is 1636 used. This can have serious consequences if the attribute is added 1637 or modified illegitimately, as it enables traffic to be "hijacked". 1639 The Remote Endpoint sub-TLV contains both an IP address and an AS 1640 number. BGP Origin Validation [RFC6811] can be used to obtain 1641 assurance that the given IP address belongs to the given AS. While 1642 this provides some protection against misconfiguration, it does not 1643 prevent a malicious agent from inserting a sub-TLV that will appear 1644 valid. 1646 Before sending a packet through the tunnel identified in a particular 1647 TLV of a Tunnel Encapsulation attribute, it may be advisable to use 1648 BGP Origin Validation to obtain the following additional assurances: 1650 o the origin AS of the route carrying the Tunnel Encapsulation 1651 attribute is correct; 1653 o the origin AS of the route to the IP address specified in the 1654 Remote Endpoint sub-TLV is correct, and is the same AS that is 1655 specified in the Remote Endpoint sub-TLV. 1657 One then has some level of assurance that the tunneled traffic is 1658 going to the same destination AS that it would have gone to had the 1659 Tunnel Encapsulation attribute not been present. However, this may 1660 not suit all use cases, and in any event is not very strong 1661 protection against hijacking. 1663 For these reasons, BGP Origin Validation should not be relied upon 1664 exclusively, and the filtering procedures of Section 10 should always 1665 be in place. 1667 Increased protection can be obtained by using BGP Path Validation 1668 [BGPSEC] to ensure that the route carrying the Tunnel Encapsulation 1669 attribute, and the routes to the Remote Endpoint of each specified 1670 tunnel, have not been altered illegitimately. 1672 If BGP Origin Validation is used as specified above, and the tunnel 1673 specified in a particular TLV of a Tunnel Encapsulation attribute is 1674 therefore regarded as "suspicious", that tunnel should not be used. 1675 Other tunnels specified in (other TLVs of) the Tunnel Encapsulation 1676 attribute may still be used. 1678 14. Acknowledgments 1680 This document contains text from RFC5512, co-authored by Pradosh 1681 Mohapatra. The authors of the current document wish to thank Pradosh 1682 for his contribution. RFC5512 itself built upon prior work by Gargi 1683 Nalawade, Ruchi Kapoor, Dan Tappan, David Ward, Scott Wainner, Simon 1684 Barber, and Chris Metz, whom we also thank for their contributions. 1686 The authors wish to think Ron Bonica, John Drake, Satoru Matsushima, 1687 Dhananjaya Rao, John Scudder, Ravi Singh, Thomas Morin, Xiaohu Xu, 1688 and Zhaohui Zhang for their review, comments, and/or helpful 1689 discussions. 1691 15. Contributor Addresses 1693 Below is a list of other contributing authors in alphabetical order: 1695 Randy Bush 1696 Internet Initiative Japan 1697 5147 Crystal Springs 1698 Bainbridge Island, Washington 98110 1699 United States 1701 Email: randy@psg.com 1703 Robert Raszuk 1704 Bloomberg LP 1705 731 Lexington Ave 1706 New York City, NY 10022 1707 United States 1709 Email: robert@raszuk.net 1711 16. References 1713 16.1. Normative References 1715 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1716 Requirement Levels", BCP 14, RFC 2119, 1717 DOI 10.17487/RFC2119, March 1997, 1718 . 1720 [RFC5512] Mohapatra, P. and E. Rosen, "The BGP Encapsulation 1721 Subsequent Address Family Identifier (SAFI) and the BGP 1722 Tunnel Encapsulation Attribute", RFC 5512, 1723 DOI 10.17487/RFC5512, April 2009, 1724 . 1726 [RFC7606] Chen, E., Ed., Scudder, J., Ed., Mohapatra, P., and K. 1727 Patel, "Revised Error Handling for BGP UPDATE Messages", 1728 RFC 7606, DOI 10.17487/RFC7606, August 2015, 1729 . 1731 16.2. Informative References 1733 [BGPSEC] Lepinski, M. and S. Turner, "An Overview of BGPsec", 1734 internet-draft draft-ietf-sidr-bgpsec-overview, June 2015. 1736 [Ethertypes] 1737 "IANA Ethertype Registry", 1738 . 1741 [EVPN-Inter-Subnet] 1742 Sajassi, A., Salem, S., Thoria, S., Rekhter, Y., Drake, 1743 J., Yong, L., Dunbar, L., Henderickx, W., Rabadan, J., 1744 Balus, F., and D. Cai, "Integrated Routing and Bridging in 1745 EVPN", internet-draft draft-ietf-bess-evpn-inter-subnet- 1746 forwarding, October 2015. 1748 [GTP-U] 3GPP, "GPRS Tunneling Protocol User Plane, TS 29.281", 1749 2014. 1751 [Prefix-SID-Attribute] 1752 Previdi, S., Filsfils, C., Lindem, A., Patel, K., 1753 Sreekantiah, A., Ray, S., and H. Gredler, "Segment Routing 1754 Prefix SID extensions for BGP", internet-draft draft-ietf- 1755 idr-bgp-prefix-sid-02, December 2015. 1757 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 1758 "Definition of the Differentiated Services Field (DS 1759 Field) in the IPv4 and IPv6 Headers", RFC 2474, 1760 DOI 10.17487/RFC2474, December 1998, 1761 . 1763 [RFC2784] Farinacci, D., Li, T., Hanks, S., Meyer, D., and P. 1764 Traina, "Generic Routing Encapsulation (GRE)", RFC 2784, 1765 DOI 10.17487/RFC2784, March 2000, 1766 . 1768 [RFC2890] Dommety, G., "Key and Sequence Number Extensions to GRE", 1769 RFC 2890, DOI 10.17487/RFC2890, September 2000, 1770 . 1772 [RFC3931] Lau, J., Ed., Townsley, M., Ed., and I. Goyret, Ed., 1773 "Layer Two Tunneling Protocol - Version 3 (L2TPv3)", 1774 RFC 3931, DOI 10.17487/RFC3931, March 2005, 1775 . 1777 [RFC4023] Worster, T., Rekhter, Y., and E. Rosen, Ed., 1778 "Encapsulating MPLS in IP or Generic Routing Encapsulation 1779 (GRE)", RFC 4023, DOI 10.17487/RFC4023, March 2005, 1780 . 1782 [RFC4364] Rosen, E. and Y. Rekhter, "BGP/MPLS IP Virtual Private 1783 Networks (VPNs)", RFC 4364, DOI 10.17487/RFC4364, February 1784 2006, . 1786 [RFC6514] Aggarwal, R., Rosen, E., Morin, T., and Y. Rekhter, "BGP 1787 Encodings and Procedures for Multicast in MPLS/BGP IP 1788 VPNs", RFC 6514, DOI 10.17487/RFC6514, February 2012, 1789 . 1791 [RFC6811] Mohapatra, P., Scudder, J., Ward, D., Bush, R., and R. 1792 Austein, "BGP Prefix Origin Validation", RFC 6811, 1793 DOI 10.17487/RFC6811, January 2013, 1794 . 1796 [RFC7348] Mahalingam, M., Dutt, D., Duda, K., Agarwal, P., Kreeger, 1797 L., Sridhar, T., Bursell, M., and C. Wright, "Virtual 1798 eXtensible Local Area Network (VXLAN): A Framework for 1799 Overlaying Virtualized Layer 2 Networks over Layer 3 1800 Networks", RFC 7348, DOI 10.17487/RFC7348, August 2014, 1801 . 1803 [RFC7510] Xu, X., Sheth, N., Yong, L., Callon, R., and D. Black, 1804 "Encapsulating MPLS in UDP", RFC 7510, 1805 DOI 10.17487/RFC7510, April 2015, 1806 . 1808 [RFC7637] Garg, P., Ed. and Y. Wang, Ed., "NVGRE: Network 1809 Virtualization Using Generic Routing Encapsulation", 1810 RFC 7637, DOI 10.17487/RFC7637, September 2015, 1811 . 1813 [vEPC] Matsushima, S. and R. Wakikawa, "Stateless User-Plane 1814 Architecture for Virtualized EPC", internet-draft draft- 1815 matsushima-stateless-uplane-vepc-06, March 2016. 1817 [VXLAN-GPE] 1818 Kreeger, L. and U. Elzur, "Generic Protocol Extension for 1819 VXLAN", internet-draft draft-ietf-nvo3-vxlan-gpe, May 1820 2016. 1822 Authors' Addresses 1824 Eric C. Rosen (editor) 1825 Juniper Networks, Inc. 1826 10 Technology Park Drive 1827 Westford, Massachusetts 01886 1828 United States 1830 Email: erosen@juniper.net 1831 Keyur Patel 1832 Cisco Systems 1833 170 W. Tasman Drive 1834 San Jose, CA 95134 1835 United States 1837 Email: keyupate@cisco.com 1839 Gunter Van de Velde 1840 Nokia 1841 Copernicuslaan 50 1842 Antwerpen 2018 1843 Belgium 1845 Email: gunter.van_de_velde@nokia.com