iproute: mptcp support
Paolo Abeni
cover iproute: mptcp support
This updated the command syntax as per ML discussion. I picked 'endpoint' as the main sub-command name.
Still lacks a man-page (help more than welcome!!!)
If there is agreement, the idea is including Davide's 'ss' patch and send them upstream as a whole.
Any feedback welcome!
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 | 449 +++++++++++++++++++++++++++++++++++++ 5 files changed, 541 insertions(+), 2 deletions(-) create mode 100644 include/uapi/linux/mptcp.h create mode 100644 ip/ipmptcp.c
Signature · 1 line
2.21.1
Paolo Abeni
PATCH 1/2 uapi: update linux/mptcp.h
--- 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
@@ -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
Paolo Abeni
[MPTCP] Re: [PATCH 1/2] uapi: update linux/mptcp.h
Quoted 17 lines · Paolo Abeni
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.hinclude/uapi/linux/mptcp.h new file +5
-0@@ -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>
include/uapi/linux/mptcp.h line 15
Quoted 10 lines
include/uapi/linux/mptcp.h new file +10
-0+ +#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)
Davide just noted I used to old/wrong uapi header, will sync-up in the next iteration - possibly directly upstream.
Quoted 73 lines
include/uapi/linux/mptcp.h new file +73
-0+ +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 */
Paolo Abeni
PATCH 2/2 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
---
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 | 449 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 453 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 +449 -0
449 lines not on this page · raw message
Signature · 1 line
2.21.1
Davide Caratti
[MPTCP] Re: [PATCH 2/2] add support for mptcp netlink interface.
Quoted 1 line · Paolo Abeni
argc--, argv++;
nit: why not doing NEXT_ARG_FWD() here?
Signature · 1 line
davide