|
|
d5a8e7 |
From 0ccd2dbb3eca44a892a183db8c2e4221488ecf51 Mon Sep 17 00:00:00 2001
|
|
|
d5a8e7 |
Message-Id: <0ccd2dbb3eca44a892a183db8c2e4221488ecf51.1628790091.git.aclaudi@redhat.com>
|
|
|
d5a8e7 |
In-Reply-To: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
d5a8e7 |
References: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
d5a8e7 |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
d5a8e7 |
Date: Mon, 9 Aug 2021 15:18:11 +0200
|
|
|
d5a8e7 |
Subject: [PATCH] mptcp: add support for port based endpoint
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1984733
|
|
|
d5a8e7 |
Upstream Status: iproute2.git commit 42fbca91
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
commit 42fbca91cd616ae714c3f6aa2d4e2c3399498e38
|
|
|
d5a8e7 |
Author: Paolo Abeni <pabeni@redhat.com>
|
|
|
d5a8e7 |
Date: Fri Feb 19 21:42:55 2021 +0100
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
mptcp: add support for port based endpoint
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
The feature is supported by the kernel since 5.11-net-next,
|
|
|
d5a8e7 |
let's allow user-space to use it.
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
Just parse and dump an additional, per endpoint, u16 attribute
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
|
d5a8e7 |
Signed-off-by: David Ahern <dsahern@kernel.org>
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
|
|
|
d5a8e7 |
---
|
|
|
d5a8e7 |
ip/ipmptcp.c | 16 ++++++++++++++--
|
|
|
d5a8e7 |
man/man8/ip-mptcp.8 | 8 ++++++++
|
|
|
d5a8e7 |
2 files changed, 22 insertions(+), 2 deletions(-)
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
|
|
|
d5a8e7 |
index e1ffafb3..5f659b59 100644
|
|
|
d5a8e7 |
--- a/ip/ipmptcp.c
|
|
|
d5a8e7 |
+++ b/ip/ipmptcp.c
|
|
|
d5a8e7 |
@@ -17,7 +17,7 @@ static void usage(void)
|
|
|
d5a8e7 |
{
|
|
|
d5a8e7 |
fprintf(stderr,
|
|
|
d5a8e7 |
"Usage: ip mptcp endpoint add ADDRESS [ dev NAME ] [ id ID ]\n"
|
|
|
d5a8e7 |
- " [ FLAG-LIST ]\n"
|
|
|
d5a8e7 |
+ " [ port NR ] [ FLAG-LIST ]\n"
|
|
|
d5a8e7 |
" ip mptcp endpoint delete id ID\n"
|
|
|
d5a8e7 |
" ip mptcp endpoint show [ id ID ]\n"
|
|
|
d5a8e7 |
" ip mptcp endpoint flush\n"
|
|
|
d5a8e7 |
@@ -97,6 +97,7 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
|
|
d5a8e7 |
bool id_set = false;
|
|
|
d5a8e7 |
__u32 index = 0;
|
|
|
d5a8e7 |
__u32 flags = 0;
|
|
|
d5a8e7 |
+ __u16 port = 0;
|
|
|
d5a8e7 |
__u8 id = 0;
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
ll_init_map(&rth);
|
|
|
d5a8e7 |
@@ -123,6 +124,10 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
|
|
d5a8e7 |
if (!index)
|
|
|
d5a8e7 |
invarg("device does not exist\n", ifname);
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
+ } else if (matches(*argv, "port") == 0) {
|
|
|
d5a8e7 |
+ NEXT_ARG();
|
|
|
d5a8e7 |
+ if (get_u16(&port, *argv, 0))
|
|
|
d5a8e7 |
+ invarg("expected port", *argv);
|
|
|
d5a8e7 |
} else if (get_addr(&address, *argv, AF_UNSPEC) == 0) {
|
|
|
d5a8e7 |
addr_set = true;
|
|
|
d5a8e7 |
} else {
|
|
|
d5a8e7 |
@@ -145,6 +150,8 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
|
|
d5a8e7 |
addattr32(n, MPTCP_BUFLEN, MPTCP_PM_ADDR_ATTR_FLAGS, flags);
|
|
|
d5a8e7 |
if (index)
|
|
|
d5a8e7 |
addattr32(n, MPTCP_BUFLEN, MPTCP_PM_ADDR_ATTR_IF_IDX, index);
|
|
|
d5a8e7 |
+ if (port)
|
|
|
d5a8e7 |
+ addattr16(n, MPTCP_BUFLEN, MPTCP_PM_ADDR_ATTR_PORT, port);
|
|
|
d5a8e7 |
if (addr_set) {
|
|
|
d5a8e7 |
int type;
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
@@ -181,8 +188,8 @@ static int print_mptcp_addrinfo(struct rtattr *addrinfo)
|
|
|
d5a8e7 |
__u8 family = AF_UNSPEC, addr_attr_type;
|
|
|
d5a8e7 |
const char *ifname;
|
|
|
d5a8e7 |
unsigned int flags;
|
|
|
d5a8e7 |
+ __u16 id, port;
|
|
|
d5a8e7 |
int index;
|
|
|
d5a8e7 |
- __u16 id;
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
parse_rtattr_nested(tb, MPTCP_PM_ADDR_ATTR_MAX, addrinfo);
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
@@ -196,6 +203,11 @@ static int print_mptcp_addrinfo(struct rtattr *addrinfo)
|
|
|
d5a8e7 |
print_string(PRINT_ANY, "address", "%s ",
|
|
|
d5a8e7 |
format_host_rta(family, tb[addr_attr_type]));
|
|
|
d5a8e7 |
}
|
|
|
d5a8e7 |
+ if (tb[MPTCP_PM_ADDR_ATTR_PORT]) {
|
|
|
d5a8e7 |
+ port = rta_getattr_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]);
|
|
|
d5a8e7 |
+ if (port)
|
|
|
d5a8e7 |
+ print_uint(PRINT_ANY, "port", "port %u ", port);
|
|
|
d5a8e7 |
+ }
|
|
|
d5a8e7 |
if (tb[MPTCP_PM_ADDR_ATTR_ID]) {
|
|
|
d5a8e7 |
id = rta_getattr_u8(tb[MPTCP_PM_ADDR_ATTR_ID]);
|
|
|
d5a8e7 |
print_uint(PRINT_ANY, "id", "id %u ", id);
|
|
|
d5a8e7 |
diff --git a/man/man8/ip-mptcp.8 b/man/man8/ip-mptcp.8
|
|
|
d5a8e7 |
index ef8409ea..98cb93b9 100644
|
|
|
d5a8e7 |
--- a/man/man8/ip-mptcp.8
|
|
|
d5a8e7 |
+++ b/man/man8/ip-mptcp.8
|
|
|
d5a8e7 |
@@ -20,6 +20,8 @@ ip-mptcp \- MPTCP path manager configuration
|
|
|
d5a8e7 |
.ti -8
|
|
|
d5a8e7 |
.BR "ip mptcp endpoint add "
|
|
|
d5a8e7 |
.IR IFADDR
|
|
|
d5a8e7 |
+.RB "[ " port
|
|
|
d5a8e7 |
+.IR PORT " ]"
|
|
|
d5a8e7 |
.RB "[ " dev
|
|
|
d5a8e7 |
.IR IFNAME " ]"
|
|
|
d5a8e7 |
.RB "[ " id
|
|
|
d5a8e7 |
@@ -87,6 +89,12 @@ ip mptcp endpoint flush flush all existing MPTCP endpoints
|
|
|
d5a8e7 |
.TE
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
.TP
|
|
|
d5a8e7 |
+.IR PORT
|
|
|
d5a8e7 |
+When a port number is specified, incoming MPTCP subflows for already
|
|
|
d5a8e7 |
+established MPTCP sockets will be accepted on the specified port, regardless
|
|
|
d5a8e7 |
+the original listener port accepting the first MPTCP subflow and/or
|
|
|
d5a8e7 |
+this peer being actually on the client side.
|
|
|
d5a8e7 |
+
|
|
|
d5a8e7 |
.IR ID
|
|
|
d5a8e7 |
is a unique numeric identifier for the given endpoint
|
|
|
d5a8e7 |
|
|
|
d5a8e7 |
--
|
|
|
d5a8e7 |
2.31.1
|
|
|
d5a8e7 |
|