idnits 2.17.1 draft-ietf-masque-connect-udp-15.txt: -(746): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding 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: ---------------------------------------------------------------------------- == There are 2 instances of lines with non-ascii characters in the document. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 1 character in excess of 72. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (17 June 2022) is 677 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 793 (ref. 'TCP') (Obsoleted by RFC 9293) Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 MASQUE D. Schinazi 3 Internet-Draft Google LLC 4 Intended status: Standards Track 17 June 2022 5 Expires: 19 December 2022 7 Proxying UDP in HTTP 8 draft-ietf-masque-connect-udp-15 10 Abstract 12 This document describes how to proxy UDP in HTTP, similar to how the 13 HTTP CONNECT method allows proxying TCP in HTTP. More specifically, 14 this document defines a protocol that allows an HTTP client to create 15 a tunnel for UDP communications through an HTTP server that acts as a 16 proxy. 18 About This Document 20 This note is to be removed before publishing as an RFC. 22 The latest revision of this draft can be found at https://ietf-wg- 23 masque.github.io/draft-ietf-masque-connect-udp/draft-ietf-masque- 24 connect-udp.html. Status information for this document may be found 25 at https://datatracker.ietf.org/doc/draft-ietf-masque-connect-udp/. 27 Discussion of this document takes place on the MASQUE Working Group 28 mailing list (mailto:masque@ietf.org), which is archived at 29 https://mailarchive.ietf.org/arch/browse/masque/. 31 Source for this draft and an issue tracker can be found at 32 https://github.com/ietf-wg-masque/draft-ietf-masque-connect-udp. 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 19 December 2022. 50 Copyright Notice 52 Copyright (c) 2022 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 (https://trustee.ietf.org/ 57 license-info) in effect on the date of publication of this document. 58 Please review these documents carefully, as they describe your rights 59 and restrictions with respect to this document. Code Components 60 extracted from this document must include Revised BSD License text as 61 described in Section 4.e of the Trust Legal Provisions and are 62 provided without warranty as described in the Revised BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 67 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 3 68 2. Client Configuration . . . . . . . . . . . . . . . . . . . . 3 69 3. Tunnelling UDP over HTTP . . . . . . . . . . . . . . . . . . 4 70 3.1. UDP Proxy Handling . . . . . . . . . . . . . . . . . . . 5 71 3.2. HTTP/1.1 Request . . . . . . . . . . . . . . . . . . . . 6 72 3.3. HTTP/1.1 Response . . . . . . . . . . . . . . . . . . . . 7 73 3.4. HTTP/2 and HTTP/3 Requests . . . . . . . . . . . . . . . 8 74 3.5. HTTP/2 and HTTP/3 Responses . . . . . . . . . . . . . . . 9 75 3.6. Note About Draft Versions . . . . . . . . . . . . . . . . 9 76 4. Context Identifiers . . . . . . . . . . . . . . . . . . . . . 9 77 5. HTTP Datagram Payload Format . . . . . . . . . . . . . . . . 10 78 6. Performance Considerations . . . . . . . . . . . . . . . . . 12 79 6.1. MTU Considerations . . . . . . . . . . . . . . . . . . . 12 80 6.2. Tunneling of ECN Marks . . . . . . . . . . . . . . . . . 13 81 7. Security Considerations . . . . . . . . . . . . . . . . . . . 13 82 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 83 8.1. HTTP Upgrade Token . . . . . . . . . . . . . . . . . . . 14 84 8.2. Well-Known URI . . . . . . . . . . . . . . . . . . . . . 14 85 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 14 86 9.1. Normative References . . . . . . . . . . . . . . . . . . 14 87 9.2. Informative References . . . . . . . . . . . . . . . . . 16 88 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 17 89 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 18 91 1. Introduction 93 While HTTP provides the CONNECT method (see Section 9.3.6 of [HTTP]) 94 for creating a TCP [TCP] tunnel to a proxy, prior to this 95 specification it lacked a method for doing so for UDP [UDP] traffic. 97 This document describes a protocol for tunnelling UDP to a server 98 acting as a UDP-specific proxy over HTTP. UDP tunnels are commonly 99 used to create an end-to-end virtual connection, which can then be 100 secured using QUIC [QUIC] or another protocol running over UDP. 101 Unlike CONNECT, the UDP proxy itself is identified with an absolute 102 URL containing the traffic's destination. Clients generate those 103 URLs using a URI Template [TEMPLATE], as described in Section 2. 105 This protocol supports all existing versions of HTTP by using HTTP 106 Datagrams [HTTP-DGRAM]. When using HTTP/2 [HTTP/2] or HTTP/3 107 [HTTP/3], it uses HTTP Extended CONNECT as described in 108 [EXT-CONNECT2] and [EXT-CONNECT3]. When using HTTP/1.x [HTTP/1.1], 109 it uses HTTP Upgrade as defined in Section 7.8 of [HTTP]. 111 1.1. Conventions and Definitions 113 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 114 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 115 "OPTIONAL" in this document are to be interpreted as described in 116 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 117 capitals, as shown here. 119 In this document, we use the term "UDP proxy" to refer to the HTTP 120 server that acts upon the client's UDP tunnelling request to open a 121 UDP socket to a target server, and generates the response to this 122 request. If there are HTTP intermediaries (as defined in Section 3.7 123 of [HTTP]) between the client and the UDP proxy, those are referred 124 to as "intermediaries" in this document. 126 Note that, when the HTTP version in use does not support multiplexing 127 streams (such as HTTP/1.1), any reference to "stream" in this 128 document represents the entire connection. 130 2. Client Configuration 132 HTTP clients are configured to use a UDP proxy with a URI Template 133 [TEMPLATE] that has the variables "target_host" and "target_port". 134 Examples are shown below: 136 https://example.org/.well-known/masque/udp/{target_host}/{target_port}/ 137 https://proxy.example.org:4443/masque?h={target_host}&p={target_port} 138 https://proxy.example.org:4443/masque{?target_host,target_port} 140 Figure 1: URI Template Examples 142 The following requirements apply to the URI Template: 144 * The URI Template MUST be a level 3 template or lower. 146 * The URI Template MUST be in absolute form, and MUST include non- 147 empty scheme, authority and path components. 149 * The path component of the URI Template MUST start with a slash 150 "/". 152 * All template variables MUST be within the path or query components 153 of the URI. 155 * The URI template MUST contain the two variables "target_host" and 156 "target_port" and MAY contain other variables. 158 * The URI Template MUST NOT contain any non-ASCII unicode characters 159 and MUST only contain ASCII characters in the range 0x21-0x7E 160 inclusive (note that percent-encoding is allowed; see Section 2.1 161 of [URI]). 163 * The URI Template MUST NOT use Reserved Expansion ("+" operator), 164 Fragment Expansion ("#" operator), Label Expansion with Dot- 165 Prefix, Path Segment Expansion with Slash-Prefix, nor Path-Style 166 Parameter Expansion with Semicolon-Prefix. 168 Clients SHOULD validate the requirements above; however, clients MAY 169 use a general-purpose URI Template implementation that lacks this 170 specific validation. If a client detects that any of the 171 requirements above are not met by a URI Template, the client MUST 172 reject its configuration and abort the request without sending it to 173 the UDP proxy. 175 Since the original HTTP CONNECT method allowed conveying the target 176 host and port but not the scheme, proxy authority, path, nor query, 177 there exist clients with proxy configuration interfaces that only 178 allow the user to configure the proxy host and the proxy port. 179 Client implementations of this specification that are constrained by 180 such limitations MAY attempt to access UDP proxying capabilities 181 using the default template, which is defined as: 182 "https://$PROXY_HOST:$PROXY_PORT/.well-known/masque/ 183 udp/{target_host}/{target_port}/" where $PROXY_HOST and $PROXY_PORT 184 are the configured host and port of the UDP proxy respectively. UDP 185 proxy deployments SHOULD offer service at this location if they need 186 to interoperate with such clients. 188 3. Tunnelling UDP over HTTP 190 To allow negotiation of a tunnel for UDP over HTTP, this document 191 defines the "connect-udp" HTTP Upgrade Token. The resulting UDP 192 tunnels use the Capsule Protocol (see Section 3.2 of [HTTP-DGRAM]) 193 with HTTP Datagrams in the format defined in Section 5. 195 To initiate a UDP tunnel associated with a single HTTP stream, a 196 client issues a request containing the "connect-udp" upgrade token. 197 The target of the tunnel is indicated by the client to the UDP proxy 198 via the "target_host" and "target_port" variables of the URI 199 Template, see Section 2. If the request is successful, the UDP proxy 200 commits to converting received HTTP Datagrams into UDP packets and 201 vice versa until the tunnel is closed. 203 When sending its UDP proxying request, the client SHALL perform URI 204 Template expansion to determine the path and query of its request. 205 target_host supports using DNS names, IPv6 literals and IPv4 206 literals. Note that IPv6 scoped addressing zone identifiers are not 207 supported. Also note that this URI Template expansion requires using 208 percent-encoding, so for example if the target_host is 209 "2001:db8::42", it will be encoded in the URI as 210 "2001%3Adb8%3A%3A42". 212 By virtue of the definition of the Capsule Protocol (see Section 3.2 213 of [HTTP-DGRAM]), UDP proxying requests do not carry any message 214 content. Similarly, successful UDP proxying responses also do not 215 carry any message content. 217 3.1. UDP Proxy Handling 219 Upon receiving a UDP proxying request: 221 * if the recipient is configured to use another HTTP proxy, it will 222 act as an intermediary: it forwards the request to another HTTP 223 server. Note that such intermediaries may need to reencode the 224 request if they forward it using a version of HTTP that is 225 different from the one used to receive it, as the request encoding 226 differs by version (see below). 228 * otherwise, the recipient will act as a UDP proxy: it extracts the 229 "target_host" and "target_port" variables from the URI it has 230 reconstructed from the request headers, and establishes a tunnel 231 by directly opening a UDP socket to the requested target. 233 Unlike TCP, UDP is connection-less. The UDP proxy that opens the UDP 234 socket has no way of knowing whether the destination is reachable. 235 Therefore, it needs to respond to the request without waiting for a 236 packet from the target. However, if the target_host is a DNS name, 237 the UDP proxy MUST perform DNS resolution before replying to the HTTP 238 request. If errors occur during this process, the UDP proxy MUST 239 reject the request and SHOULD send details using an appropriate 240 "Proxy-Status" header field [PROXY-STATUS] (for example, if DNS 241 resolution returns an error, the proxy can use the dns_error Proxy 242 Error Type from Section 2.3.2 of [PROXY-STATUS]). 244 UDP proxies can use connected UDP sockets if their operating system 245 supports them, as that allows the UDP proxy to rely on the kernel to 246 only send it UDP packets that match the correct 5-tuple. If the UDP 247 proxy uses a non-connected socket, it MUST validate the IP source 248 address and UDP source port on received packets to ensure they match 249 the client's request. Packets that do not match MUST be discarded by 250 the UDP proxy. 252 The lifetime of the socket is tied to the request stream. The UDP 253 proxy MUST keep the socket open while the request stream is open. If 254 a UDP proxy is notified by its operating system that its socket is no 255 longer usable (for example, this can happen when an ICMP "Destination 256 Unreachable" message is received, see Section 3.1 of [ICMP6]), it 257 MUST close the request stream. UDP proxies MAY choose to close 258 sockets due to a period of inactivity, but they MUST close the 259 request stream when closing the socket. UDP proxies that close 260 sockets after a period of inactivity SHOULD NOT use a period lower 261 than two minutes, see Section 4.3 of [BEHAVE]. 263 A successful response (as defined in Section 3.3 and Section 3.5) 264 indicates that the UDP proxy has opened a socket to the requested 265 target and is willing to proxy UDP payloads. Any response other than 266 a successful response indicates that the request has failed, and the 267 client MUST therefore abort the request. 269 UDP proxies MUST NOT introduce fragmentation at the IP layer when 270 forwarding HTTP Datagrams onto a UDP socket; overly large datagrams 271 are silently dropped. In IPv4, the Don't Fragment (DF) bit MUST be 272 set if possible, to prevent fragmentation on the path. Future 273 extensions MAY remove these requirements. 275 Implementers of UDP proxies will benefit from reading the guidance in 276 [UDP-USAGE]. 278 3.2. HTTP/1.1 Request 280 When using HTTP/1.1 [HTTP/1.1], a UDP proxying request will meet the 281 following requirements: 283 * the method SHALL be "GET". 285 * the request SHALL include a single "Host" header field containing 286 the origin of the UDP proxy. 288 * the request SHALL include a "Connection" header field with value 289 "Upgrade" (note that this requirement is case-insensitive as per 290 Section 7.6.1 of [HTTP]). 292 * the request SHALL include an "Upgrade" header field with value 293 "connect-udp". 295 A UDP proxying request that does not conform to these restrictions is 296 malformed. The recipient of such a malformed request MUST respond 297 with an error, and SHOULD use the 400 (Bad Request) status code. 299 For example, if the client is configured with URI Template 300 "https://example.org/.well-known/masque/ 301 udp/{target_host}/{target_port}/" and wishes to open a UDP proxying 302 tunnel to target 192.0.2.6:443, it could send the following request: 304 GET https://example.org/.well-known/masque/udp/192.0.2.6/443/ HTTP/1.1 305 Host: example.org 306 Connection: Upgrade 307 Upgrade: connect-udp 308 Capsule-Protocol: ?1 310 Figure 2: Example HTTP/1.1 Request 312 In HTTP/1.1, this protocol uses the GET method to mimic the design of 313 the WebSocket Protocol [WEBSOCKET]. 315 3.3. HTTP/1.1 Response 317 The UDP proxy SHALL indicate a successful response by replying with 318 the following requirements: 320 * the HTTP status code on the response SHALL be 101 (Switching 321 Protocols). 323 * the reponse SHALL include a "Connection" header field with value 324 "Upgrade" (note that this requirement is case-insensitive as per 325 Section 7.6.1 of [HTTP]). 327 * the response SHALL include a single "Upgrade" header field with 328 value "connect-udp". 330 * the response SHALL meet the requirements of HTTP responses that 331 start the Capsule Protocol; see Section 3.2 of [HTTP-DGRAM]. 333 If any of these requirements are not met, the client MUST treat this 334 proxying attempt as failed and abort the connection. 336 For example, the UDP proxy could respond with: 338 HTTP/1.1 101 Switching Protocols 339 Connection: Upgrade 340 Upgrade: connect-udp 341 Capsule-Protocol: ?1 343 Figure 3: Example HTTP/1.1 Response 345 3.4. HTTP/2 and HTTP/3 Requests 347 When using HTTP/2 [HTTP/2] or HTTP/3 [HTTP/3], UDP proxying requests 348 use Extended CONNECT. This requires that servers send an HTTP 349 Setting as specified in [EXT-CONNECT2] and [EXT-CONNECT3], and that 350 requests use HTTP pseudo-header fields with the following 351 requirements: 353 * The ":method" pseudo-header field SHALL be "CONNECT". 355 * The ":protocol" pseudo-header field SHALL be "connect-udp". 357 * The ":authority" pseudo-header field SHALL contain the authority 358 of the UDP proxy. 360 * The ":path" and ":scheme" pseudo-header fields SHALL NOT be empty. 361 Their values SHALL contain the scheme and path from the URI 362 Template after the URI template expansion process has been 363 completed. 365 A UDP proxying request that does not conform to these restrictions is 366 malformed (see Section 8.1.1 of [HTTP/2] and Section 4.1.2 of 367 [HTTP/3]). 369 For example, if the client is configured with URI Template 370 "https://example.org/.well-known/masque/ 371 udp/{target_host}/{target_port}/" and wishes to open a UDP proxying 372 tunnel to target 192.0.2.6:443, it could send the following request: 374 HEADERS 375 :method = CONNECT 376 :protocol = connect-udp 377 :scheme = https 378 :path = /.well-known/masque/udp/192.0.2.6/443/ 379 :authority = example.org 380 capsule-protocol = ?1 382 Figure 4: Example HTTP/2 Request 384 3.5. HTTP/2 and HTTP/3 Responses 386 The UDP proxy SHALL indicate a successful response by replying with 387 the following requirements: 389 * the HTTP status code on the response SHALL be in the 2xx 390 (Successful) range. 392 * the response SHALL meet the requirements of HTTP responses that 393 start the Capsule Protocol; see Section 3.2 of [HTTP-DGRAM]. 395 If any of these requirements are not met, the client MUST treat this 396 proxying attempt as failed and abort the request. 398 For example, the UDP proxy could respond with: 400 HEADERS 401 :status = 200 402 capsule-protocol = ?1 404 Figure 5: Example HTTP/2 Response 406 3.6. Note About Draft Versions 408 [[RFC editor: please remove this section before publication.]] 410 In order to allow implementations to support multiple draft versions 411 of this specification during its development, we introduce the 412 "connect-udp-version" header field. When sent by the client, it 413 contains a list of draft numbers supported by the client (e.g., 414 "connect-udp-version: 0, 2"). When sent by the UDP proxy, it 415 contains a single draft number selected by the UDP proxy from the 416 list provided by the client (e.g., "connect-udp-version: 2"). 417 Sending this header field is RECOMMENDED but not required. The 418 "connect-udp-version" header field is a List Structured Field 419 (https://www.rfc-editor.org/rfc/rfc8941#section-3.1). Each list 420 member MUST be an Integer. 422 4. Context Identifiers 424 The mechanism for proxying UDP in HTTP defined in this document 425 allows future extensions to exchange HTTP Datagrams that carry 426 different semantics from UDP payloads. Some of these extensions can 427 augment UDP payloads with additional data, while others can exchange 428 data that is completely separate from UDP payloads. In order to 429 accomplish this, all HTTP Datagrams associated with UDP Proxying 430 request streams start with a context ID, see Section 5. 432 Context IDs are 62-bit integers (0 to 2^62-1). Context IDs are 433 encoded as variable-length integers, see Section 16 of [QUIC]. The 434 context ID value of 0 is reserved for UDP payloads, while non-zero 435 values are dynamically allocated: non-zero even-numbered context IDs 436 are client-allocated, and odd-numbered context IDs are proxy- 437 allocated. The context ID namespace is tied to a given HTTP request: 438 it is possible for a context ID with the same numeric value to be 439 simultaneously allocated in distinct requests, potentially with 440 different semantics. Context IDs MUST NOT be re-allocated within a 441 given HTTP namespace but MAY be allocated in any order. The context 442 ID allocation restrictions to the use of even-numbered and odd- 443 numbered context IDs exist in order to avoid the need for 444 synchronisation between endpoints. However, once a context ID has 445 been allocated, those restrictions do not apply to the use of the 446 context ID: it can be used by any client or UDP proxy, independent of 447 which endpoint initially allocated it. 449 Registration is the action by which an endpoint informs its peer of 450 the semantics and format of a given context ID. This document does 451 not define how registration occurs. Future extensions MAY use HTTP 452 header fields or capsules to register contexts. Depending on the 453 method being used, it is possible for datagrams to be received with 454 Context IDs which have not yet been registered, for instance due to 455 reordering of the packet containing the datagram and the packet 456 containing the registration message during transmission. 458 5. HTTP Datagram Payload Format 460 When HTTP Datagrams (see Section 2 of [HTTP-DGRAM]) are associated 461 with UDP proxying request streams, the HTTP Datagram Payload field 462 has the format defined in Figure 6. Note that when HTTP Datagrams 463 are encoded using QUIC DATAGRAM frames [DGRAM], the Context ID field 464 defined below directly follows the Quarter Stream ID field which is 465 at the start of the QUIC DATAGRAM frame payload (see Section 2.1 of 466 [HTTP-DGRAM]). 468 UDP Proxying HTTP Datagram Payload { 469 Context ID (i), 470 Payload (..), 471 } 473 Figure 6: UDP Proxying HTTP Datagram Format 475 Context ID: A variable-length integer (see Section 16 of [QUIC]) 476 that contains the value of the Context ID. If an HTTP/3 Datagram 477 which carries an unknown Context ID is received, the receiver 478 SHALL either drop that datagram silently or buffer it temporarily 479 (on the order of a round trip) while awaiting the registration of 480 the corresponding Context ID. 481 Payload: The payload of the datagram, whose semantics depend on 482 value of the previous field. Note that this field can be empty. 484 UDP packets are encoded using HTTP Datagrams with the Context ID set 485 to zero. When the Context ID is set to zero, the Payload field 486 contains the unmodified payload of a UDP packet (referred to as "data 487 octets" in [UDP]). 489 By virtue of the definition of the UDP header [UDP], it is not 490 possible to encode UDP payloads longer than 65527 bytes. Therefore, 491 endpoints MUST NOT send HTTP Datagrams with a Payload field longer 492 than 65527 using Context ID zero. An endpoint that receives an HTTP 493 Datagram using Context ID zero whose Payload field is longer than 494 65527 MUST abort the corresponding stream. If a UDP proxy knows it 495 can only send out UDP packets of a certain length due to its 496 underlying link MTU, it has no choice but to discard incoming HTTP 497 Datagrams using Context ID zero whose Payload field is longer than 498 that limit. If the discarded HTTP Datagram was transported by a 499 DATAGRAM capsule, the receiver SHOULD discard that capsule without 500 buffering the capsule contents. 502 If a UDP proxy receives an HTTP Datagram before it has received the 503 corresponding request, it SHALL either drop that HTTP Datagram 504 silently or buffer it temporarily (on the order of a round trip) 505 while awaiting the corresponding request. 507 Note that buffering datagrams (either because the request was not yet 508 received, or because the Context ID is not yet known) consumes 509 resources. Receivers that buffer datagrams SHOULD apply buffering 510 limits in order to reduce the risk of resource exhaustion occuring. 511 For example, receivers can limit the total number of buffered 512 datagrams, or the cumulative size of buffered datagrams, on a per- 513 stream, per-context, or per-connection basis. 515 A client MAY optimistically start sending UDP packets in HTTP 516 Datagrams before receiving the response to its UDP proxying request. 517 However, implementers should note that such proxied packets may not 518 be processed by the UDP proxy if it responds to the request with a 519 failure, or if the proxied packets are received by the UDP proxy 520 before the request and the UDP proxy chooses to not buffer them. 522 6. Performance Considerations 524 Bursty traffic can often lead to temporally correlated packet losses, 525 which in turn can lead to suboptimal responses from congestion 526 controllers in protocols running over UDP. To avoid this, UDP 527 proxies SHOULD strive to avoid increasing burstiness of UDP traffic: 528 they SHOULD NOT queue packets in order to increase batching. 530 When the protocol running over UDP that is being proxied uses 531 congestion control (e.g., [QUIC]), the proxied traffic will incur at 532 least two nested congestion controllers. The underlying HTTP 533 connection MUST NOT disable congestion control unless it has an out- 534 of-band way of knowing with absolute certainty that the inner traffic 535 is congestion-controlled. 537 If a client or UDP proxy with a connection containing a UDP proxying 538 request stream disables congestion control, it MUST NOT signal 539 Explicit Congestion Notification (ECN) [ECN] support on that 540 connection. That is, it MUST mark all IP headers with the Not-ECT 541 codepoint. It MAY continue to report ECN feedback via QUIC ACK_ECN 542 frames or the TCP "ECE" bit, as the peer may not have disabled 543 congestion control. 545 When the protocol running over UDP that is being proxied uses loss 546 recovery (e.g., [QUIC]), and the underlying HTTP connection runs over 547 TCP, the proxied traffic will incur at least two nested loss recovery 548 mechanisms. This can reduce performance as both can sometimes 549 independently retransmit the same data. To avoid this, UDP proxying 550 SHOULD be performed over HTTP/3 to allow leveraging the QUIC DATAGRAM 551 frame. 553 6.1. MTU Considerations 555 When using HTTP/3 with the QUIC Datagram extension [DGRAM], UDP 556 payloads are transmitted in QUIC DATAGRAM frames. Since those cannot 557 be fragmented, they can only carry payloads up to a given length 558 determined by the QUIC connection configuration and the path MTU. If 559 a UDP proxy is using QUIC DATAGRAM frames and it receives a UDP 560 payload from the target that will not fit inside a QUIC DATAGRAM 561 frame, the UDP proxy SHOULD NOT send the UDP payload in a DATAGRAM 562 capsule, as that defeats the end-to-end unreliability characteristic 563 that methods such as Datagram Packetization Layer Path MTU Discovery 564 (DPLPMTUD) depend on [DPLPMTUD]. In this scenario, the UDP proxy 565 SHOULD drop the UDP payload and send an ICMP "Packet Too Big" message 566 to the target, see Section 3.2 of [ICMP6]. 568 6.2. Tunneling of ECN Marks 570 UDP proxying does not create an IP-in-IP tunnel, so the guidance in 571 [ECN-TUNNEL] about transferring ECN marks between inner and outer IP 572 headers does not apply. There is no inner IP header in UDP proxying 573 tunnels. 575 Note that UDP proxying clients do not have the ability in this 576 specification to control the ECN codepoints on UDP packets the UDP 577 proxy sends to the target, nor can UDP proxies communicate the 578 markings of each UDP packet from target to UDP proxy. 580 A UDP proxy MUST ignore ECN bits in the IP header of UDP packets 581 received from the target, and MUST set the ECN bits to Not-ECT on UDP 582 packets it sends to the target. These do not relate to the ECN 583 markings of packets sent between client and UDP proxy in any way. 585 7. Security Considerations 587 There are significant risks in allowing arbitrary clients to 588 establish a tunnel to arbitrary targets, as that could allow bad 589 actors to send traffic and have it attributed to the UDP proxy. HTTP 590 servers that support UDP proxying ought to restrict its use to 591 authenticated users. 593 There exist software and network deployments that perform access 594 control checks based on the source IP address of incoming requests. 595 For example, some software allows unauthenticated configuration 596 changes if they originated from 127.0.0.1. Such software could be 597 running on the same host as the UDP proxy, or in the same broadcast 598 domain. Proxied UDP traffic would then be received with a source IP 599 address belonging to the UDP proxy. If this source address is used 600 for access control, UDP proxying clients could use the UDP proxy to 601 escalate their access privileges beyond those they might otherwise 602 have. This could lead to unauthorized access by UDP proxying clients 603 unless the UDP proxy disallows UDP proxying requests to vulnerable 604 targets, such as the UDP proxy's own addresses and localhost, link- 605 local, multicast, and broadcast addresses. UDP proxies can use the 606 destination_ip_prohibited Proxy Error Type from Section 2.3.5 of 607 [PROXY-STATUS] when rejecting such requests. 609 UDP proxies share many similarities to TCP CONNECT proxies when 610 considering them as infrastructure for abuse to enable denial of 611 service attacks. Both can obfuscate the attacker's source address 612 from the attack target. In the case of a stateless volumetric attack 613 (e.g., a TCP SYN flood or a UDP flood), both types of proxies pass 614 the traffic to the target host. With stateful volumetric attacks 615 (e.g., HTTP flooding) being sent over a TCP CONNECT proxy, the proxy 616 will only send data if the target has indicated its willingness to 617 accept data by responding with a TCP SYN-ACK. Once the path to the 618 target is flooded, the TCP CONNECT proxy will no longer receive 619 replies from the target and will stop sending data. Since UDP does 620 not establish shared state between the UDP proxy and the target, the 621 UDP proxy could continue sending data to the target in such a 622 situation. While a UDP proxy could potentially limit the number of 623 UDP packets it is willing to forward until it has observed a response 624 from the target, that provides limited protection against denial of 625 service attacks when attacks target open UDP ports where the protocol 626 running over UDP would respond, and that would be interpreted as 627 willingness to accept UDP by the UDP proxy. Such a packet limit 628 could also cause issues for valid traffic. 630 The security considerations described in Section 4 of [HTTP-DGRAM] 631 also apply here. Since it is possible to tunnel IP packets over UDP, 632 the guidance in [TUNNEL-SECURITY] can apply. 634 8. IANA Considerations 636 8.1. HTTP Upgrade Token 638 This document will request IANA to register "connect-udp" in the 639 "HTTP Upgrade Tokens" registry maintained at 640 . 642 Value: connect-udp 643 Description: Proxying of UDP Payloads 644 Expected Version Tokens: None 645 Reference: This document 647 8.2. Well-Known URI 649 This document will request IANA to register "masque" in the "Well- 650 Known URIs" registry maintained at . 653 URI Suffix: masque 654 Change Controller: IETF 655 Reference: This document 656 Status: permanent (if this document is approved) 657 Related Information: Includes all resources identified with the path 658 prefix "/.well-known/masque/udp/" 660 9. References 662 9.1. Normative References 664 [DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable 665 Datagram Extension to QUIC", RFC 9221, 666 DOI 10.17487/RFC9221, March 2022, 667 . 669 [ECN] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 670 of Explicit Congestion Notification (ECN) to IP", 671 RFC 3168, DOI 10.17487/RFC3168, September 2001, 672 . 674 [EXT-CONNECT2] 675 McManus, P., "Bootstrapping WebSockets with HTTP/2", 676 RFC 8441, DOI 10.17487/RFC8441, September 2018, 677 . 679 [EXT-CONNECT3] 680 Hamilton, R., "Bootstrapping WebSockets with HTTP/3", 681 RFC 9220, DOI 10.17487/RFC9220, June 2022, 682 . 684 [HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 685 Ed., "HTTP Semantics", STD 97, RFC 9110, 686 DOI 10.17487/RFC9110, June 2022, 687 . 689 [HTTP-DGRAM] 690 Schinazi, D. and L. Pardue, "HTTP Datagrams and the 691 Capsule Protocol", Work in Progress, Internet-Draft, 692 draft-ietf-masque-h3-datagram-11, 17 June 2022, 693 . 696 [HTTP/1.1] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 697 Ed., "HTTP/1.1", STD 99, RFC 9112, DOI 10.17487/RFC9112, 698 June 2022, . 700 [HTTP/2] Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113, 701 DOI 10.17487/RFC9113, June 2022, 702 . 704 [HTTP/3] Bishop, M., Ed., "HTTP/3", RFC 9114, DOI 10.17487/RFC9114, 705 June 2022, . 707 [PROXY-STATUS] 708 Nottingham, M. and P. Sikora, "The Proxy-Status HTTP 709 Response Header Field", RFC 9209, DOI 10.17487/RFC9209, 710 June 2022, . 712 [QUIC] Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 713 Multiplexed and Secure Transport", RFC 9000, 714 DOI 10.17487/RFC9000, May 2021, 715 . 717 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 718 Requirement Levels", BCP 14, RFC 2119, 719 DOI 10.17487/RFC2119, March 1997, 720 . 722 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 723 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 724 May 2017, . 726 [TCP] Postel, J., "Transmission Control Protocol", STD 7, 727 RFC 793, DOI 10.17487/RFC0793, September 1981, 728 . 730 [TEMPLATE] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 731 and D. Orchard, "URI Template", RFC 6570, 732 DOI 10.17487/RFC6570, March 2012, 733 . 735 [UDP] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 736 DOI 10.17487/RFC0768, August 1980, 737 . 739 9.2. Informative References 741 [BEHAVE] Audet, F., Ed. and C. Jennings, "Network Address 742 Translation (NAT) Behavioral Requirements for Unicast 743 UDP", BCP 127, RFC 4787, DOI 10.17487/RFC4787, January 744 2007, . 746 [DPLPMTUD] Fairhurst, G., Jones, T., Tüxen, M., Rüngeler, I., and T. 747 Völker, "Packetization Layer Path MTU Discovery for 748 Datagram Transports", RFC 8899, DOI 10.17487/RFC8899, 749 September 2020, . 751 [ECN-TUNNEL] 752 Briscoe, B., "Tunnelling of Explicit Congestion 753 Notification", RFC 6040, DOI 10.17487/RFC6040, November 754 2010, . 756 [ICMP6] Conta, A., Deering, S., and M. Gupta, Ed., "Internet 757 Control Message Protocol (ICMPv6) for the Internet 758 Protocol Version 6 (IPv6) Specification", STD 89, 759 RFC 4443, DOI 10.17487/RFC4443, March 2006, 760 . 762 [TUNNEL-SECURITY] 763 Krishnan, S., Thaler, D., and J. Hoagland, "Security 764 Concerns with IP Tunneling", RFC 6169, 765 DOI 10.17487/RFC6169, April 2011, 766 . 768 [UDP-USAGE] 769 Eggert, L., Fairhurst, G., and G. Shepherd, "UDP Usage 770 Guidelines", BCP 145, RFC 8085, DOI 10.17487/RFC8085, 771 March 2017, . 773 [URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 774 Resource Identifier (URI): Generic Syntax", STD 66, 775 RFC 3986, DOI 10.17487/RFC3986, January 2005, 776 . 778 [WEBSOCKET] 779 Fette, I. and A. Melnikov, "The WebSocket Protocol", 780 RFC 6455, DOI 10.17487/RFC6455, December 2011, 781 . 783 Acknowledgments 785 This document is a product of the MASQUE Working Group, and the 786 author thanks all MASQUE enthusiasts for their contibutions. This 787 proposal was inspired directly or indirectly by prior work from many 788 people, in particular HELIUM (https://www.ietf.org/archive/id/draft- 789 schwartz-httpbis-helium-00.txt) by Ben Schwartz, HiNT 790 (https://www.ietf.org/archive/id/draft-pardue-httpbis-http-network- 791 tunnelling-00.txt) by Lucas Pardue, and the original MASQUE Protocol 792 (https://www.ietf.org/archive/id/draft-schinazi-masque-00.txt) by the 793 author of this document. 795 The author would like to thank Eric Rescorla for suggesting the use 796 of an HTTP method to proxy UDP. The author is indebted to Mark 797 Nottingham and Lucas Pardue for the many improvements they 798 contributed to this document. The extensibility design in this 799 document came out of the HTTP Datagrams Design Team, whose members 800 were Alan Frindell, Alex Chernyakhovsky, Ben Schwartz, Eric Rescorla, 801 Lucas Pardue, Marcus Ihlar, Martin Thomson, Mike Bishop, Tommy Pauly, 802 Victor Vasiliev, and the author of this document. 804 Author's Address 806 David Schinazi 807 Google LLC 808 1600 Amphitheatre Parkway 809 Mountain View, CA 94043 810 United States of America 811 Email: dschinazi.ietf@gmail.com