idnits 2.17.1 draft-ietf-idr-tunnel-encaps-09.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 date (February 28, 2018) is 2220 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 (-15) exists of draft-ietf-bess-evpn-inter-subnet-forwarding-03 == Outdated reference: A later version (-27) exists of draft-ietf-idr-bgp-prefix-sid-17 -- Obsolete informational reference (is this intentional?): RFC 5566 (Obsoleted by RFC 9012) Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 2 comments (--). 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 Arrcus 6 Expires: September 1, 2018 G. Van de Velde 7 Nokia 8 February 28, 2018 10 The BGP Tunnel Encapsulation Attribute 11 draft-ietf-idr-tunnel-encaps-09 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 in production), and 25 specifies semantics for the attribute when it is carried in UPDATEs 26 of certain other SAFIs. This document adds support for additional 27 tunnel types, and allows a remote tunnel endpoint address to be 28 specified for each tunnel. This document also provides support for 29 specifying fields of any inner or outer encapsulations that may be 30 used by a particular 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 https://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 September 1, 2018. 50 Copyright Notice 52 Copyright (c) 2018 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 (https://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 1.4. Impact on RFC 5566 . . . . . . . . . . . . . . . . . . . 6 72 2. The Tunnel Encapsulation Attribute . . . . . . . . . . . . . 6 73 3. Tunnel Encapsulation Attribute Sub-TLVs . . . . . . . . . . . 8 74 3.1. The Remote Endpoint Sub-TLV . . . . . . . . . . . . . . . 8 75 3.2. Encapsulation Sub-TLVs for Particular Tunnel Types . . . 10 76 3.2.1. VXLAN . . . . . . . . . . . . . . . . . . . . . . . . 11 77 3.2.2. VXLAN-GPE . . . . . . . . . . . . . . . . . . . . . . 12 78 3.2.3. NVGRE . . . . . . . . . . . . . . . . . . . . . . . . 13 79 3.2.4. L2TPv3 . . . . . . . . . . . . . . . . . . . . . . . 14 80 3.2.5. GRE . . . . . . . . . . . . . . . . . . . . . . . . . 15 81 3.2.6. MPLS-in-GRE . . . . . . . . . . . . . . . . . . . . . 15 82 3.3. Outer Encapsulation Sub-TLVs . . . . . . . . . . . . . . 16 83 3.3.1. IPv4 DS Field . . . . . . . . . . . . . . . . . . . . 16 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 . . . . . . . . . . . . . . . . . . . . 17 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 . . . . . . . . . . . . . 23 95 4.3. Color Extended Community . . . . . . . . . . . . . . . . 23 97 5. Semantics and Usage of the Tunnel Encapsulation 98 attribute . . . . . . . . . . . . . . . . . . . . . . . . . . 23 99 6. Routing Considerations . . . . . . . . . . . . . . . . . . . 27 100 6.1. No Impact on BGP Decision Process . . . . . . . . . . . . 27 101 6.2. Looping, Infinite Stacking, Etc. . . . . . . . . . . . . 27 102 7. Recursive Next Hop Resolution . . . . . . . . . . . . . . . . 28 103 8. Use of Virtual Network Identifiers and Embedded Labels 104 when Imposing a Tunnel Encapsulation . . . . . . . . . . . . 29 105 8.1. Tunnel Types without a Virtual Network Identifier 106 Field . . . . . . . . . . . . . . . . . . . . . . . . . . 29 107 8.2. Tunnel Types with a Virtual Network Identifier Field . . 29 108 8.2.1. Unlabeled Address Families . . . . . . . . . . . . . 30 109 8.2.2. Labeled Address Families . . . . . . . . . . . . . . 30 110 8.2.2.1. When a Valid VNI has been Signaled . . . . . . . 31 111 8.2.2.2. When a Valid VNI has not been Signaled . . . . . 31 112 9. Applicability Restrictions . . . . . . . . . . . . . . . . . 32 113 10. Scoping . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 114 11. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 33 115 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 35 116 12.1. Subsequent Address Family Identifiers . . . . . . . . . 35 117 12.2. BGP Path Attributes . . . . . . . . . . . . . . . . . . 35 118 12.3. Extended Communities . . . . . . . . . . . . . . . . . . 35 119 12.4. BGP Tunnel Encapsulation Attribute Sub-TLVs . . . . . . 35 120 12.5. Tunnel Types . . . . . . . . . . . . . . . . . . . . . . 36 121 13. Security Considerations . . . . . . . . . . . . . . . . . . . 36 122 14. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 37 123 15. Contributor Addresses . . . . . . . . . . . . . . . . . . . . 37 124 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 38 125 16.1. Normative References . . . . . . . . . . . . . . . . . . 38 126 16.2. Informative References . . . . . . . . . . . . . . . . . 38 127 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 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" in this document are to be interpreted as described in BCP 139 14 [RFC2119] [RFC8174] when, and only when, they appear in all 140 capitals, as shown here. 142 1.1. Brief Summary of RFC 5512 144 [RFC5512] defines a BGP Path Attribute known as the Tunnel 145 Encapsulation attribute. This attribute consists of one or more 146 TLVs. Each TLV identifies a particular type of tunnel. Each TLV 147 also contains one or more sub-TLVs. Some of the sub-TLVs, e.g., the 148 "Encapsulation sub-TLV", contain information that may be used to form 149 the encapsulation header for the specified tunnel type. Other sub- 150 TLVs, e.g., the "color sub-TLV" and the "protocol sub-TLV", contain 151 information that aids in determining whether particular packets 152 should be sent through the tunnel that the TLV identifies. 154 [RFC5512] only allows the Tunnel Encapsulation attribute to be 155 attached to BGP UPDATE messages of the Encapsulation Address Family. 156 These UPDATE messages have an AFI (Address Family Identifier) of 1 or 157 2, and a SAFI of 7. In an UPDATE of the Encapsulation SAFI, the NLRI 158 (Network Layer Reachability Information) is an address of the BGP 159 speaker originating the UPDATE. Consider the following scenario: 161 o BGP speaker R1 has received and installed UPDATE U; 163 o UPDATE U's SAFI is the Encapsulation SAFI; 165 o UPDATE U has the address R2 as its NLRI; 167 o UPDATE U has a Tunnel Encapsulation attribute. 169 o R1 has a packet, P, to transmit to destination D; 171 o R1's best path to D is a BGP route that has R2 as its next hop; 173 In this scenario, when R1 transmits packet P, it should transmit it 174 to R2 through one of the tunnels specified in U's Tunnel 175 Encapsulation attribute. The IP address of the remote endpoint of 176 each such tunnel is R2. Packet P is known as the tunnel's "payload". 178 1.2. Deficiencies in RFC 5512 180 While the ability to specify tunnel information in a BGP UPDATE is 181 useful, the procedures of [RFC5512] have certain limitations: 183 o The requirement to use the "Encapsulation SAFI" presents an 184 unfortunate operational cost, as each BGP session that may need to 185 carry tunnel encapsulation information needs to be reconfigured to 186 support the Encapsulation SAFI. The Encapsulation SAFI has never 187 been used, and this requirement has served only to discourage the 188 use of the Tunnel Encapsulation attribute. 190 o There is no way to use the Tunnel Encapsulation attribute to 191 specify the remote endpoint address of a given tunnel; [RFC5512] 192 assumes that the remote endpoint of each tunnel is specified as 193 the NLRI of an UPDATE of the Encapsulation-SAFI. 195 o If the respective best paths to two different address prefixes 196 have the same next hop, [RFC5512] does not provide a 197 straightforward method to associate each prefix with a different 198 tunnel. 200 o If a particular tunnel type requires an outer IP or UDP 201 encapsulation, there is no way to signal the values of any of the 202 fields of the outer encapsulation. 204 o In [RFC5512]'s specification of the sub-TLVs, each sub-TLV has 205 one-octet length field. In some cases, a two-octet length field 206 may be needed. 208 1.3. Brief Summary of Changes from RFC 5512 210 In this document we address these deficiencies by: 212 o Deprecating the Encapsulation SAFI. 214 o Defining a new "Remote Endpoint Address sub-TLV" that can be 215 included in any of the TLVs contained in the Tunnel Encapsulation 216 attribute. This sub-TLV can be used to specify the remote 217 endpoint address of a particular tunnel. 219 o Allowing the Tunnel Encapsulation attribute to be carried by BGP 220 UPDATEs of additional AFI/SAFIs. Appropriate semantics are 221 provided for this way of using the attribute. 223 o Defining a number of new sub-TLVs that provide additional 224 information that is useful when forming the encapsulation header 225 used to send a packet through a particular tunnel. 227 o Defining the sub-TLV type field so that a sub-TLV whose type is in 228 the range from 0 to 127 inclusive has a one-octet length field, 229 but a sub-TLV whose type is in the range from 128 to 255 inclusive 230 has a two-octet length field. 232 One of the sub-TLVs defined in [RFC5512] is the "Encapsulation sub- 233 TLV". For a given tunnel, the encapsulation sub-TLV specifies some 234 of the information needed to construct the encapsulation header used 235 when sending packets through that tunnel. This document defines 236 encapsulation sub-TLVs for a number of tunnel types not discussed in 237 [RFC5512]: VXLAN (Virtual Extensible Local Area Network, [RFC7348]), 238 VXLAN-GPE (Generic Protocol Extension for VXLAN, [VXLAN-GPE]), NVGRE 239 (Network Virtualization Using Generic Routing Encapsulation 240 [RFC7637]), and MPLS-in-GRE (MPLS in Generic Routing Encapsulation 241 [RFC2784], [RFC2890], [RFC4023]). MPLS-in-UDP [RFC7510] is also 242 supported, but an Encapsulation sub-TLV for it is not needed. 244 Some of the encapsulations mentioned in the previous paragraph need 245 to be further encapsulated inside UDP and/or IP. [RFC5512] provides 246 no way to specify that certain information is to appear in these 247 outer IP and/or UDP encapsulations. This document provides a 248 framework for including such information in the TLVs of the Tunnel 249 Encapsulation attribute. 251 When the Tunnel Encapsulation attribute is attached to a BGP UPDATE 252 whose AFI/SAFI identifies one of the labeled address families, it is 253 not always obvious whether the label embedded in the NLRI is to 254 appear somewhere in the tunnel encapsulation header (and if so, 255 where), or whether it is to appear in the payload, or whether it can 256 be omitted altogether. This is especially true if the tunnel 257 encapsulation header itself contains a "virtual network identifier". 258 This document provides a mechanism that allows one to signal (by 259 using sub-TLVs of the Tunnel Encapsulation attribute) how one wants 260 to use the embedded label when the tunnel encapsulation has its own 261 virtual network identifier field. 263 [RFC5512] defines a Tunnel Encapsulation Extended Community, that can 264 be used instead of the Tunnel Encapsulation attribute under certain 265 circumstances. This document addresses the issue of how to handle a 266 BGP UPDATE that carries both a Tunnel Encapsulation attribute and one 267 or more Tunnel Encapsulation Extended Communities. 269 1.4. Impact on RFC 5566 271 [RFC5566] uses the mechanisms defined in [RFC5512]. While this 272 document obsoletes [RFC5512], it does not address the issue of how to 273 use the mechanisms of [RFC5566] without also using the Encapsulation 274 SAFI. Those issues are considered to be outside the scope of this 275 document. 277 2. The Tunnel Encapsulation Attribute 279 The Tunnel Encapsulation attribute is an optional transitive BGP Path 280 attribute. IANA has assigned the value 23 as the type code of the 281 attribute. The attribute is composed of a set of Type-Length-Value 282 (TLV) encodings. Each TLV contains information corresponding to a 283 particular tunnel type. A TLV is structured as shown in Figure 1: 285 0 1 2 3 286 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 287 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 288 | Tunnel Type (2 Octets) | Length (2 Octets) | 289 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 290 | | 291 | Value | 292 | | 293 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 295 Figure 1: Tunnel Encapsulation TLV Value Field 297 o Tunnel Type (2 octets): identifies a type of tunnel. The field 298 contains values from the IANA Registry "BGP Tunnel Encapsulation 299 Attribute Tunnel Types". 301 Note that for tunnel types whose names are of the form "X-in-Y", 302 e.g., "MPLS-in-GRE", only packets of the specified payload type 303 "X" are to be carried through the tunnel of type "Y". This is the 304 equivalent of specifying a tunnel type "Y" and including in its 305 TLV a Protocol Type sub-TLV (see Section 3.4.1) specifying 306 protocol "X". If the tunnel type is "X-in-Y", it is unnecessary, 307 though harmless, to include a Protocol Type sub-TLV specifying 308 "X". 310 o Length (2 octets): the total number of octets of the value field. 312 o Value (variable): comprised of multiple sub-TLVs. 314 Each sub-TLV consists of three fields: a 1-octet type, a 1-octet or 315 2-octet length field (depending on the type), and zero or more octets 316 of value. A sub-TLV is structured as shown in Figure 2: 318 +-----------------------------------+ 319 | Sub-TLV Type (1 Octet) | 320 +-----------------------------------+ 321 | Sub-TLV Length (1 or 2 Octets)| 322 +-----------------------------------+ 323 | Sub-TLV Value (Variable) | 324 | | 325 +-----------------------------------+ 327 Figure 2: Tunnel Encapsulation Sub-TLV Format 329 o Sub-TLV Type (1 octet): each sub-TLV type defines a certain 330 property about the tunnel TLV that contains this sub-TLV. 332 o Sub-TLV Length (1 or 2 octets): the total number of octets of the 333 sub-TLV value field. The Sub-TLV Length field contains 1 octet if 334 the Sub-TLV Type field contains a value in the range from 0-127. 335 The Sub-TLV Length field contains two octets if the Sub-TLV Type 336 field contains a value in the range from 128-255. 338 o Sub-TLV Value (variable): encodings of the value field depend on 339 the sub-TLV type as enumerated above. The following sub-sections 340 define the encoding in detail. 342 3. Tunnel Encapsulation Attribute Sub-TLVs 344 In this section, we specify a number of sub-TLVs. These sub-TLVs can 345 be included in a TLV of the Tunnel Encapsulation attribute. 347 3.1. The Remote Endpoint Sub-TLV 349 The Remote Endpoint sub-TLV is a sub-TLV whose value field contains 350 three sub-fields: 352 1. a four-octet Autonomous System (AS) number sub-field 354 2. a two-octet Address Family sub-field 356 3. an address sub-field, whose length depends upon the Address 357 Family. 359 0 1 2 3 360 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 361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 362 | Autonomous System Number | 363 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 364 | Address Family | Address ~ 365 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 366 ~ ~ 367 | | 368 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 370 Figure 3: Remote Endpoint Sub-TLV Value Field 372 The Address Family subfield contains a value from IANA's "Address 373 Family Numbers" registry. In this document, we assume that the 374 Address Family is either IPv4 or IPv6; use of other address families 375 is outside the scope of this document. 377 If the Address Family subfield contains the value for IPv4, the 378 address subfield must contain an IPv4 address (a /32 IPv4 prefix). 380 In this case, the length field of Remote Endpoint sub-TLV must 381 contain the value 10 (0xa). 383 If the Address Family subfield contains the value for IPv6, the 384 address sub-field must contain an IPv6 address (a /128 IPv6 prefix). 385 In this case, the length field of Remote Endpoint sub-TLV must 386 contain the value 22 (0x16). IPv6 link local addresses are not valid 387 values of the IP address field. 389 In a given BGP UPDATE, the address family (IPv4 or IPv6) of a Remote 390 Endpoint sub-TLV is independent of the address family of the UPDATE 391 itself. For example, an UPDATE whose NLRI is an IPv4 address may 392 have a Tunnel Encapsulation attribute containing Remote Endpoint sub- 393 TLVs that contain IPv6 addresses. Also, different tunnels 394 represented in the Tunnel Encapsulation attribute may have Remote 395 Endpoints of different address families. 397 A two-octet AS number can be carried in the AS number field by 398 setting the two high order octets to zero, and carrying the number in 399 the two low order octets of the field. 401 The AS number in the sub-TLV MUST be the number of the AS to which 402 the IP address in the sub-TLV belongs. 404 There is one special case: the Remote Endpoint sub-TLV MAY have a 405 value field whose Address Family subfield contains 0. This means 406 that the tunnel's remote endpoint is the UPDATE's BGP next hop. If 407 the Address Family subfield contains 0, the Address subfield is 408 omitted, and the Autonomous System number field is set to 0. 410 If any of the following conditions hold, the Remote Endpoint sub-TLV 411 is considered to be "malformed": 413 o The sub-TLV contains the value for IPv4 in its Address Family 414 subfield, but the length of the sub-TLV's value field is other 415 than 10 (0xa). 417 o The sub-TLV contains the value for IPv6 in its Address Family 418 subfield, but the length of the sub-TLV's value field is other 419 than 22 (0x16). 421 o The sub-TLV contains the value zero in its Address Family field, 422 but the length of the sub-TLV's value field is other than 6, or 423 the Autonomous System subfield is not set to zero. 425 o The IP address in the sub-TLV's address subfield is not a valid IP 426 address (e.g., it's an IPv4 broadcast address). 428 o It can be determined that the IP address in the sub-TLV's address 429 subfield does not belong to the non-zero AS whose number is in the 430 its Autonomous System subfield. (See section Section 13 for 431 discussion of one way to determine this.) 433 If the Remote Endpoint sub-TLV is malformed, the TLV containing it is 434 also considered to be malformed, and the entire TLV MUST be ignored. 435 However, the Tunnel Encapsulation attribute SHOULD NOT be considered 436 to be malformed in this case; other TLVs in the attribute SHOULD be 437 processed (if they can be parsed correctly). 439 When redistributing a route that is carrying a Tunnel Encapsulation 440 attribute containing a TLV that itself contains a malformed Remote 441 Endpoint sub-TLV, the TLV SHOULD be removed from the attribute before 442 redistribution. 444 See Section 11 for further discussion of how to handle errors that 445 are encountered when parsing the Tunnel Encapsulation attribute. 447 If the Remote Endpoint sub-TLV contains an IPv4 or IPv6 address that 448 is valid but not reachable, the sub-TLV is NOT considered to be 449 malformed, and the containing TLV SHOULD NOT be removed from the 450 attribute before redistribution. However, the tunnel identified by 451 the TLV containing that sub-TLV cannot be used until such time as the 452 address becomes reachable. See Section 5. 454 3.2. Encapsulation Sub-TLVs for Particular Tunnel Types 456 This section defines Tunnel Encapsulation sub-TLVs for the following 457 tunnel types: VXLAN ([RFC7348]), VXLAN-GPE ([VXLAN-GPE]), NVGRE 458 ([RFC7637]), MPLS-in-GRE ([RFC2784], [RFC2890], [RFC4023]), L2TPv3 459 ([RFC3931]), and GRE ([RFC2784], [RFC2890], [RFC4023]). 461 Rules for forming the encapsulation based on the information in a 462 given TLV are given in Sections 5 and 8. 464 For some tunnel types, the rules are obvious and not mentioned in 465 this document. 467 There are also tunnel types for which it is not necessary to define 468 an Encapsulation sub-TLV, because there are no fields in the 469 encapsulation header whose values need to be signaled from the remote 470 endpoint. 472 3.2.1. VXLAN 474 This document defines an encapsulation sub-TLV for VXLAN tunnels. 475 When the tunnel type is VXLAN, the following is the structure of the 476 value field in the encapsulation sub-TLV: 478 0 1 2 3 479 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 480 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 481 |V|M|R|R|R|R|R|R| VN-ID (3 Octets) | 482 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 483 | MAC Address (4 Octets) | 484 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 485 | MAC Address (2 Octets) | Reserved | 486 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 488 Figure 4: VXLAN Encapsulation Sub-TLV 490 V: This bit is set to 1 to indicate that a "valid" VN-ID (Virtual 491 Network Identifier) is present in the encapsulation sub-TLV. 492 Please see Section 8. 494 M: This bit is set to 1 to indicate that a valid MAC Address is 495 present in the encapsulation sub-TLV. 497 R: The remaining bits in the 8-bit flags field are reserved for 498 further use. They SHOULD always be set to 0. 500 VN-ID: If the V bit is set, the VN-id field contains a 3 octet VN- 501 ID value. If the V bit is not set, the VN-id field SHOULD be set 502 to zero. 504 MAC Address: If the M bit is set, this field contains a 6 octet 505 Ethernet MAC address. If the M bit is not set, this field SHOULD 506 be set to all zeroes. 508 When forming the VXLAN encapsulation header: 510 o The values of the V, M, and R bits are NOT copied into the flags 511 field of the VXLAN header. The flags field of the VXLAN header is 512 set as per [RFC7348]. 514 o If the M bit is set, the MAC Address is copied into the Inner 515 Destination MAC Address field of the Inner Ethernet Header (see 516 section 5 of [RFC7348]. 518 If the M bit is not set, and the payload being sent through the 519 VXLAN tunnel is an ethernet frame, the Destination MAC Address 520 field of the Inner Ethernet Header is just the Destination MAC 521 Address field of the payload's ethernet header. 523 If the M bit is not set, and the payload being sent through the 524 VXLAN tunnel is an IP or MPLS packet, the Inner Destination MAC 525 address field is set to a configured value; if there is no 526 configured value, the VXLAN tunnel cannot be used. 528 o See Section 8 to see how the VNI field of the VXLAN encapsulation 529 header is set. 531 Note that in order to send an IP packet or an MPLS packet through a 532 VXLAN tunnel, the packet must first be encapsulated in an ethernet 533 header, which becomes the "inner ethernet header" described in 534 [RFC7348]. The VXLAN Encapsulation sub-TLV may contain information 535 (e.g.,the MAC address) that is used to form this ethernet header. 537 3.2.2. VXLAN-GPE 539 This document defines an encapsulation sub-TLV for VXLAN tunnels. 540 When the tunnel type is VXLAN-GPE, the following is the structure of 541 the value field in the encapsulation sub-TLV: 543 0 1 2 3 544 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 545 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 546 |Ver|V|R|R|R|R|R| Reserved | 547 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 548 | VN-ID | Reserved | 549 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 551 Figure 5: VXLAN GPE Encapsulation Sub-TLV 553 V: This bit is set to 1 to indicate that a "valid" VN-ID is 554 present in the encapsulation sub-TLV. Please see Section 8. 556 R: The bits designated "R" above are reserved for future use. 557 They SHOULD always be set to zero. 559 Version (Ver): Indicates VXLAN GPE protocol version. (See the 560 "Version Bits" section of [VXLAN-GPE].) If the indicated version 561 is not supported, the TLV that contains this Encapsulation sub-TLV 562 MUST be treated as specifying an unsupported tunnel type. The 563 value of this field will be copied into the corresponding field of 564 the VXLAN encapsulation header. 566 VN-ID: If the V bit is set, this field contains a 3 octet VN-ID 567 value. If the V bit is not set, this field SHOULD be set to zero. 569 When forming the VXLAN-GPE encapsulation header: 571 o The values of the V and R bits are NOT copied into the flags field 572 of the VXLAN-GPE header. However, the values of the Ver bits are 573 copied into the VXLAN-GPE header. Other bits in the flags field 574 of the VXLAN-GPE header are set as per [VXLAN-GPE]. 576 o See Section 8 to see how the VNI field of the VXLAN-GPE 577 encapsulation header is set. 579 3.2.3. NVGRE 581 This document defines an encapsulation sub-TLV for NVGRE tunnels. 582 When the tunnel type is NVGRE, the following is the structure of the 583 value field in the encapsulation sub-TLV: 585 0 1 2 3 586 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 587 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 588 |V|M|R|R|R|R|R|R| VN-ID (3 Octets) | 589 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 590 | MAC Address (4 Octets) | 591 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 592 | MAC Address (2 Octets) | Reserved | 593 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 595 Figure 6: NVGRE Encapsulation Sub-TLV 597 V: This bit is set to 1 to indicate that a "valid" VN-ID is 598 present in the encapsulation sub-TLV. Please see Section 8. 600 M: This bit is set to 1 to indicate that a valid MAC Address is 601 present in the encapsulation sub-TLV. 603 R: The remaining bits in the 8-bit flags field are reserved for 604 further use. They SHOULD always be set to 0. 606 VN-ID: If the V bit is set, the VN-id field contains a 3 octet VN- 607 ID value. If the V bit is not set, the VN-id field SHOULD be set 608 to zero. 610 MAC Address: If the M bit is set, this field contains a 6 octet 611 Ethernet MAC address. If the M bit is not set, this field SHOULD 612 be set to all zeroes. 614 When forming the NVGRE encapsulation header: 616 o The values of the V, M, and R bits are NOT copied into the flags 617 field of the NVGRE header. The flags field of the VXLAN header is 618 set as per [RFC7637]. 620 o If the M bit is set, the MAC Address is copied into the Inner 621 Destination MAC Address field of the Inner Ethernet Header (see 622 section 3.2 of [RFC7637]. 624 If the M bit is not set, and the payload being sent through the 625 NVGRE tunnel is an ethernet frame, the Destination MAC Address 626 field of the Inner Ethernet Header is just the Destination MAC 627 Address field of the payload's ethernet header. 629 If the M bit is not set, and the payload being sent through the 630 NVGRE tunnel is an IP or MPLS packet, the Inner Destination MAC 631 address field is set to a configured value; if there is no 632 configured value, the NVGRE tunnel cannot be used. 634 o See Section 8 to see how the VSID (Virtual Subnet Identifier) 635 field of the NVGRE encapsulation header is set. 637 3.2.4. L2TPv3 639 When the tunnel type of the TLV is L2TPv3 over IP, the following is 640 the structure of the value field of the encapsulation sub-TLV: 642 0 1 2 3 643 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 644 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 645 | Session ID (4 octets) | 646 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 647 | | 648 | Cookie (Variable) | 649 | | 650 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 652 Figure 7: L2TPv3 Encapsulation Sub-TLV 654 Session ID: a non-zero 4-octet value locally assigned by the 655 advertising router that serves as a lookup key in the incoming 656 packet's context. 658 Cookie: an optional, variable length (encoded in octets -- 0 to 8 659 octets) value used by L2TPv3 to check the association of a 660 received data message with the session identified by the Session 661 ID. Generation and usage of the cookie value is as specified in 662 [RFC3931]. 664 The length of the cookie is not encoded explicitly, but can be 665 calculated as (sub-TLV length - 4). 667 3.2.5. GRE 669 When the tunnel type of the TLV is GRE, the following is the 670 structure of the value field of the encapsulation sub-TLV: 672 0 1 2 3 673 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 674 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 675 | GRE Key (4 octets) | 676 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 678 Figure 8: GRE Encapsulation Sub-TLV 680 GRE Key: 4-octet field [RFC2890] that is generated by the 681 advertising router. The actual method by which the key is 682 obtained is beyond the scope of this document. The key is 683 inserted into the GRE encapsulation header of the payload packets 684 sent by ingress routers to the advertising router. It is intended 685 to be used for identifying extra context information about the 686 received payload. 688 Note that the key is optional. Unless a key value is being 689 advertised, the GRE encapsulation sub-TLV MUST NOT be present. 691 3.2.6. MPLS-in-GRE 693 When the tunnel type is MPLS-in-GRE, the following is the structure 694 of the value field in an optional encapsulation sub-TLV: 696 0 1 2 3 697 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 698 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 699 | GRE-Key (4 Octets) | 700 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 702 Figure 9: MPLS-in-GRE Encapsulation Sub-TLV 704 GRE-Key: 4-octet field [RFC2890] that is generated by the 705 advertising router. The actual method by which the key is 706 obtained is beyond the scope of this document. The key is 707 inserted into the GRE encapsulation header of the payload packets 708 sent by ingress routers to the advertising router. It is intended 709 to be used for identifying extra context information about the 710 received payload. Note that the key is optional. Unless a key 711 value is being advertised, the MPLS-in-GRE encapsulation sub-TLV 712 MUST NOT be present. 714 Note that the GRE tunnel type defined in Section 3.2.5 can be used 715 instead of the MPLS-in-GRE tunnel type when it is necessary to 716 encapsulate MPLS in GRE. Including a TLV of the MPLS-in-GRE tunnel 717 type is equivalent to including a TLV of the GRE tunnel type that 718 also includes a Protocol Type sub-TLV (Section 3.4.1) specifying MPLS 719 as the protocol to be encapsulated. That is, if a TLV specifies 720 MPLS-in-GRE or if it includes a Protocol Type sub-TLV specifying 721 MPLS, the GRE tunnel advertised in that TLV MUST NOT be used for 722 carrying IP packets. 724 While it is not really necessary to have both the GRE and MPLS-in-GRE 725 tunnel types, both are included for reasons of backwards 726 compatibility. 728 3.3. Outer Encapsulation Sub-TLVs 730 The Encapsulation sub-TLV for a particular tunnel type allows one to 731 specify the values that are to be placed in certain fields of the 732 encapsulation header for that tunnel type. However, some tunnel 733 types require an outer IP encapsulation, and some also require an 734 outer UDP encapsulation. The Encapsulation sub-TLV for a given 735 tunnel type does not usually provide a way to specify values for 736 fields of the outer IP and/or UDP encapsulations. If it is necessary 737 to specify values for fields of the outer encapsulation, additional 738 sub-TLVs must be used. This document defines two such sub-TLVs. 740 If an outer encapsulation sub-TLV occurs in a TLV for a tunnel type 741 that does not use the corresponding outer encapsulation, the sub-TLV 742 is treated as if it were an unknown type of sub-TLV. 744 3.3.1. IPv4 DS Field 746 Most of the tunnel types that can be specified in the Tunnel 747 Encapsulation attribute require an outer IP encapsulation. The IPv4 748 Differentiated Services (DS) Field sub-TLV can be carried in the TLV 749 of any such tunnel type. It specifies the setting of the one-octet 750 Differentiated Services field in the outer IP encapsulation (see 751 [RFC2474]). The value field is always a single octet. 753 3.3.2. UDP Destination Port 755 Some of the tunnel types that can be specified in the Tunnel 756 Encapsulation attribute require an outer UDP encapsulation. 757 Generally there is a standard UDP Destination Port value for a 758 particular tunnel type. However, sometimes it is useful to be able 759 to use a non-standard UDP destination port. If a particular tunnel 760 type requires an outer UDP encapsulation, and it is desired to use a 761 UDP destination port other than the standard one, the port to be used 762 can be specified by including a UDP Destination Port sub-TLV. The 763 value field of this sub-TLV is always a two-octet field, containing 764 the port value. 766 3.4. Sub-TLVs for Aiding Tunnel Selection 768 3.4.1. Protocol Type Sub-TLV 770 The protocol type sub-TLV MAY be included in a given TLV to indicate 771 the type of the payload packets that may be encapsulated with the 772 tunnel parameters that are being signaled in the TLV. The value 773 field of the sub-TLV contains a 2-octet value from IANA's ethertype 774 registry [Ethertypes]. 776 For example, if we want to use three L2TPv3 sessions, one carrying 777 IPv4 packets, one carrying IPv6 packets, and one carrying MPLS 778 packets, the egress router will include three TLVs of L2TPv3 779 encapsulation type, each specifying a different Session ID and a 780 different payload type. The protocol type sub-TLV for these will be 781 IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and 782 MPLS (protocol type = 0x8847), respectively. This informs the 783 ingress routers of the appropriate encapsulation information to use 784 with each of the given protocol types. Insertion of the specified 785 Session ID at the ingress routers allows the egress to process the 786 incoming packets correctly, according to their protocol type. 788 3.4.2. Color Sub-TLV 790 The color sub-TLV MAY be encoded as a way to "color" the 791 corresponding tunnel TLV. The value field of the sub-TLV is eight 792 octets long, and consists of a Color Extended Community, as defined 793 in Section 4.3. For the use of this sub-TLV and Extended Community, 794 please see Section 7. 796 Note that the high-order octet of this sub-TLV's value field MUST be 797 set to 3, and the next octet MUST be set to 0x0b. (Otherwise the 798 value field is not identical to a Color Extended Community.) 799 If a Color sub-TLV is not of the proper length, or the first two 800 octets of its value field are not 0x030b, the sub-TLV should be 801 treated as if it were an unrecognized sub-TLV (see Section 11). 803 3.5. Embedded Label Handling Sub-TLV 805 Certain BGP address families (corresponding to particular AFI/SAFI 806 pairs, e.g., 1/4, 2/4, 1/128, 2/128) have MPLS labels embedded in 807 their NLRIs. We will use the term "embedded label" to refer to the 808 MPLS label that is embedded in an NLRI, and the term "labeled address 809 family" to refer to any AFI/SAFI that has embedded labels. 811 Some of the tunnel types (e.g., VXLAN, VXLAN-GPE, and NVGRE) that can 812 be specified in the Tunnel Encapsulation attribute have an 813 encapsulation header containing "Virtual Network" identifier of some 814 sort. The Encapsulation sub-TLVs for these tunnel types may 815 optionally specify a value for the virtual network identifier. 817 Suppose a Tunnel Encapsulation attribute is attached to an UPDATE of 818 an embedded address family, and it is decided to use a particular 819 tunnel (specified in one of the attribute's TLVs) for transmitting a 820 packet that is being forwarded according to that UPDATE. When 821 forming the encapsulation header for that packet, different 822 deployment scenarios require different handling of the embedded label 823 and/or the virtual network identifier. The Embedded Label Handling 824 sub-TLV can be used to control the placement of the embedded label 825 and/or the virtual network identifier in the encapsulation. 827 The Embedded Label Handling sub-TLV may be included in any TLV of the 828 Tunnel Encapsulation attribute. If the Tunnel Encapsulation 829 attribute is attached to an UPDATE of a non-labeled address family, 830 the sub-TLV is treated as a no-op. If the sub-TLV is contained in a 831 TLV whose tunnel type does not have a virtual network identifier in 832 its encapsulation header, the sub-TLV is treated as a no-op. In 833 those cases where the sub-TLV is treated as a no-op, it SHOULD NOT be 834 stripped from the TLV before the UPDATE is forwarded. 836 The sub-TLV's Length field always contains the value 1, and its value 837 field consists of a single octet. The following values are defined: 839 1: The payload will be an MPLS packet with the embedded label at the 840 top of its label stack. 842 2: The embedded label is not carried in the payload, but is carried 843 either in the virtual network identifier field of the 844 encapsulation header, or else is ignored entirely. 846 Please see Section 8 for the details of how this sub-TLV is used when 847 it is carried by an UPDATE of a labeled address family. 849 3.6. MPLS Label Stack Sub-TLV 851 This sub-TLV allows an MPLS label stack ([RFC3032]) to be associated 852 with a particular tunnel. 854 The value field of this sub-TLV is a sequence of MPLS label stack 855 entries. The first entry in the sequence is the "topmost" label, the 856 final entry in the sequence is the "bottommost" label. When this 857 label stack is pushed onto a packet, this ordering MUST be preserved. 859 Each label stack entry has the following format: 861 0 1 2 3 862 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 863 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 864 | Label | TC |S| TTL | 865 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 867 Figure 10: MPLS Label Stack Sub-TLV 869 If a packet is to be sent through the tunnel identified in a 870 particular TLV, and if that TLV contains an MPLS Label Stack sub-TLV, 871 then the label stack appearing in the sub-TLV MUST be pushed onto the 872 packet. This label stack MUST be pushed onto the packet before any 873 other labels are pushed onto the packet. 875 In particular, if the Tunnel Encapsulation attribute is attached to a 876 BGP UPDATE of a labeled address family, the contents of the MPLS 877 Label Stack sub-TLV MUST be pushed onto the packet before the label 878 embedded in the NLRI is pushed onto the packet. 880 If the MPLS label stack sub-TLV is included in a TLV identifying a 881 tunnel type that uses virtual network identifiers (see Section 8), 882 the contents of the MPLS label stack sub-TLV MUST be pushed onto the 883 packet before the procdures of Section 8 are applied. 885 The number of label stack entries in the sub-TLV MUST be determined 886 from the sub-TLV length field. Thus it is not necessary to set the S 887 bit in any of the label stack entries of the sub-TLV, and the setting 888 of the S bit is ignored when parsing the sub-TLV. When the label 889 stack entries are pushed onto a packet that already has a label 890 stack, the S bits of all the entries MUST be cleared. When the label 891 stack entries are pushed onto a packet that does not already have a 892 label stack, the S bit of the bottommost label stack entry MUST be 893 set, and the S bit of all the other label stack entries MUST be 894 cleared.. 896 By default, the TC (Traffic Class) field ([RFC3032], [RFC5462]) of 897 each label stack entry is set to 0. This may of course be changed by 898 policy at the originator of the sub-TLV. When pushing the label 899 stack onto a packet, the TC of the label stack entries is preserved 900 by default. However, local policy at the router that is pushing on 901 the stack MAY cause modification of the TC values. 903 By default, the TTL (Time to Live) field of each label stack entry is 904 set to 255. This may be changed by policy at the originator of the 905 sub-TLV. When pushing the label stack onto a packet, the TTL of the 906 label stack entries is preserved by default. However, local policy 907 at the router that is pushing on the stack MAY cause modification of 908 the TTL values. If any label stack entry in the sub-TLV has a TTL 909 value of zero, the router that is pushing the stack on a packet MUST 910 change the value to a non-zero value. 912 Note that this sub-TLV can be appear within a TLV identifying any 913 type of tunnel, not just within a TLV identifying an MPLS tunnel. 914 However, if this sub-TLV appears within a TLV identifying an MPLS 915 tunnel (or an MPLS-in-X tunnel), this sub-TLV plays the same role 916 that would be played by an MPLS Encapsulation sub-TLV. Therefore, an 917 MPLS Encapsulation sub-TLV is not defined. 919 3.7. Prefix-SID Sub-TLV 921 [Prefix-SID-Attribute] defines a BGP Path attribute known as the 922 "Prefix-SID Attribute". This attribute is defined to contain a 923 sequence of one or more TLVs, where each TLV is either a "Label- 924 Index" TLV, an "IPv6 SID (Segment Identifier)" TLV, or an "Originator 925 SRGB (Source Routing Global Block)" TLV. 927 In this document, we define a Prefix-SID sub-TLV. The value field of 928 the Prefix-SID sub-TLV can be set to any valid value of the value 929 field of a BGP Prefix-SID attribute, as defined in 930 [Prefix-SID-Attribute]. 932 The Prefix-SID sub-TLV can occur in a TLV identifying any type of 933 tunnel. If an Originator SRGB is specified in the sub-TLV, that SRGB 934 MUST be interpreted to be the SRGB used by the tunnel's Remote 935 Endpoint. The Label-Index, if present, is the Segment Routing SID 936 that the tunnel's Remote Endpoint uses to represent the prefix 937 appearing in the NLRI field of the BGP UPDATE to which the Tunnel 938 Encapsulation attribute is attached. 940 If a Label-Index is present in the prefix-SID sub-TLV, then when a 941 packet is sent through the tunnel identified by the TLV, the 942 corresponding MPLS label MUST be pushed on the packet's label stack. 943 The corresponding MPLS label is computed from the Label-Index value 944 and the SRGB of the route's originator. 946 If the Originator SRGB is not present,it is assumed that the 947 originator's SRGB is known by other means. Such "other means" are 948 outside the scope of this document. 950 The corresponding MPLS label is pushed on after the processing of the 951 MPLS Label Stack sub-TLV, if present, as specified in Section 3.6. 952 It is pushed on before any other labels (e.g., a label embedded in 953 UPDATE's NLRI, or a label determined by the procedures of Section 8 954 are pushed on the stack. 956 The Prefix-SID sub-TLV has slightly different semantics than the 957 Prefix-SID attribute. When the Prefix-SID attribute is attached to a 958 given route, the BGP speaker that originally attached the attribute 959 is expected to be in the same Segment Routing domain as the BGP 960 speakers who receive the route with the attached attribute. The 961 Label-Index tells the receiving BGP speakers that the prefix-SID is 962 for the advertised prefix in that Segment Routing domain. When the 963 Prefix-SID sub-TLV is used, the BGP speaker at the head end of the 964 tunnel need even not be in the same Segment Routing Domain as the 965 tunnel's Remote Endpoint, and there is no implication that the 966 prefix-SID for the advertised prefix is the same in the Segment 967 Routing domains of the BGP speaker that originated the sub-TLV and 968 the BGP speaker that received it. 970 4. Extended Communities Related to the Tunnel Encapsulation Attribute 972 4.1. Encapsulation Extended Community 974 The Encapsulation Extended Community is a Transitive Opaque Extended 975 Community. This Extended Community may be attached to a route of any 976 AFI/SAFI to which the Tunnel Encapsulation attribute may be attached. 977 Each such Extended Community identifies a particular tunnel type. If 978 the Encapsulation Extended Community identifies a particular tunnel 979 type, its semantics are exactly equivalent to the semantics of a 980 Tunnel Encapsulation attribute Tunnel TLV for which the following 981 three conditions all hold: 983 1. it identifies the same tunnel type, 985 2. it has a Remote Endpoint sub-TLV for which one of the following 986 two conditions holds: 988 a. its "Address Family" subfield contains zero, or 990 b. its "Address" subfield contains the same IP address that 991 appears in the next hop field of the route to which the 992 Tunnel Encapsulation attribute is attached 994 3. it has no other sub-TLVs. 996 We will refer to such a Tunnel TLV as a "barebones" Tunnel TLV. 998 The Encapsulation Extended Community was first defined in [RFC5512]. 999 While it provides only a small subset of the functionality of the 1000 Tunnel Encapsulation attribute, it is used in a number of deployed 1001 applications, and is still needed for backwards compatibility. To 1002 ensure backwards compatibility, this specification establishes the 1003 following rules: 1005 1. If the Tunnel Encapsulation attribute of a given route contains a 1006 barebones Tunnel TLV identifying a particular tunnel type, an 1007 Encapsulation Extended Community identifying the same tunnel type 1008 SHOULD be attached to the route. 1010 2. If the Encapsulation Extended Community identifying a particular 1011 tunnel type is attached to a given route, the corresponding 1012 barebones Tunnel TLV MAY be omitted from the Tunnel Encapsulation 1013 attribute. 1015 3. Suppose a particular route has both (a) an Encapsulation Extended 1016 Community specifying a particular tunnel type, and (b) a Tunnel 1017 Encapsulation attribute with a barebones Tunnel TLV specifying 1018 that same tunnel type. Both (a) and (b) MUST be interpreted as 1019 denoting the same tunnel. 1021 In short, in situations where one could use either the Encapsulation 1022 Extended Community or a barebones Tunnel TLV, one may use either or 1023 both. However, to ensure backwards compatibility with applications 1024 that do not support the Tunnel Encapsulation attribute, it is 1025 preferable to use the Encapsulation Extended Community. If the 1026 Extended Community (identifying a particular tunnel type) is present, 1027 the corresponding Tunnel TLV is optional. 1029 Note that for tunnel types of the form "X-in-Y", e.g., MPLS-in-GRE, 1030 the Encapsulation Extended Community implies that only packets of the 1031 specified payload type "X" are to be carried through the tunnel of 1032 type "Y". 1034 In the remainder of this specification, when we speak of a route as 1035 containing a Tunnel Encapsulation attribute with a TLV identifying a 1036 particular tunnel type, we are implicitly including the case where 1037 the route contains a Tunnel Encapsulation Extended Community 1038 identifying that tunnel type. 1040 4.2. Router's MAC Extended Community 1042 [EVPN-Inter-Subnet] defines a Router's MAC Extended Community. This 1043 Extended Community provides information that may conflict with 1044 information in one or more of the Encapsulation Sub-TLVs of a Tunnel 1045 Encapsulation attribute. In case of such a conflict, the information 1046 in the Encapsulation Sub-TLV takes precedence. 1048 4.3. Color Extended Community 1050 The Color Extended Community is a Transitive Opaque Extended 1051 Community with the following encoding: 1053 0 1 2 3 1054 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 1055 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1056 | 0x03 | 0x0b | Reserved | 1057 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1058 | Color Value | 1059 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1061 Figure 11: Color Extended Community 1063 For the use of this Extended Community please see Section 7. 1065 5. Semantics and Usage of the Tunnel Encapsulation attribute 1067 [RFC5512] specifies the use of the Tunnel Encapsulation attribute in 1068 BGP UPDATE messages of AFI/SAFI 1/7 and 2/7. That document restricts 1069 the use of this attribute to UPDATE messsages of those SAFIs. This 1070 document removes that restriction. 1072 The BGP Tunnel Encapsulation attribute MAY be carried in any BGP 1073 UPDATE message whose AFI/SAFI is 1/1 (IPv4 Unicast), 2/1 (IPv6 1074 Unicast), 1/4 (IPv4 Labeled Unicast), 2/4 (IPv6 Labeled Unicast), 1075 1/128 (VPN-IPv4 Labeled Unicast), 2/128 (VPN-IPv6 Labeled Unicast), 1076 or 25/70 (Ethernet VPN, usually known as EVPN)). Use of the Tunnel 1077 Encapsulation attribute in BGP UPDATE messages of other AFI/SAFIs is 1078 outside the scope of this document. 1080 It has been suggested that it may sometimes be useful to attach a 1081 Tunnel Encapsulation attribute to a BGP UPDATE message that is also 1082 carrying a PMSI (Provider Multicast Service Interface) Tunnel 1083 attribute [RFC6514]. If the PMSI Tunnel attribute specifies an IP 1084 tunnel, the Tunnel Encapsulation attribute could be used to provide 1085 additional information about the IP tunnel. The usage of the Tunnel 1086 Encapsulation attribute in combination with the PMSI Tunnel attribute 1087 is outside the scope of this document. 1089 The decision to attach a Tunnel Encapsulation attribute to a given 1090 BGP UPDATE is determined by policy. The set of TLVs and sub-TLVs 1091 contained in the attribute is also determined by policy. 1093 When the Tunnel Encapsulation attribute is carried in an UPDATE of 1094 one of the AFI/SAFIs specified in the previous paragraph, each TLV 1095 MUST have a Remote Endpoint sub-TLV. If a TLV that does not have a 1096 Remote Endpoint sub-TLV, that TLV should be treated as if it had a 1097 malformed Remote Endpoint sub-TLV (see Section 3.1). 1099 Suppose that: 1101 o a given packet P must be forwarded by router R; 1103 o the path along which P is to be forwarded is determined by BGP 1104 UPDATE U; 1106 o UPDATE U has a Tunnel Encapsulation attribute, containing at least 1107 one TLV that identifies a "feasible tunnel" for packet P. A 1108 tunnel is considered feasible if it has the following three 1109 properties: 1111 * The tunnel type is supported (i.e., router R knows how to set 1112 up tunnels of that type, how to create the encapsulation header 1113 for tunnels of that type, etc.) 1115 * The tunnel is of a type that can be used to carry packet P 1116 (e.g., an MPLS-in-UDP tunnel would not be a feasible tunnel for 1117 carrying an IP packet, UNLESS the IP packet can first be 1118 converted to an MPLS packet). 1120 * The tunnel is specified in a TLV whose Remote Endpoint sub-TLV 1121 identifies an IP address that is reachable. 1123 Then router R SHOULD send packet P through one of the feasible 1124 tunnels identified in the Tunnel Encapsulation attribute of UPDATE U. 1126 If the Tunnel Encapsulation attribute contains several TLVs (i.e., if 1127 it specifies several tunnels), router R may choose any one of those 1128 tunnels, based upon local policy. If any of tunnels' TLVs contain 1129 the Color sub-TLV(Section 3.4.2) and/or the Protocol Type sub-TLV 1130 (Section 3.4.1, the choice of tunnel may be influenced by these sub- 1131 TLVs. 1133 Note that if none of the TLVs specifies the MPLS tunnel type, a Label 1134 Switched Path SHOULD NOT be used unless none of the TLVs specifies a 1135 feasible tunnel. 1137 If a particular tunnel is not feasible at some moment because its 1138 Remote Endpoint cannot be reached at that moment, the tunnel may 1139 become feasible at a later time (when its endpoint becomes 1140 reachable). Router R SHOULD take note of this. If router R is 1141 already using a different tunnel, it MAY switch to the tunnel that 1142 just became feasible, or it MAY decide to continue using the tunnel 1143 that it is already using. How this decision is made is outside the 1144 scope of this document. 1146 A TLV specifying a non-feasible tunnel is not considered to be 1147 malformed or erroneous in any way, and the TLV SHOULD NOT be stripped 1148 from the Tunnel Encapsulation attribute before redistribution. 1150 In addition to the sub-TLVs already defined, additional sub-TLVs may 1151 be defined that affect the choice of tunnel to be used, or that 1152 affect the contents of the tunnel encapsulation header. The 1153 documents that define any such additional sub-TLVs must specify the 1154 effect that including the sub-TLV is to have. 1156 Once it is determined to send a packet through the tunnel specified 1157 in a particular TLV of a particular Tunnel Encapsulation attribute, 1158 then the tunnel's remote endpoint address is the IP address contained 1159 in the sub-TLV. If the TLV contains a Remote Endpoint sub-TLV whose 1160 value field is all zeroes, then the tunnel's remote endpoint is the 1161 IP address specified as the Next Hop of the BGP Update containing the 1162 Tunnel Encapsulation attribute. The address of the remote endpoint 1163 generally appears in a "destination address" field of the 1164 encapsulation. 1166 The full set of procedures for sending a packet through a particular 1167 tunnel type to a particular remote endpoint depends upon the tunnel 1168 type, and is outside the scope of this document. Note that some 1169 tunnel types may require the execution of an explicit tunnel setup 1170 protocol before they can be used for carrying data. Other tunnel 1171 types may not require any tunnel setup protocol. 1173 Sending a packet through a tunnel always requires that the packet be 1174 encapsulated, with an encapsulation header that is appropriate for 1175 the tunnel type. The contents of the tunnel encapsulation header MAY 1176 be influenced by the Encapsulation sub-TLV. If there is no 1177 Encapsulation sub-TLV present, the router transmitting the packet 1178 through the tunnel must have a priori knowledge (e.g., by 1179 provisioning) of how to fill in the various fields in the 1180 encapsulation header. 1182 Whenever a new Tunnel Type TLV is defined, the specification of that 1183 TLV should describe (or reference) the procedures for creating the 1184 encapsulation header used to forward packets through that tunnel 1185 type. If a tunnel type codepoint is assigned in the IANA "BGP Tunnel 1186 Encapsulation Tunnel Types" registry, but there is no corresponding 1187 specification that defines an Encapsulation sub-TLV for that tunnel 1188 type, the transmitting endpoint of such a tunnel is presumed to know 1189 a priori how to form the encapsulation header for that tunnel type. 1191 If a Tunnel Encapsulation attribute specifies several tunnels, the 1192 way in which a router chooses which one to use is a matter of policy, 1193 subject to the following constraint: if a router can determine that a 1194 given tunnel is not functional, it MUST NOT use that tunnel. In 1195 particular, if the tunnel is identified in a TLV that has a Remote 1196 Endpoint sub-TLV, and if the IP address specified in the sub-TLV is 1197 not reachable from router R, then the tunnel SHOULD be considered 1198 non-functional. Other means of determining whether a given tunnel is 1199 functional MAY be used; specification of such means is outside the 1200 scope of this specification. Of course, if a non-functional tunnel 1201 later becomes functional, router R SHOULD reevaluate its choice of 1202 tunnels. 1204 If router R determines that it cannot use any of the tunnels 1205 specified in the Tunnel Encapsulation attribute, it MAY either drop 1206 packet P, or it MAY transmit packet P as it would had the Tunnel 1207 Encapsulation attribute not been present. This is a matter of local 1208 policy. By default, the packet SHOULD be transmitted as if the 1209 Tunnel Encapsulation attribute had not been present. 1211 A Tunnel Encapsulation attribute may contain several TLVs that all 1212 specify the same tunnel type. Each TLV should be considered as 1213 specifying a different tunnel. Two tunnels of the same type may have 1214 different Remote Endpoint sub-TLVs, different Encapsulation sub-TLVs, 1215 etc. Choosing between two such tunnels is a matter of local policy. 1217 Once router R has decided to send packet P through a particular 1218 tunnel, it encapsulates packet P appropriately and then forwards it 1219 according to the route that leads to the tunnel's remote endpoint. 1220 This route may itself be a BGP route with a Tunnel Encapsulation 1221 attribute. If so, the encapsulated packet is treated as the payload 1222 and is encapsulated according to the Tunnel Encapsulation attribute 1223 of that route. That is, tunnels may be "stacked". 1225 Notwithstanding anything said in this document, a BGP speaker MAY 1226 have local policy that influences the choice of tunnel, and the way 1227 the encapsulation is formed. A BGP speaker MAY also have a local 1228 policy that tells it to ignore the Tunnel Encapsulation attribute 1229 entirely or in part. Of course, interoperability issues must be 1230 considered when such policies are put into place. 1232 6. Routing Considerations 1234 6.1. No Impact on BGP Decision Process 1236 The presence of the Tunnel Encapsulation attribute does not affect 1237 the BGP bestpath selection algorithm. 1239 Under certain circumstances, this may lead to counter-intuitive 1240 consequences. For example, suppose: 1242 o router R1 receives a BGP UPDATE message from router R2, such that 1244 * the NLRI of that UPDATE is prefix X, 1246 * the UPDATE contains a Tunnel Encapsulation attribute specifying 1247 two tunnels, T1 and T2, 1249 * R1 cannot use tunnel T1 or tunnel T2, either because the tunnel 1250 remote endpoint is not reachable or because R1 does not support 1251 that kind of tunnel 1253 o router R1 receives a BGP UPDATE message from router R3, such that 1255 * the NLRI of that UPDATE is prefix X, 1257 * the UPDATE contains a Tunnel Encapsulation attribute specifying 1258 two tunnels, T3 and T4, 1260 * R1 can use at least one of the two tunnels 1262 Since the Tunnel Encapsulation attribute does not affect bestpath 1263 selection, R1 may well install the route from R2 rather than the 1264 route from R3, even though R2's route contains no usable tunnels. 1266 This possibility must be kept in mind whenever a Remote Endpoint sub- 1267 TLV carried by a given UPDATE specifies an IP address that is 1268 different than the next hop of that UPDATE. 1270 6.2. Looping, Infinite Stacking, Etc. 1272 Consider a packet destined for address X. Suppose a BGP UPDATE for 1273 address prefix X carries a Tunnel Encapsulation attribute that 1274 specifies a remote tunnel endpoint of Y. And suppose that a BGP 1275 UPDATE for address prefix Y carries a Tunnel Encapsulation attribute 1276 that specifies a Remote Endpoint of X. It is easy to see that this 1277 will cause an infinite number of encapsulation headers to be put on 1278 the given packet. 1280 This could happen as a result of misconfiguration, either accidental 1281 or intentional. It could also happen if the Tunnel Encapsulation 1282 attribute were altered by a malicious agent. Implementations should 1283 be aware of this. This document does not specify a maximum number of 1284 recursions; that is an implementation-specific matter. 1286 Improper setting (or malicious altering) of the Tunnel Encapsulation 1287 attribute could also cause data packets to loop. Suppose a BGP 1288 UPDATE for address prefix X carries a Tunnel Encapsulation attribute 1289 that specifies a remote tunnel endpoint of Y. Suppose router R 1290 receives and processes the update. When router R receives a packet 1291 destined for X, it will apply the encapsulation and send the 1292 encapsulated packet to Y. Y will decapsulate the packet and forward 1293 it further. If Y is further away from X than is router R, it is 1294 possible that the path from Y to X will traverse R. This would cause 1295 a long-lasting routing loop. The control plane itself cannot detect 1296 this situation, though a TTL field in the payload packets would 1297 presumably prevent any given packet from looping infinitely. 1299 These possibilities must also be kept in mind whenever the Remote 1300 Endpoint for a given prefix differs from the BGP next hop for that 1301 prefix. 1303 7. Recursive Next Hop Resolution 1305 Suppose that: 1307 o a given packet P must be forwarded by router R1; 1309 o the path along which P is to be forwarded is determined by BGP 1310 UPDATE U1; 1312 o UPDATE U1 does not have a Tunnel Encapsulation attribute; 1314 o the next hop of UPDATE U1 is router R2; 1316 o the best path to router R2 is a BGP route that was advertised in 1317 UPDATE U2; 1319 o UPDATE U2 has a Tunnel Encapsulation attribute. 1321 Then packet P SHOULD be sent through one of the tunnels identified in 1322 the Tunnel Encapsulation attribute of UPDATE U2. See Section 5 for 1323 further details. 1325 However, suppose that one of the TLVs in U2's Tunnel Encapsulation 1326 attribute contains the Color Sub-TLV. In that case, packet P SHOULD 1327 NOT be sent through the tunnel identified in that TLV, unless U1 is 1328 carrying the Color Extended Community that is identified in U2's 1329 Color Sub-TLV. 1331 Note that if UPDATE U1 and UPDATE U2 both have Tunnel Encapsulation 1332 attributes, packet P will be carried through a pair of nested 1333 tunnels. P will first be encapsulated based on the Tunnel 1334 Encapsulation attribute of U1. This encapsulated packet then becomes 1335 the payload, and is encapsulated based on the Tunnel Encapsulation 1336 attribute of U2. This is another way of "stacking" tunnels (see also 1337 Section 5. 1339 The procedures in this section presuppose that U1's next hop resolves 1340 to a BGP route, and that U2's next hop resolves (perhaps after 1341 further recursion) to a non-BGP route. 1343 8. Use of Virtual Network Identifiers and Embedded Labels when Imposing 1344 a Tunnel Encapsulation 1346 If the TLV specifying a tunnel contains an MPLS Label Stack sub-TLV, 1347 then when sending a packet through that tunnel, the procedures of 1348 Section 3.6 are applied before the procedures of this section. 1350 If the TLV specifying a tunnel contains a Prefix-SID sub-TLV, the 1351 procedures of Section 3.7 are applied before the procedures of this 1352 section. If the TLV also contains an MPLS Label Stack sub-TLV, the 1353 procedures of Section 3.6 are applied before the procedures of 1354 Section 3.7. 1356 8.1. Tunnel Types without a Virtual Network Identifier Field 1358 If a Tunnel Encapsulation attribute is attached to an UPDATE of a 1359 labeled address family, there will be one or more labels specified in 1360 the UPDATE's NLRI. When a packet is sent through a tunnel specified 1361 in one of the attribute's TLVs, and that tunnel type does not contain 1362 a virtual network identifier field, the label or labels from the NLRI 1363 are pushed on the packet's label stack. The resulting MPLS packet is 1364 then further encapsulated, as specified by the TLV. 1366 8.2. Tunnel Types with a Virtual Network Identifier Field 1368 Three of the tunnel types that can be specified in a Tunnel 1369 Encapsulation TLV have virtual network identifier fields in their 1370 encapsulation headers. In the VXLAN and VXLAN-GPE encapsulations, 1371 this field is called the VNI (Virtual Network Identifier) field; in 1372 the NVGRE encapsulation, this field is called the VSID (Virtual 1373 Subnet Identifier) field. 1375 When one of these tunnel encapsulations is imposed on a packet, the 1376 setting of the virtual network identifier field in the encapsulation 1377 header depends upon the contents of the Encapsulation sub-TLV (if one 1378 is present). When the Tunnel Encapsulation attribute is being 1379 carried on a BGP UPDATE of a labeled address family, the setting of 1380 the virtual network identifier field also depends upon the contents 1381 of the Embedded Label Handling sub-TLV (if present). 1383 This section specifies the procedures for choosing the value to set 1384 in the virtual network identifier field of the encapsulation header. 1385 These procedures apply only when the tunnel type is VXLAN, VXLAN-GPE, 1386 or NVGRE. 1388 8.2.1. Unlabeled Address Families 1390 This sub-section applies when: 1392 o the Tunnel Encapsulation attribute is carried on a BGP UPDATE of 1393 an unlabeled address family, and 1395 o at least one of the attribute's TLVs identifies a tunnel type that 1396 uses a virtual network identifier, and 1398 o it has been determined to send a packet through one of those 1399 tunnels. 1401 If the TLV identifying the tunnel contains an Encapsulation sub-TLV 1402 whose V bit is set, the virtual network identifier field of the 1403 encapsulation header is set to the value of the virtual network 1404 identifier field of the Encapsulation sub-TLV. 1406 Otherwise, the virtual network identifier field of the encapsulation 1407 header is set to a configured value; if there is no configured value, 1408 the tunnel cannot be used. 1410 8.2.2. Labeled Address Families 1412 This sub-section applies when: 1414 o the Tunnel Encapsulation attribute is carried on a BGP UPDATE of a 1415 labeled address family, and 1417 o at least one of the attribute's TLVs identifies a tunnel type that 1418 uses a virtual network identifier, and 1420 o it has been determined to send a packet through one of those 1421 tunnels. 1423 8.2.2.1. When a Valid VNI has been Signaled 1425 If the TLV identifying the tunnel contains an Encapsulation sub-TLV 1426 whose V bit is set, the virtual network identifier field of the 1427 encapsulation header is set as follows: 1429 o If the TLV contains an Embedded Label Handling sub-TLV whose value 1430 is 1, then the virtual network identifier field of the 1431 encapsulation header is set to the value of the virtual network 1432 identifier field of the Encapsulation sub-TLV. 1434 The embedded label (from the NLRI of the route that is carrying 1435 the Tunnel Encapsulation attribute) appears at the top of the MPLS 1436 label stack in the encapsulation payload. 1438 o If the TLV does not contain an Embedded Label Handling sub-TLV, or 1439 if contains an Embedded Label Handling sub-TLV whose value is 2, 1440 the embedded label is ignored entirely, and the virtual network 1441 identifier field of the encapsulation header is set to the value 1442 of the virtual network identifier field of the Encapsulation sub- 1443 TLV. 1445 8.2.2.2. When a Valid VNI has not been Signaled 1447 If the TLV identifying the tunnel does not contain an Encapsulation 1448 sub-TLV whose V bit is set, the virtual network identifier field of 1449 the encapsulation header is set as follows: 1451 o If the TLV contains an Embedded Label Handling sub-TLV whose value 1452 is 1, then the virtual network identifier field of the 1453 encapsulation header is set to a configured value. 1455 If there is no configured value, the tunnel cannot be used. 1457 The embedded label (from the NLRI of the route that is carrying 1458 the Tunnel Encapsulation attribute) appears at the top of the MPLS 1459 label stack in the encapsulation payload. 1461 o If the TLV does not contain an Embedded Label Handling sub-TLV, or 1462 if it contains an Embedded Label Handling sub-TLV whose value is 1463 2, the embedded label is copied into the virtual network 1464 identifier field of the encapsulation header. 1466 In this case, the payload may or may not contain an MPLS label 1467 stack, depending upon other factors. If the payload does contain 1468 an MPLS lable stack, the embedded label does not appear in that 1469 stack. 1471 9. Applicability Restrictions 1473 In a given UPDATE of a labeled address family, the label embedded in 1474 the NLRI is generally a label that is meaningful only to the router 1475 whose address appears as the next hop. Certain of the procedures of 1476 Section 8.2.2.1 or Section 8.2.2.2 cause the embedded label to be 1477 carried by a data packet to the router whose address appears in the 1478 Remote Endpoint sub-TLV. If the Remote Endpoint sub-TLV does not 1479 identify the same router that is the next hop, sending the packet 1480 through the tunnel may cause the label to be misinterpreted at the 1481 tunnel's remote endpoint. This may cause misdelivery of the packet. 1483 Therefore the embedded label MUST NOT be carried by a data packet 1484 traveling through a tunnel unless it is known that the label will be 1485 properly interpreted at the tunnel's remote endpoint. How this is 1486 known is outside the scope of this document. 1488 Note that if the Tunnel Encapsulation attribute is attached to a VPN- 1489 IP route [RFC4364], and if Inter-AS "option b" (see section 10 of 1490 [RFC4364] is being used, and if the Remote Endpoint sub-TLV contains 1491 an IP address that is not in same AS as the router receiving the 1492 route, it is very likely that the embedded label has been changed. 1493 Therefore use of the Tunnel Encapsulation attribute in an "Inter-AS 1494 option b" scenario is not supported. 1496 10. Scoping 1498 The Tunnel Encapsulation attribute is defined as a transitive 1499 attribute, so that it may be passed along by BGP speakers that do not 1500 recognize it. However, it is intended that the Tunnel Encapsulation 1501 attribute be used only within a well-defined scope, e.g., within a 1502 set of Autonomous Systems that belong to a single administrative 1503 entity. If the attribute is distributed beyond its intended scope, 1504 packets may be sent through tunnels in a manner that is not intended. 1506 To prevent the Tunnel Encapsulation attribute from being distributed 1507 beyond its intended scope, any BGP speaker that understands the 1508 attribute MUST be able to filter the attribute from incoming BGP 1509 UPDATE messages. When the attribute is filtered from an incoming 1510 UPDATE, the attribute is neither processed nor redistributed. This 1511 filtering SHOULD be possible on a per-BGP-session basis. For each 1512 session, filtering of the attribute on incoming UPDATEs MUST be 1513 enabled by default. 1515 In addition, any BGP speaker that understands the attribute MUST be 1516 able to filter the attribute from outgoing BGP UPDATE messages. This 1517 filtering SHOULD be possible on a per-BGP-session basis. For each 1518 session, filtering of the attribute on outgoing UPDATEs MUST be 1519 enabled by default. 1521 11. Error Handling 1523 The Tunnel Encapsulation attribute is a sequence of TLVs, each of 1524 which is a sequence of sub-TLVs. The final octet of a TLV is 1525 determined by its length field. Similarly, the final octet of a sub- 1526 TLV is determined by its length field. The final octet of a TLV MUST 1527 also be the final octet of its final sub-TLV. If this is not the 1528 case, the TLV MUST be considered to be malformed. A TLV that is 1529 found to be malformed for this reason MUST NOT be processed, and MUST 1530 be stripped from the Tunnel Encapsulation attribute before the 1531 attribute is propagated. Subsequent TLVs in the Tunnel Encapsulation 1532 attribute may still be valid, in which case they MUST be processed 1533 and redistributed normally. 1535 If a Tunnel Encapsulation attribute does not have any valid TLVs, or 1536 it does not have the transitive bit set, the "Attribute Discard" 1537 procedure of [RFC7606] is applied. 1539 If a Tunnel Encapsulation attribute can be parsed correctly, but 1540 contains a TLV whose tunnel type is not recognized by a particular 1541 BGP speaker, that BGP speaker MUST NOT consider the attribute to be 1542 malformed. Rather, the TLV with the unrecognized tunnel type MUST be 1543 ignored, and the BGP speaker MUST interpret the attribute as if that 1544 TLV had not been present. If the route carrying the Tunnel 1545 Encapsulation attribute is propagated with the attribute, the 1546 unrecognized TLV SHOULD remain in the attribute. 1548 If a TLV of a Tunnel Encapsulation attribute contains a sub-TLV that 1549 is not recognized by a particular BGP speaker, the BGP speaker SHOULD 1550 process that TLV as if the unrecognized sub-TLV had not been present. 1551 If the route carrying the Tunnel Encapsulation attribute is 1552 propagated with the attribute, the unrecognized TLV SHOULD remain in 1553 the attribute. 1555 If the type code of a sub-TLV appears as "reserved" in the IANA "BGP 1556 Tunnel Encapsulation Attribute Sub-TLVs" registry, the sub-TLV MUST 1557 be treated as an unrecognized sub-TLV. 1559 In general, if a TLV contains a sub-TLV that is malformed (e.g., 1560 contains a length field whose value is not legal for that sub-TLV), 1561 the sub-TLV should be treated as if it were an unrecognized sub-TLV. 1562 This document specifies one exception to this rule -- within a tunnel 1563 encapsulation attribute that is carried by a BGP UPDATE whose AFI/ 1564 SAFI is one of those explicitly listed in the second paragraph of 1565 Section 5, if a TLV contains a malformed Remote Endpoint sub-TLV (as 1566 defined in Section 3.1, the entire TLV MUST be ignored, and SHOULD be 1567 removed from the Tunnel Encapsulation attribute before the route 1568 carrying that attribute is redistributed. 1570 Within a tunnel encapsulation attribute that is carried by a BGP 1571 UPDATE whose AFI/SAFI is one of those explicitly listed in the second 1572 paragraph of Section 5, a TLV that does not contain exactly one 1573 Remote Endpoint sub-TLV MUST be treated as if it contained a 1574 malformed Remote Endpoint sub-TLV. 1576 A TLV identifying a particular tunnel type may contain a sub-TLV that 1577 is meaningless for that tunnel type. For example, perhaps the TLV 1578 contains a "UDP Destination Port" sub-TLV, but the identified tunnel 1579 type does not use UDP encapsulation at all. Sub-TLVs of this sort 1580 SHOULD be treated as no-ops. That is, they SHOULD NOT affect the 1581 creation of the encapsulation header. However, the sub-TLV MUST NOT 1582 be considered to be malformed, and MUST NOT be removed from the TLV 1583 before the route carrying the Tunnel Encapsulation attribute is 1584 redistributed. (This allows for the possibility that such sub-TLVs 1585 may be given a meaning, in the context of the specified tunnel type, 1586 in the future.) 1588 There is no significance to the order in which the TLVs occur within 1589 the Tunnel Encapsulation attribute. Multiple TLVs may occur for a 1590 given tunnel type; each such TLV is regarded as describing a 1591 different tunnel. 1593 The following sub-TLVs defined in this document SHOULD NOT occur more 1594 than once in a given Tunnel TLV: Remote Endpoint (discussed above), 1595 Encapsulation, IPv4 DS, UDP Destination Port, Embedded Label 1596 Handling, MPLS Label Stack, Prefix-SID. If a Tunnel TLV has more 1597 than one of any of these sub-TLVs, all but the first occurrence of 1598 each such sub-TLV type MUST be treated as a no-op. However, the 1599 Tunnel TLV containing them MUST NOT be considered to be malformed, 1600 and all the sub-TLVs SHOULD be propagated if the route carrying the 1601 Tunnel Encapsulation attribute is propagated. 1603 The following sub-TLVs defined in this document may appear zero or 1604 more times in a given Tunnel TLV: Protocol Type, Color. Each 1605 occurrence of such sub-TLVs is meaningful. For example, the Color 1606 sub-TLV may appear multiple times to assign multiple colors to a 1607 tunnel. 1609 12. IANA Considerations 1611 12.1. Subsequent Address Family Identifiers 1613 IANA is requested to modify the "Subsequent Address Family 1614 Identifiers" registry to indicate that the Encapsulation SAFI is 1615 deprecated. This document should be the reference. 1617 12.2. BGP Path Attributes 1619 IANA has previously assigned value 23 from the "BGP Path Attributes" 1620 Registry to "Tunnel Encapsulation Attribute". IANA is requested to 1621 add this document as a reference. 1623 12.3. Extended Communities 1625 IANA has previously assigned values from the "Transitive Opaque 1626 Extended Community" type Registry to the "Color Extended Community" 1627 (sub-type 0x0b), and to the "Encapsulation Extended 1628 Community"(0x030c). IANA is requested to add this document as a 1629 reference for both assignments. 1631 12.4. BGP Tunnel Encapsulation Attribute Sub-TLVs 1633 IANA is requested to add the following note to the "BGP Tunnel 1634 Encapsulation Attribute Sub-TLVs" registry: 1636 If the Sub-TLV Type is in the range from 0 to 127 inclusive, the 1637 Sub-TLV Length field contains one octet. If the Sub-TLV Type is 1638 in the range from 128-255 inclusive, the Sub-TLV Length field 1639 contains two octets. 1641 IANA is requested to change the registration policy of the "BGP 1642 Tunnel Encapsulation Attribute Sub-TLVs" registry to the following: 1644 o The values 0 and 255 are reserved. 1646 o The values in the range 1-63 and 128-191 are to be allocated using 1647 the "Standards Action" registration procedure. 1649 o The values in the range 64-125 and 192-252 are to be allocated 1650 using the "First Come, First Served" registration procedure. 1652 o The values in the range 126-127 and 253-254 are reserved for 1653 experimental use; IANA shall not allocate values from this range. 1655 IANA has assigned the following codepoints in the "BGP Tunnel 1656 Encapsulation Attribute Sub-TLVs registry: 1658 6: Remote Endpoint 1660 7: IPv4 DS Field 1662 8: UDP Destination Port 1664 9: Embedded Label Handling 1666 10: MPLS Label Stack 1668 11: Prefix SID 1670 IANA has previously assigned codepoints from the "BGP Tunnel 1671 Encapsulation Attribute Sub-TLVs" registry for "Encapsulation", 1672 "Protocol Type", and "Color". IANA is requested to add this document 1673 as a reference. 1675 12.5. Tunnel Types 1677 IANA is requested to add this document as a reference for tunnel 1678 types 8 (VXLAN), 9 (NVGRE), 11 (MPLS-in-GRE), and 12 (VXLAN-GPE) in 1679 the "BGP Tunnel Encapsulation Tunnel Types" registry. 1681 IANA is requested to add this document as a reference for tunnel 1682 types 1 (L2TPv3), 2 (GRE), and 7 (IP in IP) in the "BGP Tunnel 1683 Encapsulation Tunnel Types" registry. 1685 13. Security Considerations 1687 The Tunnel Encapsulation attribute can cause traffic to be diverted 1688 from its normal path, especially when the Remote Endpoint sub-TLV is 1689 used. This can have serious consequences if the attribute is added 1690 or modified illegitimately, as it enables traffic to be "hijacked". 1692 The Remote Endpoint sub-TLV contains both an IP address and an AS 1693 number. BGP Origin Validation [RFC6811] can be used to obtain 1694 assurance that the given IP address belongs to the given AS. While 1695 this provides some protection against misconfiguration, it does not 1696 prevent a malicious agent from inserting a sub-TLV that will appear 1697 valid. 1699 Before sending a packet through the tunnel identified in a particular 1700 TLV of a Tunnel Encapsulation attribute, it may be advisable to use 1701 BGP Origin Validation to obtain the following additional assurances: 1703 o the origin AS of the route carrying the Tunnel Encapsulation 1704 attribute is correct; 1706 o the origin AS of the route to the IP address specified in the 1707 Remote Endpoint sub-TLV is correct, and is the same AS that is 1708 specified in the Remote Endpoint sub-TLV. 1710 One then has some level of assurance that the tunneled traffic is 1711 going to the same destination AS that it would have gone to had the 1712 Tunnel Encapsulation attribute not been present. However, this may 1713 not suit all use cases, and in any event is not very strong 1714 protection against hijacking. 1716 For these reasons, BGP Origin Validation should not be relied upon 1717 exclusively, and the filtering procedures of Section 10 should always 1718 be in place. 1720 Increased protection can be obtained by using BGPSEC [RFC8205] to 1721 ensure that the route carrying the Tunnel Encapsulation attribute, 1722 and the routes to the Remote Endpoint of each specified tunnel, have 1723 not been altered illegitimately. 1725 If BGP Origin Validation is used as specified above, and the tunnel 1726 specified in a particular TLV of a Tunnel Encapsulation attribute is 1727 therefore regarded as "suspicious", that tunnel should not be used. 1728 Other tunnels specified in (other TLVs of) the Tunnel Encapsulation 1729 attribute may still be used. 1731 14. Acknowledgments 1733 This document contains text from RFC5512, co-authored by Pradosh 1734 Mohapatra. The authors of the current document wish to thank Pradosh 1735 for his contribution. RFC5512 itself built upon prior work by Gargi 1736 Nalawade, Ruchi Kapoor, Dan Tappan, David Ward, Scott Wainner, Simon 1737 Barber, and Chris Metz, whom we also thank for their contributions. 1739 The authors wish to thank Lou Berger, Ron Bonica, Martin Djernaes, 1740 John Drake, Satoru Matsushima, Dhananjaya Rao, John Scudder, Ravi 1741 Singh, Thomas Morin, Xiaohu Xu, and Zhaohui Zhang for their review, 1742 comments, and/or helpful discussions. 1744 15. Contributor Addresses 1746 Below is a list of other contributing authors in alphabetical order: 1748 Randy Bush 1749 Internet Initiative Japan 1750 5147 Crystal Springs 1751 Bainbridge Island, Washington 98110 1752 United States 1754 Email: randy@psg.com 1756 Robert Raszuk 1757 Bloomberg LP 1758 731 Lexington Ave 1759 New York City, NY 10022 1760 United States 1762 Email: robert@raszuk.net 1764 16. References 1766 16.1. Normative References 1768 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1769 Requirement Levels", BCP 14, RFC 2119, 1770 DOI 10.17487/RFC2119, March 1997, 1771 . 1773 [RFC5512] Mohapatra, P. and E. Rosen, "The BGP Encapsulation 1774 Subsequent Address Family Identifier (SAFI) and the BGP 1775 Tunnel Encapsulation Attribute", RFC 5512, 1776 DOI 10.17487/RFC5512, April 2009, 1777 . 1779 [RFC7606] Chen, E., Ed., Scudder, J., Ed., Mohapatra, P., and K. 1780 Patel, "Revised Error Handling for BGP UPDATE Messages", 1781 RFC 7606, DOI 10.17487/RFC7606, August 2015, 1782 . 1784 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1785 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1786 May 2017, . 1788 16.2. Informative References 1790 [Ethertypes] 1791 "IANA Ethertype Registry", 1792 . 1795 [EVPN-Inter-Subnet] 1796 Sajassi, A., Salem, S., Thoria, S., Drake, J., Rabadan, 1797 J., and L. Yong, "Integrated Routing and Bridging in 1798 EVPN", internet-draft draft-ietf-bess-evpn-inter-subnet- 1799 forwarding-03, February 2017. 1801 [Prefix-SID-Attribute] 1802 Previdi, S., Filsfils, C., Lindem, A., Patel, K., 1803 Sreekantiah, A., and H. Gredler, "Segment Routing Prefix 1804 SID extensions for BGP", internet-draft draft-ietf-idr- 1805 bgp-prefix-sid-17, February 2018. 1807 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 1808 "Definition of the Differentiated Services Field (DS 1809 Field) in the IPv4 and IPv6 Headers", RFC 2474, 1810 DOI 10.17487/RFC2474, December 1998, 1811 . 1813 [RFC2784] Farinacci, D., Li, T., Hanks, S., Meyer, D., and P. 1814 Traina, "Generic Routing Encapsulation (GRE)", RFC 2784, 1815 DOI 10.17487/RFC2784, March 2000, 1816 . 1818 [RFC2890] Dommety, G., "Key and Sequence Number Extensions to GRE", 1819 RFC 2890, DOI 10.17487/RFC2890, September 2000, 1820 . 1822 [RFC3032] Rosen, E., Tappan, D., Fedorkow, G., Rekhter, Y., 1823 Farinacci, D., Li, T., and A. Conta, "MPLS Label Stack 1824 Encoding", RFC 3032, DOI 10.17487/RFC3032, January 2001, 1825 . 1827 [RFC3931] Lau, J., Ed., Townsley, M., Ed., and I. Goyret, Ed., 1828 "Layer Two Tunneling Protocol - Version 3 (L2TPv3)", 1829 RFC 3931, DOI 10.17487/RFC3931, March 2005, 1830 . 1832 [RFC4023] Worster, T., Rekhter, Y., and E. Rosen, Ed., 1833 "Encapsulating MPLS in IP or Generic Routing Encapsulation 1834 (GRE)", RFC 4023, DOI 10.17487/RFC4023, March 2005, 1835 . 1837 [RFC4364] Rosen, E. and Y. Rekhter, "BGP/MPLS IP Virtual Private 1838 Networks (VPNs)", RFC 4364, DOI 10.17487/RFC4364, February 1839 2006, . 1841 [RFC5462] Andersson, L. and R. Asati, "Multiprotocol Label Switching 1842 (MPLS) Label Stack Entry: "EXP" Field Renamed to "Traffic 1843 Class" Field", RFC 5462, DOI 10.17487/RFC5462, February 1844 2009, . 1846 [RFC5566] Berger, L., White, R., and E. Rosen, "BGP IPsec Tunnel 1847 Encapsulation Attribute", RFC 5566, DOI 10.17487/RFC5566, 1848 June 2009, . 1850 [RFC6514] Aggarwal, R., Rosen, E., Morin, T., and Y. Rekhter, "BGP 1851 Encodings and Procedures for Multicast in MPLS/BGP IP 1852 VPNs", RFC 6514, DOI 10.17487/RFC6514, February 2012, 1853 . 1855 [RFC6811] Mohapatra, P., Scudder, J., Ward, D., Bush, R., and R. 1856 Austein, "BGP Prefix Origin Validation", RFC 6811, 1857 DOI 10.17487/RFC6811, January 2013, 1858 . 1860 [RFC7348] Mahalingam, M., Dutt, D., Duda, K., Agarwal, P., Kreeger, 1861 L., Sridhar, T., Bursell, M., and C. Wright, "Virtual 1862 eXtensible Local Area Network (VXLAN): A Framework for 1863 Overlaying Virtualized Layer 2 Networks over Layer 3 1864 Networks", RFC 7348, DOI 10.17487/RFC7348, August 2014, 1865 . 1867 [RFC7510] Xu, X., Sheth, N., Yong, L., Callon, R., and D. Black, 1868 "Encapsulating MPLS in UDP", RFC 7510, 1869 DOI 10.17487/RFC7510, April 2015, 1870 . 1872 [RFC7637] Garg, P., Ed. and Y. Wang, Ed., "NVGRE: Network 1873 Virtualization Using Generic Routing Encapsulation", 1874 RFC 7637, DOI 10.17487/RFC7637, September 2015, 1875 . 1877 [RFC8205] Lepinski, M., Ed. and K. Sriram, Ed., "BGPsec Protocol 1878 Specification", RFC 8205, DOI 10.17487/RFC8205, September 1879 2017, . 1881 [VXLAN-GPE] 1882 Maino, F., Kreeger, L., and U. Elzur, "Generic Protocol 1883 Extension for VXLAN", internet-draft draft-ietf-nvo3- 1884 vxlan-gpe, October 2017. 1886 Authors' Addresses 1888 Eric C. Rosen (editor) 1889 Juniper Networks, Inc. 1890 10 Technology Park Drive 1891 Westford, Massachusetts 01886 1892 United States 1894 Email: erosen@juniper.net 1896 Keyur Patel 1897 Arrcus 1899 Email: keyur@arrcus.com 1901 Gunter Van de Velde 1902 Nokia 1903 Copernicuslaan 50 1904 Antwerpen 2018 1905 Belgium 1907 Email: gunter.van_de_velde@nokia.com