1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 11:01:50 +00:00

Merge pull request #336 from Ysurac/develop

sync
This commit is contained in:
suyuan 2023-08-02 23:22:17 +08:00 committed by GitHub
commit b2fd43aff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 3163 additions and 29 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright (C) 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Copyright (C) 2019-2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -12,8 +12,8 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/golang/protobuf.git
PKG_SOURCE_VERSION:=347cf4a86c1cb8d262994d8ef5924d4576c5b331
PKG_SOURCE_DATE:=20190109
PKG_SOURCE_VERSION:=5d5e8c018a13017f9d5b8bf4fad64aaa42a87308
PKG_SOURCE_DATE:=20210916
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

View file

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iperf
PKG_VERSION:=3.12
PKG_VERSION:=3.14
PKG_RELEASE:=10
PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/esnet/iperf/archive/refs/tags/
PKG_HASH:=e38e0a97b30a97b4355da93467160a20dea10932f6c17473774802e03d61d4a7
PKG_HASH:=bbafa2c9687f0f7fe00947dc779b83c91663911e22460005c0ad4623797b3dbd
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_MAINTAINER:=Yannick Chabanois <ycarus@zugaina.org>
PKG_LICENSE:=BSD-3-Clause
PKG_BUILD_PARALLEL:=1

View file

