Skip to contentSkip to conversation

iproute: mptcp support

RFC PATCH In review Paolo Abeni 4 participants 9 messages Mar 26, 2020 – Apr 9, 2020 Networking MPTCP

lore
Share & tools
lore

Paolo Abeni

author
#0 lore raw

cover iproute: mptcp support

This is the first draft for iproute support.

Still lack a man-page (help more than welcome!!!)

Any feedback on [sub]commands name and syntax more than welcome - please have a look at the usage() section in patch 2

Paolo Abeni (2):
uapi: update linux/mptcp.h
add support for mptcp netlink interface.

 include/uapi/linux/mptcp.h |  88 ++++++++
 ip/Makefile                |   2 +-
 ip/ip.c                    |   3 +-
 ip/ip_common.h             |   1 +
 ip/ipmptcp.c               | 446 +++++++++++++++++++++++++++++++++++++
 5 files changed, 538 insertions(+), 2 deletions(-)
 create mode 100644 include/uapi/linux/mptcp.h
 create mode 100644 ip/ipmptcp.c
Signature · 1 line
2.21.1
author
#1 lore raw

RFC PATCH 1/2 uapi: update linux/mptcp.h

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 include/uapi/linux/mptcp.h | 88 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 include/uapi/linux/mptcp.h
include/uapi/linux/mptcp.h new file +88 -0
new file mode 100644
index 00000000..dfd6674c
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+#ifndef _UAPI_MPTCP_H
+#define _UAPI_MPTCP_H
+
+#include <linux/types.h>
+
+#define MPTCP_SUBFLOW_FLAG_MCAP_REM		BIT(0)
+#define MPTCP_SUBFLOW_FLAG_MCAP_LOC		BIT(1)
+#define MPTCP_SUBFLOW_FLAG_JOIN_REM		BIT(2)
+#define MPTCP_SUBFLOW_FLAG_JOIN_LOC		BIT(3)
+#define MPTCP_SUBFLOW_FLAG_BKUP_REM		BIT(4)
+#define MPTCP_SUBFLOW_FLAG_BKUP_LOC		BIT(5)
+#define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED	BIT(6)
+#define MPTCP_SUBFLOW_FLAG_CONNECTED		BIT(7)
+#define MPTCP_SUBFLOW_FLAG_MAPVALID		BIT(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
author
#2 lore raw

RFC PATCH 2/2 add support for mptcp netlink interface.

In reply to Paolo Abeni

Implement basic commands to:
- manipulate MPTCP local addresses list
- manipulate MPTCP connection limits

Examples:
1. Allows multiple subflows per MPTCP connection

   $ ip mptcp limits subflows 2

2. Accept ADD_ADDR announcement from the peer (server):

   $ ip mptcp limits add_addr_accepted 2

3. Add a ipv4 address to be annunced for backup subflows:
$ip mptcp address add 10.99.1.2 signal backup

4. Add an ipv6 address used as source for additional subflows:
$ip mptcp address add 2001::2 subflow

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 ip/Makefile    |   2 +-
 ip/ip.c        |   3 +-
 ip/ip_common.h |   1 +
 ip/ipmptcp.c   | 446 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 450 insertions(+), 2 deletions(-)
 create mode 100644 ip/ipmptcp.c
ip/Makefile +1 -1
index 5ab78d7d..8735b8e4 100644
@@ -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
index 90392c2a..4249df03 100644
@@ -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
index 879287e3..d604f755 100644
@@ -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 +446 -0

446 lines not on this page · raw message

Signature · 1 line
2.21.1
#3 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

Quoted 45 lines · Paolo Abeni

Implement basic commands to:
- manipulate MPTCP local addresses list
- manipulate MPTCP connection limits

Examples:
1. Allows multiple subflows per MPTCP connection

  $ ip mptcp limits subflows 2

2. Accept ADD_ADDR announcement from the peer (server):

  $ ip mptcp limits add_addr_accepted 2

3. Add a ipv4 address to be annunced for backup subflows:
$ip mptcp address add 10.99.1.2 signal backup

