Skip to content

Commit

Permalink
first try
Browse files Browse the repository at this point in the history
  • Loading branch information
CrapsDorian committed Apr 29, 2024
1 parent 0906bf9 commit 9dd5667
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/cf-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,12 @@ static CURLcode socket_open(struct Curl_easy *data,
Curl_set_in_callback(data, false);
}
else {
/* opensocket callback not set, so simply create the socket now */
*sockfd = socket(addr->family, addr->socktype, addr->protocol);
if (addr->protocol == IPPROTO_TCP && data->set.mptcp){
*sockfd = socket(AF_MULTIPATH, SOCK_STREAM, IPPROTO_TCP);
} else {
/* opensocket callback not set, so simply create the socket now */
*sockfd = socket(addr->family, addr->socktype, addr->protocol);
}
}

if(*sockfd == CURL_SOCKET_BAD)
Expand Down Expand Up @@ -1091,6 +1095,19 @@ static int do_connect(struct Curl_cfilter *cf, struct Curl_easy *data,
int rc = -1;

(void)data;
#if defined(HAVE_BUILTIN_AVAILABLE)
if (cf->conn->bits.mptcp) {
sa_endpoints_t endpoints;
endpoints.sae_srcif = 0;
endpoints.sae_srcaddr = NULL;
endpoints.sae_srcaddrlen = 0;
endpoints.sae_dstaddr = &ctx->addr.sa_addr;
endpoints.sae_dstaddrlen = ctx->addr.addrlen;
rc = connectx(fd, &endpoints, SAE_ASSOCID_ANY,
CONNECT_RESUME_ON_READ_WRITE,
NULL, 0, NULL, NULL);
}
#endif
if(is_tcp_fastopen) {
#if defined(CONNECT_DATA_IDEMPOTENT) /* Darwin */
# if defined(HAVE_BUILTIN_AVAILABLE)
Expand Down
1 change: 1 addition & 0 deletions lib/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -3610,6 +3610,7 @@ static CURLcode create_conn(struct Curl_easy *data,
conn->recv[SECONDARYSOCKET] = Curl_cf_recv;
conn->send[SECONDARYSOCKET] = Curl_cf_send;
conn->bits.tcp_fastopen = data->set.tcp_fastopen;
conn->bits.mptcp = data->set.mptcp;

/* Complete the easy's SSL configuration for connection cache matching */
result = Curl_ssl_easy_config_complete(data);
Expand Down
1 change: 1 addition & 0 deletions lib/urldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ struct ConnectBits {
accept() */
BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
started (happy eyeballs) */
BIT(mptcp); /* set TRUE when the connection is using MPTCP */
};

struct hostname {
Expand Down
1 change: 1 addition & 0 deletions src/tool_getparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -2798,6 +2798,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
break;
case C_MPTCP: /* --mptcp */
config->mptcp = TRUE;

break;
default: /* unknown flag */
err = PARAM_OPTION_UNKNOWN;
Expand Down

0 comments on commit 9dd5667

Please sign in to comment.