@ -0,0 +1,208 @@
From 26b066b9d4e92442d55950689dbd9fd101b429a7 Mon Sep 17 00:00:00 2001
From: Paolo Abeni <pabeni@redhat.com>
Date: Mon, 14 Jun 2021 16:13:02 +0200
Subject: [PATCH] Add MPTCP support with the --multipath flag
Also available with the short option '-m'.
The MPTCP protocol is really a TCP variant, so this change
does not implement a new 'struct protocol'. Instead it just
extend the TCP support to optionally enable multipath.
The only required dependency is IPPROTO_MPTCP definition,
which should be provided by the netinet/in.h header.
To keep things simple, just conditionally provide the required
protocol, if the system header does not have it yet
---
src/iperf.h | 1 +
src/iperf3.1 | 4 ++++
src/iperf_api.c | 11 ++++++++++-
src/iperf_locale.c | 1 +
src/iperf_tcp.c | 18 +++++++++++++++---
5 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/src/iperf.h b/src/iperf.h
index 3fc91d0c0..e753df944 100644
--- a/src/iperf.h
+++ b/src/iperf.h
@@ -315,6 +315,7 @@ struct iperf_test
int udp_counters_64bit; /* --use-64-bit-udp-counters */
int forceflush; /* --forceflush - flushing output at every interval */
int multisend;
+ int multipath; /* -m option - multi-path variant */
int repeating_payload; /* --repeating-payload */
int timestamps; /* --timestamps */
char *timestamp_format;
diff --git a/src/iperf3.1 b/src/iperf3.1
index f5eef6eb3..205a8337e 100644
--- a/src/iperf3.1
+++ b/src/iperf3.1
@@ -228,6 +228,10 @@ run in client mode, connecting to the specified server.
By default, a test consists of sending data from the client to the
server, unless the \-R flag is specified.
.TP
+.BR -m ", " --multipath " "
+use multipath variant for the current protocol. This only applies to
+TCP and enables MPTCP usage.
+.TP
.BR --sctp
use SCTP rather than TCP (FreeBSD and Linux)
.TP
diff --git a/src/iperf_api.c b/src/iperf_api.c
index f8f2321ec..bea53e397 100644
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -1007,7 +1007,8 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
{"connect-timeout", required_argument, NULL, OPT_CONNECT_TIMEOUT},
{"idle-timeout", required_argument, NULL, OPT_IDLE_TIMEOUT},
{"rcv-timeout", required_argument, NULL, OPT_RCV_TIMEOUT},
{"snd-timeout", required_argument, NULL, OPT_SND_TIMEOUT},
+ {"multipath", no_argument, NULL, 'm'},
{"debug", optional_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
@@ -1030,7 +1031,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
char *client_username = NULL, *client_rsa_public_key = NULL, *server_rsa_private_key = NULL;
#endif /* HAVE_SSL */
- while ((flag = getopt_long(argc, argv, "p:f:i:D1VJvsc:ub:t:n:k:l:P:Rw:B:M:N46S:L:ZO:F:A:T:C:dI:hX:", longopts, NULL)) != -1) {
+ while ((flag = getopt_long(argc, argv, "p:f:i:D1VJvsc:ub:t:n:k:l:P:Rw:B:mM:N46S:L:ZO:F:A:T:C:dI:hX:", longopts, NULL)) != -1) {
switch (flag) {
case 'p':
portno = atoi(optarg);
@@ -1103,6 +1104,10 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
iperf_set_test_role(test, 'c');
iperf_set_test_server_hostname(test, optarg);
break;
+ case 'm':
+ set_protocol(test, Ptcp);
+ test->multipath = 1;
+ break;
case 'u':
set_protocol(test, Pudp);
client_flag = 1;
@@ -2000,6 +2005,8 @@ send_parameters(struct iperf_test *test)
cJSON_AddTrueToObject(j, "reverse");
if (test->bidirectional)
cJSON_AddTrueToObject(j, "bidirectional");
+ if (test->multipath)
+ cJSON_AddTrueToObject(j, "multipath");
if (test->settings->socket_bufsize)
cJSON_AddNumberToObject(j, "window", test->settings->socket_bufsize);
if (test->settings->blksize)
@@ -2112,6 +2119,8 @@ get_parameters(struct iperf_test *test)
iperf_set_test_reverse(test, 1);
if ((j_p = cJSON_GetObjectItem(j, "bidirectional")) != NULL)
iperf_set_test_bidirectional(test, 1);
+ if ((j_p = cJSON_GetObjectItem(j, "multipath")) != NULL)
+ test->multipath = 1;
if ((j_p = cJSON_GetObjectItem(j, "window")) != NULL)
test->settings->socket_bufsize = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "len")) != NULL)
diff --git a/src/iperf_locale.c b/src/iperf_locale.c
index e1e9dc5b6..a70bd73b9 100644
--- a/src/iperf_locale.c
+++ b/src/iperf_locale.c
@@ -146,6 +146,7 @@ const char usage_longstr[] = "Usage: iperf3 [-s|-c host] [options]\n"
" --nstreams # number of SCTP streams\n"
#endif /* HAVE_SCTP_H */
" -u, --udp use UDP rather than TCP\n"
+ " -m, --multipath use MPTCP rather than plain TCP\n"
" --connect-timeout # timeout for control connection setup (ms)\n"
" -b, --bitrate #[KMG][/#] target bitrate in bits/sec (0 for unlimited)\n"
" (default %d Mbit/sec for UDP, unlimited for TCP)\n"
--- a/src/iperf_tcp.c 2023-07-07 23:47:41.000000000 +0200
+++ b/src/iperf_tcp.c 2023-08-01 14:53:57.832072168 +0200
@@ -44,6 +44,10 @@
#include "net.h"
#include "cjson.h"
+#ifndef IPPROTO_MPTCP
+#define IPPROTO_MPTCP 262
+#endif
+
#if defined(HAVE_FLOWLABEL)
#include "flowlabel.h"
#endif /* HAVE_FLOWLABEL */
@@ -154,6 +158,7 @@
socklen_t optlen;
int saved_errno;
int rcvbuf_actual, sndbuf_actual;
+ int protocol = 0;
s = test->listener;
@@ -166,7 +171,7 @@
*
* It's not clear whether this is a requirement or a convenience.
*/
- if (test->no_delay || test->settings->mss || test->settings->socket_bufsize) {
+ if (test->multipath || test->no_delay || test->settings->mss || test->settings->socket_bufsize) {
struct addrinfo hints, *res;
char portstr[6];
@@ -194,7 +199,10 @@
return -1;
}
- if ((s = socket(res->ai_family, SOCK_STREAM, 0)) < 0) {
+ if (test->multipath)
+ protocol = IPPROTO_MPTCP;
+
+ if ((s = socket(res->ai_family, SOCK_STREAM, protocol)) < 0) {
freeaddrinfo(res);
i_errno = IESTREAMLISTEN;
return -1;
@@ -374,8 +382,12 @@
socklen_t optlen;
int saved_errno;
int rcvbuf_actual, sndbuf_actual;
+ int protocol = 0;
+
+ if (test->multipath)
+ protocol = IPPROTO_MPTCP;
- s = create_socket(test->settings->domain, SOCK_STREAM, test->bind_address, test->bind_dev, test->bind_port, test->server_hostname, test->server_port, &server_res);
+ s = create_socket(test->settings->domain, SOCK_STREAM, test->bind_address, test->bind_dev, test->bind_port, test->server_hostname, test->server_port, &server_res, protocol);
if (s < 0) {
i_errno = IESTREAMCONNECT;
return -1;
--- a/src/net.c 2023-08-01 14:54:14.175802546 +0200
+++ b/src/net.c 2023-08-01 14:54:40.831362812 +0200
@@ -121,7 +121,7 @@
/* create a socket */
int
-create_socket(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, struct addrinfo **server_res_out)
+create_socket(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, struct addrinfo **server_res_out, int protocol)
{
struct addrinfo hints, *local_res = NULL, *server_res = NULL;
int s, saved_errno;
@@ -145,7 +145,7 @@
return -1;
}
- s = socket(server_res->ai_family, proto, 0);
+ s = socket(server_res->ai_family, proto, protocol);
if (s < 0) {
if (local)
freeaddrinfo(local_res);
@@ -235,7 +235,7 @@
struct addrinfo *server_res = NULL;
int s, saved_errno;
- s = create_socket(domain, proto, local, bind_dev, local_port, server, port, &server_res);
+ s = create_socket(domain, proto, local, bind_dev, local_port, server, port, &server_res, 0);
if (s < 0) {
return -1;
}
--- a/src/net.h 2023-08-01 15:01:58.208159540 +0200
+++ b/src/net.h 2023-08-01 15:00:46.521337885 +0200
@@ -28,7 +28,7 @@
#define __NET_H
int timeout_connect(int s, const struct sockaddr *name, socklen_t namelen, int timeout);
-int create_socket(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, struct addrinfo **server_res_out);
+int create_socket(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, struct addrinfo **server_res_out, int protocol);
int netdial(int domain, int proto, const char *local, const char *bind_dev, int local_port, const char *server, int port, int timeout);
int netannounce(int domain, int proto, const char *local, const char *bind_dev, int port);
int Nread(int fd, char *buf, size_t count, int prot);

View file

@ -240,9 +240,6 @@
<div class="cbi-value-description">
<%:Set the default Proxy used for TCP when ShadowSocks is enabled, for TCP and UDP when V2Ray is enabled.%>
<%:Only ShadowSocks is supported with server multiple IPs for now.%>
<% if uname.release:sub(1,4) == "5.15" or uname.release:sub(1,1) == "6" then %>
<br /><b><%:V2Ray doesn't support aggregation on Kernel > 5.4 yet.%></b>
<% end %>
</div>
</div>
</div>

View file

@ -1,21 +1,23 @@
#
# Copyright (C) 2007-2015 OpenWrt.org
# Copyright (C) 2017-2023 Yannick Chabanois <ycarus@zugaina.org> for OpenMPTCProuter
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Original ebuild from Ken Keys <kkeys@caida.org>
# Updated by Yannick Chabanois <ycarus@zugaina.org> for OpenMPTCProuter
include $(TOPDIR)/rules.mk
PKG_NAME:=protobuf
PKG_VERSION:=3.14.0
PKG_VERSION:=3.17.3
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-cpp-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/google/protobuf/releases/download/v$(PKG_VERSION)
PKG_HASH:=50ec5a07c0c55d4ec536dd49021f2e194a26bfdbc531d03d1e9d4d3e27175659
PKG_HASH:=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb
PKG_MAINTAINER:=Ken Keys <kkeys@caida.org>
PKG_MAINTAINER:=Yannick Chabanois <ycarus@zugaina.org>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:google:protobuf

View file

@ -8,9 +8,12 @@ PKG_NAME:=v2ray-core
PKG_VERSION:=5.7.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=599fcd264537e39178b6008a11af68816dfd1609e19a9cf8adc8b2a4240ee370
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
#PKG_HASH:=599fcd264537e39178b6008a11af68816dfd1609e19a9cf8adc8b2a4240ee370
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/v2fly/v2ray-core.git
PKG_SOURCE_VERSION:=d58649764e3afa52234ada9a28b7ae79577a23a9
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

View file

@ -51,6 +51,17 @@ _err() {
_log "err" $@
}
version_over_5_4() {
MAJOR_VERSION=$(uname -r | awk -F '.' '{print $1}')
MINOR_VERSION=$(uname -r | awk -F '.' '{print $2}')
if [ $MAJOR_VERSION -ge 5 ] && [ $MINOR_VERSION -gt 13 ] || [ $MAJOR_VERSION -gt 5 ] ; then
return 0
else
return 1
fi
}
get_value_from_json() {
local json="$1"
local key="$2"
@ -1295,6 +1306,9 @@ add_inbound_setting() {
test -n "$ss_sockopt_tproxy" && \
json_add_string "tproxy" "$ss_sockopt_tproxy"
# fi
if version_over_5_4; then
json_add_boolean "mptcp" "1"
fi
json_close_object # sockopt
@ -1944,16 +1958,6 @@ clear_transparent_proxy() {
fi
}
version_over_5_4() {
MAJOR_VERSION=$(uname -r | awk -F '.' '{print $1}')
MINOR_VERSION=$(uname -r | awk -F '.' '{print $2}')
if [ $MAJOR_VERSION -ge 5 ] && [ $MINOR_VERSION -gt 13 ] || [ $MAJOR_VERSION -gt 5 ] ; then
return 0
else
return 1
fi
}
start_instance() {
local section="$1"
@ -2068,9 +2072,6 @@ start_instance() {
PROG="$NAME.$section"
TRANSPARENT_PROXY_EXPECTED=1
if version_over_5_4; then
PROG="mptcpize run ${PROG}"
fi
procd_open_instance "$PROG"
procd_set_param command "$v2ray_file"
procd_append_param command run

File diff suppressed because it is too large Load diff