4. Add an ipv6 address used as source for additional subflows:
$ip mptcp address add 2001::2 subflow

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

ip/ipmptcp.c new file +18 -0
new file mode 100644
index 00000000..1ff66a7b
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <string.h>
+#include <rt_names.h>
+#include <errno.h>
+
+#include <linux/genetlink.h>
+#include <linux/mptcp.h>
+
+#include "utils.h"
+#include "ip_common.h"
+#include "libgenl.h"
+#include "json_print.h"
+
+static void usage(void)
+{
+	fprintf(stderr,

ip/ipmptcp.c line 28

Quoted 10 lines
ip/ipmptcp.c new file +10 -0
+		"Usage:	ip mptcp address add <address> [dev <name>] [id <id>] [signal] [subflow] [backup]\n"
+		"	ip mptcp address del id <id>\n"
+		"	ip mptcp address list\n"
+		"	ip mptcp address get id <id>\n"
+		"	ip mptcp address flush\n"
+		"	ip mptcp limits [subflows <nr>] [add_addr_accepted <nr>]\n");
+
+	exit(-1);
+}
+

Looking at the documentation for 'ip', there seem to be two command styles:

ip [ OPTIONS ] OBJECT { COMMAND } # for most commands

ip xfrm XFRM-OBJECT { COMMAND } # for xfrm

and the above seems to fit the 'xfrm' style.

To avoid confusion with 'ip address', what about using "ip mptcp adv-address" (or "advertise-addr"?) to clarify that these are addresses to be advertised, rather than something that creates new addresses?

For consistency with other commands, "ip mptcp address show id <id>" could be a better fit than 'get'.

For the limit changes, how about:

ip mptcp limit set [subflows <nr>] [add_addr_accepted <nr>]

ip mptcp limit get
or
ip mptcp limit show

Do you think the 'ip mptcp' command will be extended in the future for managing per-connection settings? That probably still works with the above syntax, for example by adding [connection <token>] to 'ip mptcp address add'.

--
Mat Martineau
Intel

#4 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

Hi Paolo, Mat,

Quoted 14 lines · Mat Martineau
Quoted 11 lines · Paolo Abeni

Implement basic commands to:
- manipulate MPTCP local addresses list
- manipulate MPTCP connection limits

Examples:
1. Allows multiple subflows per MPTCP connection

  $ ip mptcp limits subflows 2

2. Accept ADD_ADDR announcement from the peer (server):

  $ ip mptcp limits add_addr_accepted 2
Quoted 8 lines
Quoted 8 lines

3. Add a ipv4 address to be annunced for backup subflows:
  $ip mptcp address add 10.99.1.2 signal backup

4. Add an ipv6 address used as source for additional subflows:
  $ip mptcp address add 2001::2 subflow

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

Thank you for the good work!

Quoted 45 lines
Quoted 33 lines
ip/ipmptcp.c new file +19 -0
new file mode 100644
index 00000000..1ff66a7b
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <string.h>
+#include <rt_names.h>
+#include <errno.h>
+
+#include <linux/genetlink.h>
+#include <linux/mptcp.h>
+
+#include "utils.h"
+#include "ip_common.h"
+#include "libgenl.h"
+#include "json_print.h"
+
+static void usage(void)
+{
+    fprintf(stderr,
+        "Usage:    ip mptcp address add <address> [dev <name>] [id 

<id>] [signal] [subflow] [backup]\n"
+        "    ip mptcp address del id <id>\n"
+        "    ip mptcp address list\n"
+        "    ip mptcp address get id <id>\n"
+        "    ip mptcp address flush\n"
+        "    ip mptcp limits [subflows <nr>] [add_addr_accepted <nr>]\n");

ip/ipmptcp.c line 28

Quoted 4 lines
ip/ipmptcp.c new file +4 -0
+
+    exit(-1);
+}
+

Looking at the documentation for 'ip', there seem to be two command styles:

ip [ OPTIONS ] OBJECT { COMMAND }     # for most commands

ip xfrm XFRM-OBJECT { COMMAND }       # for xfrm

