======================================== Streaming MTU for ECIES Destinations ======================================== .. meta:: :author: zzz :created: 2020-05-06 :thread: http://zzz.i2p/topics/2886 :lastupdated: 2020-05-15 :status: Open :target: 0.9.47 .. contents:: Overview ======== Summary ------- ECIES reduces exisiting session (ES) message overhead by about 90 bytes. Therefore we can increase the MTU by about 90 bytes for ECIES connections. See [ECIES]_, [STREAMING-SPEC]_, and [STREAMING-OPTIONS]_. Without increasing the MTU, in many cases the overhead savings aren't really 'saved', as the messages will be padded out to use two full tunnel messages anyway. This proposal does not require any change to the specifications. It is posted as a proposal solely to facilitate discussion and consensus-building of the recommended value and of the implementation details. Goals ----- - Increase negotiated MTU - Maximize usage of 1 KB tunnel messages - Do not change streaming protocol Design ====== Use the existing MAX_PACKET_SIZE_INCLUDED option and MTU negotiation. Streaming continues to use the minimum of the sent and received MTU. The default remains 1730 for all connections, no matter what keys are used. Implementations are encouraged to include the MAX_PACKET_SIZE_INCLUDED option in all SYN packets, in both directions, although this is not a requirement. If a destination is ECIES-only, use the higher value (either as Alice or Bob). If a destination is dual-key, behavior may vary: If dual-key client is outside the router (in an external application), it may not "know" the key being used at the far-end, and Alice may request a higher value in the SYN, while the max data in the SYN remains 1730. If dual-key client is inside the router, the information of what key is being used may or may not be known to the client. The leaseset may not have been fetched yet, or the internal API interfaces may not easily make that information available to the client. If the information is available, Alice may use the higher value; otherwise, Alice must use the standard value of 1730 until negotiated. A dual-key client as Bob may send the higher value in response, even if no value or a value of 1730 was received from Alice; however, there is no provision for negotiating upwards in streaming, so the MTU should remain at 1730. As noted in [STREAMING-OPTIONS]_, the data in the SYN packets sent from Alice to Bob may exceed Bob's MTU. This is a weakness in the streaming protocol. Therefore, dual-key clients must limit the data in the sent SYN packets to 1730 bytes, while sending an MTU option of 1820. Once an 1820 MTU is received from Bob, Alice may increase the actual maximum payload sent. Specification ============= Add the following changes and clarifications to the MTU Selection and Negotiation section of [STREAMING-OPTIONS]_. No changes to [STREAMING-SPEC]_. The default value of the option i2p.streaming.maxMessageSize remains 1730 for all connections, no matter what keys are used. Clients must use the minimum of the sent and received MTU, as usual. There are four related MTU contants and variables: - DEFAULT_MTU: 1730, unchanged, for all connections - i2cp.streaming.maxMessageSize: default 1730 or 1820, may be changed by configuration - ALICE_SYN_MAX_DATA: The maximum data that AHTTP/1.1 200 OK Set-Cookie: i_like_gitea=e84e89a93c1cfd1a; Path=/; HttpOnly; Secure; SameSite=Lax Set-Cookie: _csrf=VRSEDmVwFcwlcPOsFZJXG3kLqzo6MTc1MzI2OTE2NDgxMjYwODQxNQ; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax Date: Wed, 23 Jul 2025 11:12:44 GMT Access-Control-Expose-Headers: Content-Disposition Etag: "9f28fbf8b4df1f8d08a40edd78528e72c965aa40" Content-Length: 6042 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Content-Disposition: inline; filename="155-streaming-mtu-ecies.rst"; filename*=UTF-8''155-streaming-mtu-ecies.rst Connection: close Cache-Control: public, max-age=21600, no-transform Content-Type: text/plain; charset=utf-8 Last-Modified: Fri, 15 May 2020 11:37:12 GMT X-Cache-Status: HIT X-Cache-Age: 0 ======================================== Streaming MTU for ECIES Destinations ======================================== .. meta:: :author: zzz :created: 2020-05-06 :thread: http://zzz.i2p/topics/2886 :lastupdated: 2020-05-15 :status: Open :target: 0.9.47 .. contents:: Overview ======== Summary ------- ECIES reduces exisiting session (ES) message overhead by about 90 bytes. Therefore we can increase the MTU by about 90 bytes for ECIES connections. See [ECIES]_, [STREAMING-SPEC]_, and [STREAMING-OPTIONS]_. Without increasing the MTU, in many cases the overhead savings aren't really 'saved', as the messages will be padded out to use two full tunnel messages anyway. This proposal does not require any change to the specifications. It is posted as a proposal solely to facilitate discussion and consensus-building of the recommended value and of the implementation details. Goals ----- - Increase negotiated MTU - Maximize usage of 1 KB tunnel messages - Do not change streaming protocol Design ====== Use the existing MAX_PACKET_SIZE_INCLUDED option and MTU negotiation. Streaming continues to use the minimum of the sent and received MTU. The default remains 1730 for all connections, no matter what keys are used. Implementations are encouraged to include the MAX_PACKET_SIZE_INCLUDED option in all SYN packets, in both directions, although this is not a requirement. If a destination is ECIES-only, use the higher value (either as Alice or Bob). If a destination is dual-key, behavior may vary: If dual-key client is outside the router (in an external application), it may not "know" the key being used at the far-end, and Alice may request a higher value in the SYN, while the max data in the SYN remains 1730. If dual-key client is inside the router, the information of what key is being used may or may not be known to the client. The leaseset may not have