-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,6 +286,12 @@ AC_ARG_WITH( | |
[with_openssl_engine="auto"] | ||
) | ||
|
||
AC_ARG_WITH(mptcp, | ||
[AS_HELP_STRING([--without-mptcp],[Disable Multipath TCP support])], | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
[enable_mptcp=no], | ||
This comment has been minimized.
Sorry, something went wrong. |
||
[enable_mptcp=yes] | ||
) | ||
|
||
AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@]) | ||
if test -n "${PLUGINDIR}"; then | ||
plugindir="${PLUGINDIR}" | ||
|
@@ -820,6 +826,46 @@ case "$host" in | |
esac | ||
|
||
|
||
dnl | ||
dnl Checking Multipath TCP support on Linux | ||
dnl | ||
case "$host" in | ||
*-*-linux*) | ||
AC_MSG_CHECKING([Multipath TCP support ]) | ||
AS_IF([test "x$enable_mptcp" != xno], | ||
[AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <sys/types.h> | ||
#include <sys/socket.h> | ||
#ifndef IPPROTO_MPTCP | ||
#define IPPROTO_MPTCP 262 | ||
#endif | ||
int x=0; | ||
]], | ||
[[ | ||
int s= socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); | ||
if(s!=-1) | ||
{ | ||
close(s); | ||
return(0); | ||
} | ||
else | ||
{ | ||
return(-1); | ||
} | ||
]] | ||
) ], | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
[AC_DEFINE([ENABLE_MPTCP], [1], | ||
[AC_MSG_RESULT([Multipath TCP is enabled on this system])] )], | ||
[ AC_MSG_RESULT([Multipath TCP is not enabled. On Linux, you need a kernel >= 5.15 and ensure that sysctl.net.mptcp_enabled is set to 1]) ], | ||
) | ||
]) | ||
;; | ||
esac | ||
|
||
|
||
|
||
if test "${with_crypto_library}" = "openssl"; then | ||
AC_ARG_VAR([OPENSSL_CFLAGS], [C compiler flags for OpenSSL]) | ||
AC_ARG_VAR([OPENSSL_LIBS], [linker flags for OpenSSL]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,9 @@ static const char usage_message[] = | |
" udp6, tcp6-server, tcp6-client\n" | ||
"--proto-force p : only consider protocol p in list of connection profiles.\n" | ||
" p = udp or tcp\n" | ||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
"--multipath : Enable Multipath TCP on the TCP connections.\n" | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
#endif | ||
This comment has been minimized.
Sorry, something went wrong. |
||
"--connect-retry n [m] : For client, number of seconds to wait between\n" | ||
" connection retries (default=%d). On repeated retries\n" | ||
" the wait time is exponentially increased to a maximum of m\n" | ||
|
@@ -903,6 +906,11 @@ init_options(struct options *o, const bool init_gc) | |
} | ||
#endif /* _WIN32 */ | ||
o->allow_recursive_routing = false; | ||
|
||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
o->enable_multipath = false; | ||
#endif | ||
|
||
} | ||
|
||
void | ||
|
@@ -9285,6 +9293,18 @@ add_option(struct options *options, | |
goto err; | ||
} | ||
} | ||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
else if (streq(p[0], "multipath")) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
VERIFY_PERMISSION(OPT_P_GENERAL); | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
if (p[1]) | ||
{ | ||
msg(msglevel, "--multipath does not accept any parameters"); | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
goto err; | ||
} | ||
options->enable_multipath = true; | ||
} | ||
#endif | ||
else | ||
{ | ||
int i; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,6 +448,9 @@ struct options | |
#define SF_NO_PUSH_ROUTE_GATEWAY (1<<2) | ||
unsigned int server_flags; | ||
|
||
#ifdef ENABLE_MPTCP | ||
bool enable_multipath; | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
#endif | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
bool server_bridge_proxy_dhcp; | ||
|
||
bool server_bridge_defined; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,14 @@ | |
|
||
#include "memdbg.h" | ||
|
||
|
||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
#ifndef IPPROTO_MPTCP | ||
This comment has been minimized.
Sorry, something went wrong. |
||
#define IPPROTO_MPTCP 262 | ||
#endif | ||
#endif | ||
|
||
|
||
struct port_share *port_share = NULL; /* GLOBAL */ | ||
|
||
/* size of i/o buffers */ | ||
|
@@ -427,7 +435,11 @@ proxy_entry_new(struct proxy_connection **list, | |
struct proxy_connection *cp; | ||
|
||
/* connect to port share server */ | ||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
if ((sd_server = socket(PF_INET, SOCK_STREAM, IPPROTO_MPTCP)) < 0) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
#else | ||
if ((sd_server = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) | ||
#endif | ||
{ | ||
msg(M_WARN|M_ERRNO, "PORT SHARE PROXY: cannot create socket"); | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,12 @@ | |
|
||
#include "memdbg.h" | ||
|
||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
#ifndef IPPROTO_MPTCP | ||
#define IPPROTO_MPTCP 262 | ||
#endif | ||
#endif | ||
|
||
/* | ||
* Convert sockflags/getaddr_flags into getaddr_flags | ||
*/ | ||
|
@@ -1082,6 +1088,39 @@ create_socket_udp(struct addrinfo *addrinfo, const unsigned int flags) | |
return sd; | ||
} | ||
|
||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
socket_descriptor_t | ||
create_socket_mptcp(struct addrinfo *addrinfo) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
socket_descriptor_t sd; | ||
|
||
ASSERT(addrinfo); | ||
ASSERT(addrinfo->ai_socktype == SOCK_STREAM); | ||
addrinfo->ai_protocol = IPPROTO_MPTCP; | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
if ((sd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) < 0) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
{ | ||
msg(M_ERR, "Cannot create MPTCP socket"); | ||
} | ||
|
||
{ | ||
int on = 1; | ||
if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, | ||
(void *) &on, sizeof(on)) < 0) | ||
{ | ||
msg(M_ERR, "TCP: Cannot setsockopt SO_REUSEADDR on TCP socket"); | ||
} | ||
} | ||
|
||
/* set socket file descriptor to not pass across execs, so that | ||
* scripts don't have access to it */ | ||
set_cloexec(sd); | ||
|
||
return sd; | ||
} | ||
|
||
#endif | ||
|
||
|
||
static void | ||
bind_local(struct link_socket *sock, const sa_family_t ai_family) | ||
{ | ||
|
@@ -1125,6 +1164,21 @@ create_socket(struct link_socket *sock, struct addrinfo *addr) | |
} | ||
else if (addr->ai_protocol == IPPROTO_TCP || addr->ai_socktype == SOCK_STREAM) | ||
{ | ||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
if(sock->info.multipath) | ||
{ | ||
sock->sd = create_socket_mptcp(addr); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
// Multipath TCP could fail because it is not enabled on this host | ||
// Try regular TCP | ||
if(sock->sd == -1) | ||
{ | ||
|
||
msg(M_NONFATAL, "Can't resolve MPTCP socket, fallback to TCP !"); | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
sock->sd = create_socket_tcp(addr); | ||
} | ||
} | ||
else | ||
#endif | ||
sock->sd = create_socket_tcp(addr); | ||
} | ||
else | ||
|
@@ -1849,7 +1903,11 @@ link_socket_init_phase1(struct context *c, int mode) | |
sock->bind_local = o->ce.bind_local; | ||
sock->resolve_retry_seconds = o->resolve_retry_seconds; | ||
sock->mtu_discover_type = o->ce.mtu_discover_type; | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
|
||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
sock->info.multipath = o->enable_multipath; | ||
#endif | ||
|
||
#ifdef ENABLE_DEBUG | ||
sock->gremlin = o->gremlin; | ||
#endif | ||
|
@@ -2208,7 +2266,7 @@ link_socket_init_phase2(struct context *c) | |
else | ||
#endif | ||
{ | ||
create_socket(sock, sock->info.lsa->current_remote); | ||
create_socket(sock, sock->info.lsa->current_remote); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,9 @@ struct link_socket_info | |
bool bind_ipv6_only; | ||
int mtu_changed; /* Set to true when mtu value is changed */ | ||
bool dco_installed; | ||
#if defined(TARGET_LINUX) && defined(ENABLE_MPTCP) | ||
This comment has been minimized.
Sorry, something went wrong.
matttbe
|
||
bool multipath; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
#endif | ||
}; | ||
|
||
/* | ||
|
@@ -469,6 +472,10 @@ bool ipv6_addr_safe(const char *ipv6_text_addr); | |
|
||
socket_descriptor_t create_socket_tcp(struct addrinfo *); | ||
|
||
#ifdef ENABLE_MPTCP | ||
socket_descriptor_t create_socket_mptcp(struct addrinfo *); | ||
#endif | ||
|
||
socket_descriptor_t socket_do_accept(socket_descriptor_t sd, | ||
struct link_socket_actual *act, | ||
const bool nowait); | ||
|
7 comments
on commit a0ca7a0
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.
@obonaventure : regarding the commit message, it is often very important to document a maximum of things there: why you are doing that, what is MPTCP, why you did it like that, questions you had, possible alternatives, etc. Without this useful description, patches might simply not be reviewed if it is the reviewer that has to guess all of that.
Also, regarding the other commits in the project, it might be useful to add a prefix (option:
, socket:
?)
And a Signed-off-by
tag.
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.
also, I don't know if they have unit tests, changelog and doc to update as well
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.
@matttbe @obonaventure what's the status of this effort? MPTCP support in OpenVPN would be extremely useful.
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.
@arinc9 I agree that it would be useful, but it looks like we need someone to continue the work from where it was here.
Do you think you could apply the review, rebase on top of the latest version of OpenVPN, run the tests, and suggest that to the OpenVPN devs?
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'll see what I can do.
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've rebased this patch to the master branch and replicated your review here arinc9#1. I will start addressing them.
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've rebased this patch to the master branch and replicated your review here arinc9#1. I will start addressing them.
Thanks!
Do not hesitate to ping me if you need a review! (I don't know the OpenVPN project, and I don't remember what I said here in review, but I can see what I can do).
Also, don't miss these comments from here above:
regarding the commit message, it is often very important to document a maximum of things there: why you are doing that, what is MPTCP, why you did it like that, questions you had, possible alternatives, etc. Without this useful description, patches might simply not be reviewed if it is the reviewer that has to guess all of that.
Also, regarding the other commits in the project, it might be useful to add a prefix (option:, socket:?)
And a Signed-off-by tag.
also, I don't know if they have unit tests, changelog and doc to update as well
For the commit message, don't hesitate to get some inspiration from recent changes adding native MPTCP support in apps, e.g. curl/curl@ab6d544 and systemd/systemd@3f69070
It looks like they prefer to use
--disable-xxx
, instead of--without-xxx
.Please add a space after the comma:
mptcp], [Disable