Quoted 6 lines

and the above seems to fit the 'xfrm' style.

To avoid confusion with 'ip address', what about using "ip mptcp adv-address" (or "advertise-addr"?) to clarify that these are addresses to be advertised, rather than something that creates new addresses?

+1

Quoted 2 lines

For consistency with other commands, "ip mptcp address show id <id>" could be a better fit than 'get'.

+1

Quoted 8 lines

For the limit changes, how about:

ip mptcp limit set [subflows <nr>] [add_addr_accepted <nr>]

ip mptcp limit get
or
ip mptcp limit show

+1

Quoted 4 lines

Do you think the 'ip mptcp' command will be extended in the future for managing per-connection settings? That probably still works with the above syntax, for example by adding [connection <token>] to 'ip mptcp address add'.

Good idea. It will be possible to retrieve these tokens with "ss". It can be useful for the debugging.

For the rest mptcpd will be needed to track the connections.

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
author
#5 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

In reply to Mat Martineau
Quoted 64 lines · Mat Martineau
Quoted 43 lines · Paolo Abeni

Implement basic commands to:
- manipulate MPTCP local addresses list
- manipulate MPTCP connection limits

Examples:
1. Allows multiple subflows per MPTCP connection

  $ ip mptcp limits subflows 2

2. Accept ADD_ADDR announcement from the peer (server):

  $ ip mptcp limits add_addr_accepted 2

3. Add a ipv4 address to be annunced for backup subflows:
$ip mptcp address add 10.99.1.2 signal backup

4. Add an ipv6 address used as source for additional subflows:
$ip mptcp address add 2001::2 subflow

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

ip/ipmptcp.c new file +18 -0
new file mode 100644
index 00000000..1ff66a7b
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <string.h>
+#include <rt_names.h>
+#include <errno.h>
+
+#include <linux/genetlink.h>
+#include <linux/mptcp.h>
+
+#include "utils.h"
+#include "ip_common.h"
+#include "libgenl.h"
+#include "json_print.h"
+
+static void usage(void)
+{
+	fprintf(stderr,

ip/ipmptcp.c line 28

Quoted 10 lines
ip/ipmptcp.c new file +10 -0
+		"Usage:	ip mptcp address add <address> [dev <name>] [id <id>] [signal] [subflow] [backup]\n"
+		"	ip mptcp address del id <id>\n"
+		"	ip mptcp address list\n"
+		"	ip mptcp address get id <id>\n"
+		"	ip mptcp address flush\n"
+		"	ip mptcp limits [subflows <nr>] [add_addr_accepted <nr>]\n");
+
+	exit(-1);
+}
+

Looking at the documentation for 'ip', there seem to be two command styles:

ip [ OPTIONS ] OBJECT { COMMAND } # for most commands

ip xfrm XFRM-OBJECT { COMMAND } # for xfrm

Quoted 6 lines

and the above seems to fit the 'xfrm' style.

To avoid confusion with 'ip address', what about using "ip mptcp adv-address" (or "advertise-addr"?) to clarify that these are addresses to be advertised, rather than something that creates new addresses?

ok to rename, but the addresses specified here could be used for advertise but also as source address for additional flows, so we would need something more generic (and nothing come to my mind beyond 'address').

Quoted 2 lines

For consistency with other commands, "ip mptcp address show id <id>" could be a better fit than 'get'.

Ok, than is probably better also rename 'list' into 'show', so we will have a single 'getter' command with optional filter, WDYT?

Quoted 7 lines

For the limit changes, how about:

ip mptcp limit set [subflows <nr>] [add_addr_accepted <nr>]

ip mptcp limit get
or
ip mptcp limit show

Ok, I'll use 'show'

Quoted 12 lines

Do you think the 'ip mptcp' command will be extended in the future for managing per-connection settings? That probably still works with the above syntax, for example by adding [connection <token>] to 'ip mptcp address add'.

--
Mat Martineau
Intel

#6 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

Quoted 68 lines · Paolo Abeni
Quoted 67 lines · Mat Martineau
Quoted 43 lines · Paolo Abeni

