New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
functional option MPTCP with --mptcp #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks god, just some various things
docs/cmdline-opts/mptcp.md
Outdated
Category: connection | ||
Multi: boolean | ||
See-also: | ||
- tcp-fastopen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what else we can give, maybe request
?
We can also wait for advices from the maintainers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add in the PR description, something like:
Attention points:
- This PR replaces #9713.
- Sorry for #13161, I accidentally opened it while the code was not ready yet, my bad.
- Regarding the documentation, we didn't find a good reference (`See-also`). We put `tcp-fastopen` because we had to put something, but we are happy to change.
- It is not clear for us if a test is worth it. According to your comments from #9713, it might not be worth it. We successfully tested it with http://test.multipath-tcp.org:5000 .
docs/cmdline-opts/mptcp.md
Outdated
|
||
## Availability | ||
|
||
The `--mptcp` option is available starting from `curl` version 8.6.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8.7.0
docs/cmdline-opts/mptcp.md
Outdated
|
||
## Requirements | ||
|
||
- Your operating system must support MPTCP, and it must be enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to add:
Currently, this feature is only supported on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature is currently only supported on Linux starting from kernel 5.6. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea!
This feature is currently only supported on Linux 5.6 or later.
docs/cmdline-opts/mptcp.md
Outdated
## Requirements | ||
|
||
- Your operating system must support MPTCP, and it must be enabled. | ||
- The server you are connecting to must also support MPTCP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to add:
If not, the connection will fallback to TCP.
docs/libcurl/opts/CURLOPT_MPTCP.md
Outdated
to be used simultaneously by a single TCP connection, enhancing redundancy, | ||
bandwidth, and potentially reducing latency. | ||
It works by presenting a standard TCP interface to applications while | ||
managing multiple underlying TCP connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe best to use the same paragraph here as well
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 Wi-Fi and cellular data or in wired networks with multiple ISPs.
For the paragraph above and below. You can keep the note
lib/cf-socket.c
Outdated
} | ||
#ifdef __linux__ | ||
if (data->set.mptcp) { | ||
transport = TRNSPRT_MPTCP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is not aligned properly: should be indented by 2 spaces, not 3
(I know it looks like details, but consistency is important, maybe they use "beautifier" tools like uncrustify, and you don't want to cause unwanted changes, and you don't want such comments during the review)
lib/cf-socket.h
Outdated
@@ -28,6 +28,10 @@ | |||
#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */ | |||
#include "sockaddr.h" | |||
|
|||
#ifndef IPPROTO_MPTCP | |||
#define IPPROTO_MPTCP 262 | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe best to move this to lib/cf-socket.c
, at the top (? or just above where you use it?), it is only used in this file, in a single place.
lib/setopt.c
Outdated
@@ -2931,6 +2931,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) | |||
result = CURLE_NOT_BUILT_IN; | |||
#endif | |||
break; | |||
case CURLOPT_MPTCP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: only one space after case
lib/urldata.h
Outdated
@@ -1811,6 +1812,7 @@ struct UserDefined { | |||
#ifdef USE_WEBSOCKETS | |||
BIT(ws_raw_mode); | |||
#endif | |||
bool mptcp; /* enable MPTCP support */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to use BIT(mptcp);
like the other ones above. (you only need 1 bit)
src/tool_cfgable.h
Outdated
@@ -298,6 +298,7 @@ struct OperationConfig { | |||
struct State state; /* for create_transfer() */ | |||
bool rm_partial; /* on error, remove partially written output | |||
files */ | |||
bool mptcp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add /* enable MPTCP support */
(even if it is a bit obvious...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the update. Don't forget to update the commit message.
Feel free to also update the PR description with the additional notes we prepare, so you just have to copy-paste when the PR will be opened later
lib/cf-socket.c
Outdated
@@ -1601,7 +1605,15 @@ CURLcode Curl_cf_tcp_create(struct Curl_cfilter **pcf, | |||
if(!ctx) { | |||
result = CURLE_OUT_OF_MEMORY; | |||
goto out; | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwanted change
lib/cf-socket.c
Outdated
#endif | ||
|
||
#ifdef __linux__ | ||
if(data->set.mptcp) transport = TRNSPRT_MPTCP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put transport = ...
at the next line?
if(data->set.mptcp)
transport = TRNSPRT_MPTCP;
lib/cf-socket.c
Outdated
@@ -244,6 +244,10 @@ void Curl_sock_assign_addr(struct Curl_sockaddr_ex *dest, | |||
dest->socktype = SOCK_STREAM; | |||
dest->protocol = IPPROTO_IP; | |||
break; | |||
case TRNSPRT_MPTCP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move
#ifndef IPPROTO_MPTCP
#define IPPROTO_MPTCP 262
#endif
here?
(or just after the declaration of the function?)
lib/cf-socket.h
Outdated
@@ -28,6 +28,7 @@ | |||
#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */ | |||
#include "sockaddr.h" | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwanted change
Don't forget the auto-review ;)
src/tool_cfgable.h
Outdated
@@ -298,6 +298,7 @@ struct OperationConfig { | |||
struct State state; /* for create_transfer() */ | |||
bool rm_partial; /* on error, remove partially written output | |||
files */ | |||
bool mptcp; /* enable MPTCP support */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get their code style here, maybe best to align the comment with the one above?
bool rm_partial; /* on error, remove partially written output
files */
bool mptcp; /* enable MPTCP support */
lib/cf-socket.c
Outdated
@@ -244,6 +244,13 @@ void Curl_sock_assign_addr(struct Curl_sockaddr_ex *dest, | |||
dest->socktype = SOCK_STREAM; | |||
dest->protocol = IPPROTO_IP; | |||
break; | |||
#ifndef IPPROTO_MPTCP | |||
#define IPPROTO_MPTCP 262 | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, it was not clear: just below case TRNSPRT_MPTCP:
lib/cf-socket.c
Outdated
@@ -1602,6 +1609,11 @@ CURLcode Curl_cf_tcp_create(struct Curl_cfilter **pcf, | |||
result = CURLE_OUT_OF_MEMORY; | |||
goto out; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detail, just to be consistent with the rest of the code: either also add a new line after #endif
or no new line here.
8b8e5a2
to
a4dc03c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last batch of modifications needed and then we will be good.
.github/scripts/spellcheck.words
Outdated
@@ -484,6 +484,7 @@ Monnerat | |||
monospace | |||
MorphOS | |||
MPE | |||
MPTCP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be placed after MPL
to respect the alphabetical order.
docs/cmdline-opts/mptcp.md
Outdated
|
||
- This feature is currently only supported on Linux starting from kernel 5.6. | ||
- The server you are connecting to must also support MPTCP. | ||
If not, the connection falls back to TCP.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an extra dot .
at the end here.
While at it, maybe good to add "seamlessly" and this line could be partially moved to the previous one, as long as you keep the 80 char limit:
- The server you are connecting to must also support MPTCP. If not, the
connection will seamlessly fall back to TCP.
docs/cmdline-opts/mptcp.md
Outdated
|
||
## Usage | ||
|
||
To use MPTCP for your connections, add the `--mptcp` option when using `curl`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the :
at the end suggests something is missing. Maybe you just want to replace it with a .
?
.github/scripts/spellcheck.words
Outdated
@@ -484,6 +484,7 @@ Monnerat | |||
monospace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the commit message (not related to this here), I think you can remove:
An HTTP test server indicating whether MPTCP (Multipath TCP) is utilized
is now available at the following address: http://test.multipath-tcp.org:5000/.
But place it in the PR description: the service might not be available after the PR, maybe best not to keep this in the Git history.
docs/cmdline-opts/mptcp.md
Outdated
Category: connection | ||
Multi: boolean | ||
See-also: | ||
- tcp-fastopen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add in the PR description, something like:
Attention points:
- This PR replaces #9713.
- Sorry for #13161, I accidentally opened it while the code was not ready yet, my bad.
- Regarding the documentation, we didn't find a good reference (`See-also`). We put `tcp-fastopen` because we had to put something, but we are happy to change.
- It is not clear for us if a test is worth it. According to your comments from #9713, it might not be worth it. We successfully tested it with http://test.multipath-tcp.org:5000 .
docs/libcurl/opts/CURLOPT_MPTCP.md
Outdated
infrastructure. Some networks might drop unknown MPTCP, (...), and its | ||
effectiveness varies based on the network configuration and conditions. | ||
If MPTCP is not supported by the network or the end server, | ||
the connection falls back to TCP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the other doc:
the connection will seamlessly fall back to TCP.
lib/cf-socket.c
Outdated
|
||
#ifdef __linux__ | ||
if(data->set.mptcp) | ||
transport = TRNSPRT_MPTCP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the "Attention points" of the PR (see my previous comment above), maybe good to add:
- The `transport` is changed to `TRNSPRT_MPTCP` in `Curl_cf_tcp_create()`, not to change the logic before ("happy eyeballs", etc.), and because this feature is an extension to TCP, and it should only modify TCP connections. We are happy to change that if there is a better way.
src/tool_cfgable.c
Outdated
@@ -45,6 +45,7 @@ void config_init(struct OperationConfig *config) | |||
config->http09_allowed = FALSE; | |||
config->ftp_skip_ip = TRUE; | |||
config->file_clobber_mode = CLOBBER_DEFAULT; | |||
config->mptcp = FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be needed, because of the memset(config, 0, sizeof(struct OperationConfig));
Also, see my comment in struct OperationConfig
src/tool_cfgable.h
Outdated
@@ -298,6 +298,7 @@ struct OperationConfig { | |||
struct State state; /* for create_transfer() */ | |||
bool rm_partial; /* on error, remove partially written output | |||
files */ | |||
bool mptcp; /* enable MPTCP support */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this a bit above, just between file_clobber_mode;
and struct GlobalConfig *global;
.
Because struct OperationConfig *next; /* Always last in the struct */
just above
src/tool_cfgable.h
Outdated
@@ -298,6 +298,7 @@ struct OperationConfig { | |||
struct State state; /* for create_transfer() */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the PR's attention point:
- In the declaration of `struct OperationConfig` in `src/tool_cfgable.h`, the `struct OperationConfig *next;` item has this comment next to it: `/* Always last in the struct */`, but it is no longer the last item in the structure. Is it normal?
docs/libcurl/opts/CURLOPT_MPTCP.md
Outdated
infrastructure. Some networks might drop unknown MPTCP, and its | ||
effectiveness varies based on the network configuration and conditions. | ||
If MPTCP is not supported by the network or the end server, | ||
the connection will seamlessly fall back to TCP.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the extra .
is back
7bdb349
to
9a7791f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks OK to me, good work!
b9e1917
to
988d7a8
Compare
f8ed5f9
to
0906bf9
Compare
An HTTP test server indicating whether MPTCP (Multipath TCP) is utilized is now available at the following address: http://test.multipath-tcp.org:5000/.
Attention points:
See-also
). We puttcp-fastopen
because we had to put something, but we are happy to change.transport
is changed toTRNSPRT_MPTCP
inCurl_cf_tcp_create()
, not to change the logic before ("happy eyeballs", etc.), and because this feature is an extension to TCP, and it should only modify TCP connections. We are happy to change that if there is a better way.struct OperationConfig
insrc/tool_cfgable.h
, thestruct OperationConfig *next;
item has this comment next to it:/* Always last in the struct */
, but it is no longer the last item in the structure. Is it normal?