First version of Multipath TCP support in curl#9713
First version of Multipath TCP support in curl#9713obonaventure wants to merge 1 commit intocurl:masterfrom
Conversation
Initial support for Multipath TCP for curl. Multipath TCP is a TCP extension defined in
RFC8684 that is supported by recent Linux kernels (5.13+). Multipath TCP allows a
TCP connection to use different paths (e.g. Wi-Fi and cellular on smartphones, IPv4 and
IPv6, ...). Multipath TCP is enabled by default on recent Linux distributions
(Debian, Ubuntu, Redhat,...)
This patch provides the --multipath command line option that enables Multipath TCP
when set. If running on a kernel that does not support Multipath TCP, curl remembers
the fact that Multipath TCP does not work and does not attempt anymore to use Multipath TCP
when creating a TCP connection. Another possibility would be to always enable Multipath
TCP by default on Linux.
With the patch, curl reports the activation of Multipath TCP when interacting with a
Multipath TCP server.
Compile with -DMPTCP to enable Multipath TCP support
* Multipath TCP is enabled.
* Trying [2001:41d0:a:ffcf::1]:80...
* Failed to set TCP_KEEPIDLE on fd 5
* Failed to set TCP_KEEPINTVL on fd 5
* Connected to test.multipath-tcp.org (2001:41d0:a:ffcf::1) port 80 (#0)
* Multipath TCP was accepted by the remote server.
> GET / HTTP/1.1
> Host: test.multipath-tcp.org
> User-Agent: curl/7.86.0-DEV
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html
< Accept-Ranges: bytes
< ETag: "4215149735"
< Last-Modified: Tue, 05 Jul 2022 16:11:47 GMT
< Content-Length: 389
< Date: Wed, 12 Oct 2022 16:32:51 GMT
< Server: lighttpd/1.4.59
<
<!DOCTYPE html>
<html>
<head>
<title>Welcome to test.multipath-tcp.org!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to test.multipath-tcp.org !</h1>
<p>This web server runs Multipath TCP v1</p>
<p><em>Thank you for using Multipath TCP.</em></p>
</body>
</html>
* Connection #0 to host test.multipath-tcp.org left intact
First version of Multipath TCP support in curl, compile with ./configure CPPFLAGS="-DMPTCP"
bagder
left a comment
There was a problem hiding this comment.
Thanks for your contribution. I think this is a future that might get appreciated. I think the PR needs a little more polish though. There is also no docs. I imagine creating tests for this is hard.
| /* Set Multipath TCP */ | ||
| CURLOPT(CURLOPT_TCP_MULTIPATH, CURLOPTTYPE_LONG, 316), | ||
| #endif | ||
|
|
There was a problem hiding this comment.
This is a public header, it cannot use #ifdefs like this. The symbols need to be provided no matter what.
| #endif /* MPTCP */ | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
This block looks like it's there for debugging? Maybe use #ifdef DEBUGBUILD as well?
| Curl_set_in_callback(data, false); | ||
| } | ||
| else | ||
| else |
| #endif | ||
|
|
||
| return CURLE_OK; | ||
|
|
| conn->bits.close = closeit; /* the only place in the source code that | ||
| should assign this bit */ | ||
| } | ||
|
|
| #include <netinet/in.h> /* IPPROTO_TCP */ | ||
| #endif | ||
|
|
||
|
|
| (void)protocol; | ||
|
|
||
| listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | ||
| printf("mptcp\n"); |
|
|
||
| listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | ||
| printf("mptcp\n"); | ||
| listener = socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); |
| #endif | ||
| #endif | ||
|
|
||
|
|
There was a problem hiding this comment.
This is mistake, apologies. Windows does not support MPTCP and nothing needs to be changed in this file
| {"Em", "tlsauthtype", ARG_STRING}, | ||
| #ifdef MPTCP | ||
| {"EM", "multipath", ARG_BOOL}, | ||
| #endif |
There was a problem hiding this comment.
The cmdline options cannot be ifdef'ed like this, as the tool might not know what features the lib was built with.
|
Thanks for your comments, I'm looking at them and will propose an update. I'll propose some documentation. For the tests, I can propose a modification to the http server to enable multipath tcp and then add a few tests. These tests would only work on recent linux kernels. |
|
Additionally: macOS supports multipath TCP as well so it would make sense to provide this feature there was well. Are you still up for working on this PR? |
|
Abandoned. |
|
Looks like someone else has added MTCP to curl (on Windows at least): With the help of wintap and LKL; a Linux Kernel Library. Fascinating stuff. |
Initial support for Multipath TCP for curl. Multipath TCP is a TCP extension defined in RFC8684 that is supported by recent Linux kernels (5.13+). Multipath TCP allows a TCP connection to use different paths (e.g. Wi-Fi and cellular on smartphones, IPv4 and IPv6, ...). Multipath TCP is enabled by default on recent Linux distributions (Debian, Ubuntu, Redhat,...)
This patch provides the --multipath command line option that enables Multipath TCP when set. If running on a kernel that does not support Multipath TCP, curl remembers the fact that Multipath TCP does not work and does not attempt anymore to use Multipath TCP when creating a TCP connection. Another possibility would be to always enable Multipath TCP by default on Linux.
With the patch, curl reports the activation of Multipath TCP when interacting with a Multipath TCP server.
Compile with -DMPTCP to enable Multipath TCP support
First version of Multipath TCP support in curl, compile with ./configure CPPFLAGS="-DMPTCP"