Implement basic commands to:
- manipulate MPTCP local addresses list
- manipulate MPTCP connection limits

Examples:
1. Allows multiple subflows per MPTCP connection

  $ ip mptcp limits subflows 2

2. Accept ADD_ADDR announcement from the peer (server):

  $ ip mptcp limits add_addr_accepted 2

3. Add a ipv4 address to be annunced for backup subflows:
$ip mptcp address add 10.99.1.2 signal backup

4. Add an ipv6 address used as source for additional subflows:
$ip mptcp address add 2001::2 subflow

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

ip/ipmptcp.c new file +18 -0
new file mode 100644
index 00000000..1ff66a7b
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <string.h>
+#include <rt_names.h>
+#include <errno.h>
+
+#include <linux/genetlink.h>
+#include <linux/mptcp.h>
+
+#include "utils.h"
+#include "ip_common.h"
+#include "libgenl.h"
+#include "json_print.h"
+
+static void usage(void)
+{
+	fprintf(stderr,

ip/ipmptcp.c line 28

Quoted 10 lines
ip/ipmptcp.c new file +10 -0
+		"Usage:	ip mptcp address add <address> [dev <name>] [id <id>] [signal] [subflow] [backup]\n"
+		"	ip mptcp address del id <id>\n"
+		"	ip mptcp address list\n"
+		"	ip mptcp address get id <id>\n"
+		"	ip mptcp address flush\n"
+		"	ip mptcp limits [subflows <nr>] [add_addr_accepted <nr>]\n");
+
+	exit(-1);
+}
+

Looking at the documentation for 'ip', there seem to be two command styles:

ip [ OPTIONS ] OBJECT { COMMAND } # for most commands

ip xfrm XFRM-OBJECT { COMMAND } # for xfrm

and the above seems to fit the 'xfrm' style.

Quoted 8 lines
Quoted 3 lines

To avoid confusion with 'ip address', what about using "ip mptcp adv-address" (or "advertise-addr"?) to clarify that these are addresses to be advertised, rather than something that creates new addresses?

ok to rename, but the addresses specified here could be used for advertise but also as source address for additional flows, so we would need something more generic (and nothing come to my mind beyond 'address').

Good point. Would something like "default-addr" be generic for that purpose while still getting the point across that we expect these IP addresses to exist already, and are telling MPTCP to use them for any connection?

Quoted 6 lines
Quoted 3 lines

For consistency with other commands, "ip mptcp address show id <id>" could be a better fit than 'get'.

Ok, than is probably better also rename 'list' into 'show', so we will have a single 'getter' command with optional filter, WDYT?

Fine with me.

--
Mat Martineau
Intel

author
#7 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

[me is still somewhat alive]

Quoted 12 lines · Mat Martineau
Quoted 9 lines · Paolo Abeni
Quoted 3 lines · Mat Martineau

To avoid confusion with 'ip address', what about using "ip mptcp adv-address" (or "advertise-addr"?) to clarify that these are addresses to be advertised, rather than something that creates new addresses?

ok to rename, but the addresses specified here could be used for advertise but also as source address for additional flows, so we would need something more generic (and nothing come to my mind beyond 'address').

Quoted 4 lines

Good point. Would something like "default-addr" be generic for that purpose while still getting the point across that we expect these IP addresses to exist already, and are telling MPTCP to use them for any connection?

I'm wondering if something quite different, alike 'endpoint' would fit better ?!? in (distant) future we could add even port numbers to announced address.

Cheers,

Paolo

#8 lore raw

[MPTCP] Re: [RFC PATCH 2/2] add support for mptcp netlink interface.

Quoted 2 lines · Paolo Abeni

I'm wondering if something quite different, alike 'endpoint' would fit better ?!? in

the advantage of using an acronym is: you don't need to know what it means, just spell it correctly :)
what about

# ip mptcp advertise-ma

where ma can be "multihomed (host) address", like mentioned in RFC 8684 § 2.3 ?

Signature · 1 line
davide