Skip to content
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

Closed
wants to merge 0 commits into from
Closed

functional option MPTCP with --mptcp #2

wants to merge 0 commits into from

Conversation

CrapsDorian
Copy link
Owner

@CrapsDorian CrapsDorian commented Mar 21, 2024

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:

  • This PR replaces First version of Multipath TCP support in curl curl/curl#9713.
  • Sorry for functional option MPTCP with --mptcp curl/curl#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 First version of Multipath TCP support in curl curl/curl#9713, it might not be worth it. We successfully tested it with http://test.multipath-tcp.org:5000 .
  • 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.
  • 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?

Copy link
Collaborator

@matttbe matttbe left a 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

Category: connection
Multi: boolean
See-also:
- tcp-fastopen
Copy link
Collaborator

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

Copy link
Collaborator

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 .


## Availability

The `--mptcp` option is available starting from `curl` version 8.6.1.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.7.0


## Requirements

- Your operating system must support MPTCP, and it must be enabled.
Copy link
Collaborator

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.

Copy link
Owner Author

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. ?

Copy link
Collaborator

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.

## Requirements

- Your operating system must support MPTCP, and it must be enabled.
- The server you are connecting to must also support MPTCP.
Copy link
Collaborator

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.

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.
Copy link
Collaborator

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;
Copy link
Collaborator

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
Copy link
Collaborator

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:
Copy link
Collaborator

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 */
Copy link
Collaborator

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)

@@ -298,6 +298,7 @@ struct OperationConfig {
struct State state; /* for create_transfer() */
bool rm_partial; /* on error, remove partially written output
files */
bool mptcp;
Copy link
Collaborator

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...)

Copy link
Collaborator

@matttbe matttbe left a 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;
}
}
Copy link
Collaborator

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;
Copy link
Collaborator

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:
Copy link
Collaborator

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"


Copy link
Collaborator

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 ;)

@@ -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 */
Copy link
Collaborator

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
Copy link
Collaborator

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;
}

Copy link
Collaborator

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.

Copy link
Collaborator

@matttbe matttbe left a 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.

@@ -484,6 +484,7 @@ Monnerat
monospace
MorphOS
MPE
MPTCP
Copy link
Collaborator

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.


- 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..
Copy link
Collaborator

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.


## Usage

To use MPTCP for your connections, add the `--mptcp` option when using `curl`:
Copy link
Collaborator

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 .?

@@ -484,6 +484,7 @@ Monnerat
monospace
Copy link
Collaborator

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.

Category: connection
Multi: boolean
See-also:
- tcp-fastopen
Copy link
Collaborator

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 .

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.
Copy link
Collaborator

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;
Copy link
Collaborator

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.

@@ -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;
Copy link
Collaborator

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

@@ -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 */
Copy link
Collaborator

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

@@ -298,6 +298,7 @@ struct OperationConfig {
struct State state; /* for create_transfer() */
Copy link
Collaborator

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?

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..
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the extra . is back

Copy link
Collaborator

@matttbe matttbe left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants