iproute: mptcp support
Paolo Abeni
v3 cover iproute: mptcp support
This improves ip-mptcp help, addressing feedback from Mat.
Also includes ss man page update.
Davide Caratti (1):
ss: allow dumping MPTCP subflow information
Paolo Abeni (3):
uapi: update linux/mptcp.h
add support for mptcp netlink interface
man: mptcp man page
include/uapi/linux/mptcp.h | 89 ++++++++ ip/Makefile | 2 +- ip/ip.c | 3 +- ip/ip_common.h | 1 + ip/ipmptcp.c | 436 +++++++++++++++++++++++++++++++++++++ man/man8/ip-mptcp.8 | 142 ++++++++++++ man/man8/ss.8 | 5 + misc/ss.c | 62 ++++++ 8 files changed, 738 insertions(+), 2 deletions(-) create mode 100644 include/uapi/linux/mptcp.h create mode 100644 ip/ipmptcp.c create mode 100644 man/man8/ip-mptcp.8
Signature · 1 line
2.21.1
Paolo Abeni
PATCH v3 1/4 uapi: update linux/mptcp.h
--- include/uapi/linux/mptcp.h | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 include/uapi/linux/mptcp.h
include/uapi/linux/mptcp.h new file +89 -0
@@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +#ifndef _UAPI_MPTCP_H +#define _UAPI_MPTCP_H + +#include <linux/const.h> +#include <linux/types.h> + +#define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0) +#define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1) +#define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2) +#define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3) +#define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4) +#define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5) +#define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6) +#define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7) +#define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8) + +enum { +MPTCP_SUBFLOW_ATTR_UNSPEC , +MPTCP_SUBFLOW_ATTR_TOKEN_REM , +MPTCP_SUBFLOW_ATTR_TOKEN_LOC , +MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ , +MPTCP_SUBFLOW_ATTR_MAP_SEQ , +MPTCP_SUBFLOW_ATTR_MAP_SFSEQ , +MPTCP_SUBFLOW_ATTR_SSN_OFFSET , +MPTCP_SUBFLOW_ATTR_MAP_DATALEN , +MPTCP_SUBFLOW_ATTR_FLAGS , +MPTCP_SUBFLOW_ATTR_ID_REM , +MPTCP_SUBFLOW_ATTR_ID_LOC , +MPTCP_SUBFLOW_ATTR_PAD , + __MPTCP_SUBFLOW_ATTR_MAX +}; + +#define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1) + +/* netlink interface */ +#define MPTCP_PM_NAME "mptcp_pm" +#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds" +#define MPTCP_PM_VER 0x1 + +/* +* ATTR types defined for MPTCP +*/ +enum { +MPTCP_PM_ATTR_UNSPEC , + +MPTCP_PM_ATTR_ADDR ,/* nested address */ +MPTCP_PM_ATTR_RCV_ADD_ADDRS ,/* u32 */ +MPTCP_PM_ATTR_SUBFLOWS ,/* u32 */ + + __MPTCP_PM_ATTR_MAX +}; + +#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1) + +enum { +MPTCP_PM_ADDR_ATTR_UNSPEC , + +MPTCP_PM_ADDR_ATTR_FAMILY ,/* u16 */ +MPTCP_PM_ADDR_ATTR_ID ,/* u8 */ +MPTCP_PM_ADDR_ATTR_ADDR4 ,/* struct in_addr */ +MPTCP_PM_ADDR_ATTR_ADDR6 ,/* struct in6_addr */ +MPTCP_PM_ADDR_ATTR_PORT ,/* u16 */ +MPTCP_PM_ADDR_ATTR_FLAGS ,/* u32 */ +MPTCP_PM_ADDR_ATTR_IF_IDX ,/* s32 */ + + __MPTCP_PM_ADDR_ATTR_MAX +}; + +#define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1) + +#define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) +#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) +#define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) + +enum { +MPTCP_PM_CMD_UNSPEC , + +MPTCP_PM_CMD_ADD_ADDR , +MPTCP_PM_CMD_DEL_ADDR , +MPTCP_PM_CMD_GET_ADDR , +MPTCP_PM_CMD_FLUSH_ADDRS , +MPTCP_PM_CMD_SET_LIMITS , +MPTCP_PM_CMD_GET_LIMITS , + + __MPTCP_PM_CMD_AFTER_LAST +}; + +#endif /* _UAPI_MPTCP_H */
Signature · 1 line
2.21.1
Paolo Abeni
PATCH v3 2/4 add support for mptcp netlink interface
In reply to Paolo AbeniImplement basic commands to:
- manipulate MPTCP endpoints list
- manipulate MPTCP connection limits
Examples:
1. Allows multiple subflows per MPTCP connection
$ ip mptcp limits set subflows 2
2. Accept ADD_ADDR announcement from the peer (server):
$ ip mptcp limits set add_addr_accepted 2
3. Add a ipv4 address to be annunced for backup subflows:
$ ip mptcp endpoint add 10.99.1.2 signal backup
4. Add an ipv6 address used as source for additional subflows:
$ ip mptcp endpoint add 2001::2 subflow
---
v2 -> v3:
- tons of cleanup by Mat ;)
v1 -> v2:
- use NEXT_ARG_FWD() (Davide)
- 'del' -> 'delete'
RFC -> v1:
- many command name changes, as per ML discussion
--- ip/Makefile | 2 +- ip/ip.c | 3 +- ip/ip_common.h | 1 + ip/ipmptcp.c | 436 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 440 insertions(+), 2 deletions(-) create mode 100644 ip/ipmptcp.c
ip/Makefile +1 -1
@@ -11,7 +11,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \ iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \ ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o iplink_rmnet.o \ - ipnexthop.o + ipnexthop.o ipmptcp.o RTMONOBJ=rtmon.o
ip/ip.c +2 -1
@@ -51,7 +51,7 @@ static void usage(void)"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n" " tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n" " netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n" -" vrf | sr | nexthop }\n" +" vrf | sr | nexthop | mptcp }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
@@ -103,6 +103,7 @@ static const struct cmd { { "vrf", do_ipvrf}, { "sr", do_seg6 }, { "nexthop", do_ipnh }, + { "mptcp", do_mptcp }, { "help", do_help }, { 0 } };
ip/ip_common.h +1 -0
@@ -83,6 +83,7 @@ void vrf_reset(void);int netns_identify_pid (const char *pidstr,char *name,int len);int do_seg6 (int argc,char **argv);int do_ipnh (int argc,char **argv); +int do_mptcp (int argc,char **argv);int iplink_get (char *name,__u32 filt_mask);int iplink_ifla_xstats (int argc,char **argv);
ip/ipmptcp.c new file +436 -0
436 lines not on this page · raw message
Signature · 1 line
2.21.1
Paolo Abeni
PATCH v3 3/4 ss: allow dumping MPTCP subflow information
In reply to Paolo AbeniFrom: Davide Caratti <dcaratti(a)redhat.com>
[root(a)f31 packetdrill]# ss -tni
ESTAB 0 0 192.168.82.247:8080 192.0.2.1:35273
cubic wscale:7,8 [...] tcp-ulp-mptcp flags:Mec token:0000(id:0)/5f856c60(id:0) seq:b810457db34209a5 sfseq:1 ssnoff:0 maplen:190
--- man/man8/ss.8 | 5 +++++ misc/ss.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)
man/man8/ss.8 +5 -0
@@ -261,6 +261,11 @@ the pacing rate and max pacing rate .TP .B rcv_space:<rcv_space> a helper variable for TCP internal auto tuning socket receive buffer +.P +.TP +.B tcp-ulp-mptcp flags:[MmBbJjecv] token:<rem_token(rem_id)/loc_token(loc_id)> seq:<sn> sfseq:<ssn> ssnoff:<off> maplen:<maplen> +MPTCP subflow information +.P .RE .TP .B \-\-tos
misc/ss.c +62 -0
80 lines not on this page · raw message
Signature · 1 line
2.21.1
Paolo Abeni
PATCH v3 4/4 man: mptcp man page
In reply to Paolo Abenidescribe the mptcp subcommands implemented so far.
--- man/man8/ip-mptcp.8 | 142 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 man/man8/ip-mptcp.8
man/man8/ip-mptcp.8 new file +142 -0
@@ -0,0 +1,142 @@ +.TH IP\-MPTCP 8 "4 Apr 2020" "iproute2" "Linux" +.SH "NAME" +ip-mptcp \- MPTCP path manager configuration +.SH "SYNOPSIS" +.sp +.ad l +.in +8 +.ti -8 +.B ip +.RI "[ " OPTIONS " ]" +.B mptcp +.RB "{ " +.B endpoint +.RB " | " +.B limits +.RB " | " +.B help +.RB " }" +.sp + +.ti -8 +.BR "ip mptcp endpoint add " +.IR IFADDR +.RB "[ " dev +.IR IFNAME " ]" +.RB "[ " id +.I ID +.RB "] [ " +.I FLAG-LIST +.RB "] " + +.ti -8 +.BR "ip mptcp endpoint del id " +.I ID + +.ti -8 +.BR "ip mptcp endpoint show " +.RB "[ " id +.I ID +.RB "]" + +.ti -8 +.BR "ip mptcp endpoint flush" + +.ti -8 +.IR FLAG-LIST " := [ " FLAG-LIST " ] " FLAG + +.ti -8 +.IR FLAG " := [" +.B signal +.RB "|" +.B subflow +.RB "|" +.B backup +.RB "]" + +.ti -8 +.BR "ip mptcp limits set " +.RB "[ " +.B subflow +.IR SUBFLOW_NR " ]" +.RB "[ " +.B add_addr_accepted +.IR ADD_ADDR_ACCEPTED_NR " ]" + +.ti -8 +.BR "ip mptcp limits show" + +.SH DESCRIPTION + +MPTCP is a transport protocol build on top of TCP that allows TCP +connections to use multiple paths to maximize resource usage and increase +redundancy. The ip-mptcp sub-commands allow configuring several aspects of the +MPTCP path manager, which is in charge of subflows creation: + +.P +The +.B endpoint +object specifies the IP addresses that will be used and/or announced for +additional subflows: + +.TS +l l. +ip mptcp endpoint add add new MPTCP endpoint +ip mptcp endpoint delete delete existing MPTCP endpoint +ip mptcp endpoint show get existing MPTCP endpoint +ip mptcp endpoint flush flush all existing MPTCP endpoints +.TE + +.TP +.IR ID +is a unique numeric identifier for the given endpoint + +.TP +.BR signal +the endpoint will be announced/signaled to each peer via an ADD_ADDR MPTCP +sub-option + +.TP +.BR subflow +If the MPTCP limits allow for additional subflows creation, the endpoint will +be used as the source address to create an additional subflow after that +the MPTCP connection is established. + +.TP +.BR backup +the endpoint will be announced as a backup address, if this is a +.BR signal +endpoint, or the subflow will be created as a backup one if this a +.BR subflow +endpoint + +.sp +.PP +The +.B limits +object specifies the constraints for subflow creations: + +.TS +l l. +ip mptcp limits show get current MPTCP subflow creation limits +ip mptcp limits set change the MPTCP subflow creation limits +.TE + +.TP +.IR SUBFLOW_NR +specifies the maximum number of additional subflows allowed for each MPTCP +connection. Additional subflows can be created due to: incoming accepted +ADD_ADDR option, local +.BR subflow +endpoints, additional subflows started by the peer. + +.TP +.IR ADD_ADDR_ACCEPTED_NR +specifies the maximum number of ADD_ADDR suboptions accepted for each MPTCP +connection. The MPTCP path manager will try to create a new subflow for +each accepted ADD_ADDR option, respecting the +.IR SUBFLOW_NR +limit. + +.SH AUTHOR +Original Manpage by Paolo Abeni <pabeni(a)redhat.com>
Signature · 1 line
2.21.1
Matthieu Baerts
[MPTCP] Re: [PATCH v3 3/4] ss: allow dumping MPTCP subflow information
In reply to Paolo AbeniHi Davide,
Thank you for the new version!
Quoted 19 lines · Paolo Abeni
From: Davide Caratti <dcaratti(a)redhat.com>
[root(a)f31 packetdrill]# ss -tni
ESTAB 0 0 192.168.82.247:8080 192.0.2.1:35273
cubic wscale:7,8 [...] tcp-ulp-mptcp flags:Mec token:0000(id:0)/5f856c60(id:0) seq:b810457db34209a5 sfseq:1 ssnoff:0 maplen:190Signed-off-by Davide Caratti <dcaratti(a)redhat.com>Signed-off-by Paolo Abeni <pabeni(a)redhat.com>--- man/man8/ss.8 | 5 +++++ misc/ss.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)man/man8/ss.8 +0
-0
man/man8/ss.8 the pacing rate and max pacing rate · line 268
Quoted 8 lines
man/man8/ss.8 +5
-0@@ -261,6 +261,11 @@ the pacing rate and max pacing rate .TP .B rcv_space:<rcv_space> a helper variable for TCP internal auto tuning socket receive buffer +.P +.TP +.B tcp-ulp-mptcp flags:[MmBbJjecv] token:<rem_token(rem_id)/loc_token(loc_id)> seq:<sn> sfseq:<ssn> ssnoff:<off> maplen:<maplen> +MPTCP subflow information +.P
Do you think we can also add what each of "MmBbJjecv" means? :-)
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Davide Caratti
[MPTCP] Re: [PATCH v3 3/4] ss: allow dumping MPTCP subflow information
Quoted 1 line · Matthieu Baerts
Do you think we can also add what each of "MmBbJjecv" means? :-)
... sure, even if it's painful as we are already in a .TP item :) I'm more worried about what to write as understandable description for 'sfseq' 'ssn_offset', and 'map_valid'.
Can we do this in a separate patch, if it doesn't block the acceptance of 'iproute2' series?
Signature · 1 line
davide
Matthieu Baerts
[MPTCP] Re: [PATCH v3 3/4] ss: allow dumping MPTCP subflow information
Hi Davide,
Quoted 6 lines · Davide Caratti
Quoted 1 line · Matthieu Baerts
Do you think we can also add what each of "MmBbJjecv" means? :-)
... sure, even if it's painful as we are already in a .TP item :) I'm more worried about what to write as understandable description for 'sfseq' '
ssn_offset', and 'map_valid'.
Indeed, when looking at SS man page, I don't know where to explain that. Or maybe:
.B tcp-ulp-mptcp flags:[M<remote MP_CAPABLE>m<local
MP_CAPABLE>J<remote MP_JOIN>j<local MP_JOIN>B<remote backup>b<local backup>e<fully established>c<connected>v<map valid>] token:<rem_token(rem_id)/loc_token(loc_id)> seq:<sn> sfseq:<ssn> ssnoff:<off> maplen:<maplen>
a bit like what is described for "skmem"?
But that's maybe too long?
Or a link to a doc stored somewhere?
Quoted 2 lines
Can we do this in a separate patch, if it doesn't block the acceptance of 'iproute2' series?
Sure, I don't want to block this.
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
[MPTCP] Re: [PATCH v3 4/4] man: mptcp man page
In reply to Paolo AbeniHi Paolo,
I think you missed some of my previous comments :)
I managed to get a review from an English native!
Quoted 14 lines · Paolo Abeni
describe the mptcp subcommands implemented so far.
Signed-off-by Paolo Abeni <pabeni(a)redhat.com>--- man/man8/ip-mptcp.8 | 142 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+)create mode 100644 man/man8/ip-mptcp.8
man/man8/ip-mptcp.8 new file +0
-0@@ -0,0 +1,142 @@
(...)
man/man8/ip-mptcp.8
Quoted 3 lines
+.SH DESCRIPTION
man/man8/ip-mptcp.8 new file +2
-0+ +MPTCP is a transport protocol build on top of TCP that allows TCP
s/build/built/
Quoted 15 lines
man/man8/ip-mptcp.8 new file +15
-0+connections to use multiple paths to maximize resource usage and increase +redundancy. The ip-mptcp sub-commands allow configuring several aspects of the +MPTCP path manager, which is in charge of subflows creation: + +.P +The +.B endpoint +object specifies the IP addresses that will be used and/or announced for +additional subflows: + +.TS +l l. +ip mptcp endpoint add add new MPTCP endpoint +ip mptcp endpoint delete delete existing MPTCP endpoint +ip mptcp endpoint show get existing MPTCP endpoint
man/man8/ip-mptcp.8 line 96
Quoted 10 lines
man/man8/ip-mptcp.8 new file +10
-0+ip mptcp endpoint flush flush all existing MPTCP endpoints +.TE + +.TP +.IR ID +is a unique numeric identifier for the given endpoint + +.TP +.BR signal +the endpoint will be announced/signaled to each peer via an ADD_ADDR MPTCP
s/signaled/signalled/
man/man8/ip-mptcp.8 line 101
Quoted 5 lines
man/man8/ip-mptcp.8 new file +5
-0+sub-option + +.TP +.BR subflow +If the MPTCP limits allow for additional subflows creation, the endpoint will
s/subflows creation/subflow creations/
or: s/If the MPTCP limits allow for additional subflows creation/If additional subflow creation is allowed by MPTCP limits/
detail: s/If/if/
man/man8/ip-mptcp.8 line 103
Quoted 2 lines
man/man8/ip-mptcp.8 new file +2
-0+be used as the source address to create an additional subflow after that +the MPTCP connection is established.
s/after that the MPTCP connection is established/after the MPTCP connection has been established/
or: s/after that the MPTCP connection is established/after the establishment of the MPTCP connection/
man/man8/ip-mptcp.8 line 109
Quoted 6 lines
man/man8/ip-mptcp.8 new file +6
-0+ +.TP +.BR backup +the endpoint will be announced as a backup address, if this is a +.BR signal +endpoint, or the subflow will be created as a backup one if this a
s/this a/this is a/
Quoted 2 lines
+.BR subflow
+endpoint
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
[MPTCP] Re: [PATCH v3 2/4] add support for mptcp netlink interface
In reply to Paolo AbeniHi Paolo,
Thank you for the v3!
Quoted 6 lines · Paolo Abeni
ip/ipmptcp.c new file +0
-0@@ -0,0 +1,436 @@
(...)
Quoted 12 lines
ip/ipmptcp.c new file +12
-0+static int mptcp_parse_limit (int argc,char **argv,struct nlmsghdr *n) +{ +bool set_rcv_add_addrs = false; +bool set_subflows = false; +__u32 rcv_add_addrs =0 ; +__u32 subflows =0 ; + +while (argc >0 ) { +if (matches (*argv,"subflows" ) ==0 ) { +NEXT_ARG (); + +if (get_u32 (&subflows, *argv,0 ))
ip/ipmptcp.c line 320
Quoted 10 lines
ip/ipmptcp.c new file +10
-0+invarg ("invalid subflows\n" , *argv); + set_subflows = true; + }else if (matches (*argv,"add_addr_accepted" ) ==0 ) { +NEXT_ARG (); + +if (get_u32 (&rcv_add_addrs, *argv,0 )) +invarg ("invalid add_addr_accepted\n" , *argv); + set_rcv_add_addrs = true; + }else { +invarg ("unknown" , *argv);
I was going to add a detail here: "\n" seems missing but I just noticed it is always added in a few files I opened but not everywhere. Apparently, there is a mix usage:
$ git grep -e "invarg(\".*);$" -- ip/ip*.c | wc -l 359 $ git grep -e "invarg(\".*);$" -- ip/ip*.c | grep -c '\\n"' 161
So I am fine with or without this \n here and above where invarg() is used.
But maybe should we have: "unknown limit"? Up to you!
Of course no need to send a v4 just for that ;-)
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium