curl: (on linux) add MPTCP support

Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths.

Multipath TCP has been used for several use cases. On smartphones, MPTCP
enables seamless handovers between cellular and Wi-Fi networks while
preserving established connections. This use-case is what pushed Apple
to use MPTCP since 2013 in multiple applications [2]. On dual-stack
hosts, Multipath TCP enables the TCP connection to automatically use the
best performing path, either IPv4 or IPv6. If one path fails, MPTCP
automatically uses the other path.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [3]. To
use it on Linux, an application must explicitly enable it when creating
the socket. No need to change anything else in the application.

This attached patch adds an --mptcp option which allows the creation of
an MPTCP socket instead of TCP on Linux. If Multipath TCP is not
supported on the system, an error will be reported. It is important to
note that if the end server doesn't support MPTCP, the connection will
continue after a seamless fallback to TCP.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.tessares.net/apples-mptcp-story-so-far/ [2]
Link: https://www.mptcp.dev [3]
Co-developed-by: Dorian Craps (@CrapsDorian) <doriancraps@gmail.com>
Co-developed-by: Olivier Bonaventure (@obonaventure) <Olivier.Bonaventure@uclouvain.be>
Co-developed-by: Matthieu Baerts (@matttbe) <matttbe@kernel.org>
Signed-off-by: Dorian Craps <dorian.craps@student.vinci.be>

Closes #13278
This commit is contained in:
Dorian Craps 2024-04-04 11:42:50 +02:00 committed by Daniel Stenberg
parent 3c20ae08b9
commit ab6d5442e8
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 156 additions and 0 deletions

View file

@ -162,6 +162,7 @@ DPAGES = \
max-redirs.md \
max-time.md \
metalink.md \
mptcp.md \
negotiate.md \
netrc-file.md \
netrc-optional.md \

View file

@ -0,0 +1,41 @@
---
c: Copyright (C) Dorian Craps, <dorian.craps@student.vinci.be>
SPDX-License-Identifier: curl
Long: mptcp
Added: 8.9.0
Help: Enable Multipath TCP
Category: connection
Multi: boolean
See-also:
- tcp-fastopen
Example:
- --mptcp $URL
---
# `--mptcp`
Enables the use of Multipath TCP (MPTCP) for connections. MPTCP is an extension
to the standard TCP that allows multiple TCP streams over different network
paths between the same source and destination. This can enhance bandwidth and
improve reliability by using multiple paths simultaneously.
MPTCP is beneficial in networks where multiple paths exist between clients and
servers, such as mobile networks where a device may switch between WiFi and
cellular data or in wired networks with multiple Internet Service Providers.
## Usage
To use MPTCP for your connections, add the `--mptcp` option when using `curl'.
## Requirements
This feature is currently only supported on Linux starting from kernel 5.6. Only
TCP connections are modified, hence this option does not effect HTTP/3 (QUIC)
connections.
The server you are connecting to must also support MPTCP. If not, the connection
seamlessly falls back to TCP.
## Availability
The `--mptcp` option is available starting from `curl` version 8.9.0.

View file

@ -127,6 +127,7 @@
--max-redirs 7.5
--max-time (-m) 4.0
--metalink 7.27.0
--mptcp 8.9.0
--negotiate 7.10.6
--netrc (-n) 4.6
--netrc-file 7.21.5