2020-03-27 14:48:49 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
|
|
|
|
#ifndef _UAPI_MPTCP_H
|
|
|
|
|
#define _UAPI_MPTCP_H
|
|
|
|
|
|
2022-06-27 18:02:42 -07:00
|
|
|
#ifndef __KERNEL__
|
|
|
|
|
#include <netinet/in.h> /* for sockaddr_in and sockaddr_in6 */
|
|
|
|
|
#include <sys/socket.h> /* for struct sockaddr */
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-27 14:48:49 -07:00
|
|
|
#include <linux/const.h>
|
|
|
|
|
#include <linux/types.h>
|
2021-09-17 16:33:21 -07:00
|
|
|
#include <linux/in.h> /* for sockaddr_in */
|
|
|
|
|
#include <linux/in6.h> /* for sockaddr_in6 */
|
|
|
|
|
#include <linux/socket.h> /* for sockaddr_storage and sa_family */
|
|
|
|
|
|
2020-03-27 14:48:49 -07:00
|
|
|
#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)
|
2020-03-27 14:48:51 -07:00
|
|
|
|
|
|
|
|
/* netlink interface */
|
|
|
|
|
#define MPTCP_PM_NAME "mptcp_pm"
|
|
|
|
|
#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
|
2021-02-12 16:00:01 -08:00
|
|
|
#define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
|
2020-03-27 14:48:51 -07:00
|
|
|
#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 */
|
2022-05-03 19:38:52 -07:00
|
|
|
MPTCP_PM_ATTR_TOKEN, /* u32 */
|
2022-05-03 19:38:54 -07:00
|
|
|
MPTCP_PM_ATTR_LOC_ID, /* u8 */
|
mptcp: netlink: allow userspace-driven subflow establishment
This allows userspace to tell kernel to add a new subflow to an existing
mptcp connection.
Userspace provides the token to identify the mptcp-level connection
that needs a change in active subflows and the local and remote
addresses of the new or the to-be-removed subflow.
MPTCP_PM_CMD_SUBFLOW_CREATE requires the following parameters:
{ token, { loc_id, family, loc_addr4 | loc_addr6 }, { family, rem_addr4 |
rem_addr6, rem_port }
MPTCP_PM_CMD_SUBFLOW_DESTROY requires the following parameters:
{ token, { family, loc_addr4 | loc_addr6, loc_port }, { family, rem_addr4 |
rem_addr6, rem_port }
Acked-by: Paolo Abeni <pabeni@redhat.com>
Co-developed-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-05-03 19:38:56 -07:00
|
|
|
MPTCP_PM_ATTR_ADDR_REMOTE, /* nested address */
|
2020-03-27 14:48:51 -07:00
|
|
|
|
|
|
|
|
__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)
|
2021-08-17 15:07:23 -07:00
|
|
|
#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
|
2022-03-07 12:44:36 -08:00
|
|
|
#define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4)
|
2020-03-27 14:48:51 -07:00
|
|
|
|
|
|
|
|
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,
|
2021-01-08 16:47:59 -08:00
|
|
|
MPTCP_PM_CMD_SET_FLAGS,
|
2022-05-03 19:38:52 -07:00
|
|
|
MPTCP_PM_CMD_ANNOUNCE,
|
2022-05-03 19:38:54 -07:00
|
|
|
MPTCP_PM_CMD_REMOVE,
|
mptcp: netlink: allow userspace-driven subflow establishment
This allows userspace to tell kernel to add a new subflow to an existing
mptcp connection.
Userspace provides the token to identify the mptcp-level connection
that needs a change in active subflows and the local and remote
addresses of the new or the to-be-removed subflow.
MPTCP_PM_CMD_SUBFLOW_CREATE requires the following parameters:
{ token, { loc_id, family, loc_addr4 | loc_addr6 }, { family, rem_addr4 |
rem_addr6, rem_port }
MPTCP_PM_CMD_SUBFLOW_DESTROY requires the following parameters:
{ token, { family, loc_addr4 | loc_addr6, loc_port }, { family, rem_addr4 |
rem_addr6, rem_port }
Acked-by: Paolo Abeni <pabeni@redhat.com>
Co-developed-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-05-03 19:38:56 -07:00
|
|
|
MPTCP_PM_CMD_SUBFLOW_CREATE,
|
|
|
|
|
MPTCP_PM_CMD_SUBFLOW_DESTROY,
|
2020-03-27 14:48:51 -07:00
|
|
|
|
|
|
|
|
__MPTCP_PM_CMD_AFTER_LAST
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-09 15:12:41 +02:00
|
|
|
#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
|
|
|
|
|
#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
|
|
|
|
|
|
|
|
|
|
struct mptcp_info {
|
|
|
|
|
__u8 mptcpi_subflows;
|
|
|
|
|
__u8 mptcpi_add_addr_signal;
|
|
|
|
|
__u8 mptcpi_add_addr_accepted;
|
|
|
|
|
__u8 mptcpi_subflows_max;
|
|
|
|
|
__u8 mptcpi_add_addr_signal_max;
|
|
|
|
|
__u8 mptcpi_add_addr_accepted_max;
|
|
|
|
|
__u32 mptcpi_flags;
|
|
|
|
|
__u32 mptcpi_token;
|
|
|
|
|
__u64 mptcpi_write_seq;
|
|
|
|
|
__u64 mptcpi_snd_una;
|
|
|
|
|
__u64 mptcpi_rcv_nxt;
|
2021-02-12 16:52:02 -08:00
|
|
|
__u8 mptcpi_local_addr_used;
|
|
|
|
|
__u8 mptcpi_local_addr_max;
|
2021-06-17 16:46:07 -07:00
|
|
|
__u8 mptcpi_csum_enabled;
|
2020-07-09 15:12:41 +02:00
|
|
|
};
|
|
|
|
|
|
2021-02-12 16:00:01 -08:00
|
|
|
/*
|
|
|
|
|
* MPTCP_EVENT_CREATED: token, family, saddr4 | saddr6, daddr4 | daddr6,
|
|
|
|
|
* sport, dport
|
|
|
|
|
* A new MPTCP connection has been created. It is the good time to allocate
|
|
|
|
|
* memory and send ADD_ADDR if needed. Depending on the traffic-patterns
|
|
|
|
|
* it can take a long time until the MPTCP_EVENT_ESTABLISHED is sent.
|
|
|
|
|
*
|
|
|
|
|
* MPTCP_EVENT_ESTABLISHED: token, family, saddr4 | saddr6, daddr4 | daddr6,
|
|
|
|
|
* sport, dport
|
|
|
|
|
* A MPTCP connection is established (can start new subflows).
|
|
|
|
|
*
|
|
|
|
|
* MPTCP_EVENT_CLOSED: token
|
|
|
|
|
* A MPTCP connection has stopped.
|
|
|
|
|
*
|
|
|
|
|
* MPTCP_EVENT_ANNOUNCED: token, rem_id, family, daddr4 | daddr6 [, dport]
|
|
|
|
|
* A new address has been announced by the peer.
|
|
|
|
|
*
|
|
|
|
|
* MPTCP_EVENT_REMOVED: token, rem_id
|
|
|
|
|
* An address has been lost by the peer.
|
|
|
|
|
*
|
2021-12-14 15:16:04 -08:00
|
|
|
* MPTCP_EVENT_SUB_ESTABLISHED: token, family, loc_id, rem_id,
|
|
|
|
|
* saddr4 | saddr6, daddr4 | daddr6, sport,
|
|
|
|
|
* dport, backup, if_idx [, error]
|
2021-02-12 16:00:01 -08:00
|
|
|
* A new subflow has been established. 'error' should not be set.
|
|
|
|
|
*
|
2021-12-14 15:16:04 -08:00
|
|
|
* MPTCP_EVENT_SUB_CLOSED: token, family, loc_id, rem_id, saddr4 | saddr6,
|
|
|
|
|
* daddr4 | daddr6, sport, dport, backup, if_idx
|
|
|
|
|
* [, error]
|
2021-02-12 16:00:01 -08:00
|
|
|
* A subflow has been closed. An error (copy of sk_err) could be set if an
|
|
|
|
|
* error has been detected for this subflow.
|
|
|
|
|
*
|
2021-12-14 15:16:04 -08:00
|
|
|
* MPTCP_EVENT_SUB_PRIORITY: token, family, loc_id, rem_id, saddr4 | saddr6,
|
|
|
|
|
* daddr4 | daddr6, sport, dport, backup, if_idx
|
|
|
|
|
* [, error]
|
|
|
|
|
* The priority of a subflow has changed. 'error' should not be set.
|
2021-02-12 16:00:01 -08:00
|
|
|
*/
|
|
|
|
|
enum mptcp_event_type {
|
|
|
|
|
MPTCP_EVENT_UNSPEC = 0,
|
|
|
|
|
MPTCP_EVENT_CREATED = 1,
|
|
|
|
|
MPTCP_EVENT_ESTABLISHED = 2,
|
|
|
|
|
MPTCP_EVENT_CLOSED = 3,
|
|
|
|
|
|
|
|
|
|
MPTCP_EVENT_ANNOUNCED = 6,
|
|
|
|
|
MPTCP_EVENT_REMOVED = 7,
|
|
|
|
|
|
|
|
|
|
MPTCP_EVENT_SUB_ESTABLISHED = 10,
|
|
|
|
|
MPTCP_EVENT_SUB_CLOSED = 11,
|
|
|
|
|
|
|
|
|
|
MPTCP_EVENT_SUB_PRIORITY = 13,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum mptcp_event_attr {
|
|
|
|
|
MPTCP_ATTR_UNSPEC = 0,
|
|
|
|
|
|
|
|
|
|
MPTCP_ATTR_TOKEN, /* u32 */
|
|
|
|
|
MPTCP_ATTR_FAMILY, /* u16 */
|
|
|
|
|
MPTCP_ATTR_LOC_ID, /* u8 */
|
|
|
|
|
MPTCP_ATTR_REM_ID, /* u8 */
|
|
|
|
|
MPTCP_ATTR_SADDR4, /* be32 */
|
|
|
|
|
MPTCP_ATTR_SADDR6, /* struct in6_addr */
|
|
|
|
|
MPTCP_ATTR_DADDR4, /* be32 */
|
|
|
|
|
MPTCP_ATTR_DADDR6, /* struct in6_addr */
|
|
|
|
|
MPTCP_ATTR_SPORT, /* be16 */
|
|
|
|
|
MPTCP_ATTR_DPORT, /* be16 */
|
|
|
|
|
MPTCP_ATTR_BACKUP, /* u8 */
|
|
|
|
|
MPTCP_ATTR_ERROR, /* u8 */
|
|
|
|
|
MPTCP_ATTR_FLAGS, /* u16 */
|
|
|
|
|
MPTCP_ATTR_TIMEOUT, /* u32 */
|
|
|
|
|
MPTCP_ATTR_IF_IDX, /* s32 */
|
2021-04-01 16:19:44 -07:00
|
|
|
MPTCP_ATTR_RESET_REASON,/* u32 */
|
|
|
|
|
MPTCP_ATTR_RESET_FLAGS, /* u32 */
|
2022-05-02 13:52:36 -07:00
|
|
|
MPTCP_ATTR_SERVER_SIDE, /* u8 */
|
2021-02-12 16:00:01 -08:00
|
|
|
|
|
|
|
|
__MPTCP_ATTR_AFTER_LAST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
|
|
|
|
|
|
2021-04-01 16:19:44 -07:00
|
|
|
/* MPTCP Reset reason codes, rfc8684 */
|
|
|
|
|
#define MPTCP_RST_EUNSPEC 0
|
|
|
|
|
#define MPTCP_RST_EMPTCP 1
|
|
|
|
|
#define MPTCP_RST_ERESOURCE 2
|
|
|
|
|
#define MPTCP_RST_EPROHIBIT 3
|
|
|
|
|
#define MPTCP_RST_EWQ2BIG 4
|
|
|
|
|
#define MPTCP_RST_EBADPERF 5
|
|
|
|
|
#define MPTCP_RST_EMIDDLEBOX 6
|
|
|
|
|
|
mptcp: add MPTCP_TCPINFO getsockopt support
Allow users to retrieve TCP_INFO data of all subflows.
Users need to pre-initialize a meta header that has to be
prepended to the data buffer that will be filled with the tcp info data.
The meta header looks like this:
struct mptcp_subflow_data {
__u32 size_subflow_data;/* size of this structure in userspace */
__u32 num_subflows; /* must be 0, set by kernel */
__u32 size_kernel; /* must be 0, set by kernel */
__u32 size_user; /* size of one element in data[] */
} __attribute__((aligned(8)));
size_subflow_data has to be set to 'sizeof(struct mptcp_subflow_data)'.
This allows to extend mptcp_subflow_data structure later on without
breaking backwards compatibility.
If the structure is extended later on, kernel knows where the
userspace-provided meta header ends, even if userspace uses an older
(smaller) version of the structure.
num_subflows must be set to 0. If the getsockopt request succeeds (return
value is 0), it will be updated to contain the number of active subflows
for the given logical connection.
size_kernel must be set to 0. If the getsockopt request is successful,
it will contain the size of the 'struct tcp_info' as known by the kernel.
This is informational only.
size_user must be set to 'sizeof(struct tcp_info)'.
This allows the kernel to only fill in the space reserved/expected by
userspace.
Example:
struct my_tcp_info {
struct mptcp_subflow_data d;
struct tcp_info ti[2];
};
struct my_tcp_info ti;
socklen_t olen;
memset(&ti, 0, sizeof(ti));
ti.d.size_subflow_data = sizeof(struct mptcp_subflow_data);
ti.d.size_user = sizeof(struct tcp_info);
olen = sizeof(ti);
ret = getsockopt(fd, SOL_MPTCP, MPTCP_TCPINFO, &ti, &olen);
if (ret < 0)
die_perror("getsockopt MPTCP_TCPINFO");
mptcp_subflow_data.num_subflows is populated with the number of
subflows that exist on the kernel side for the logical mptcp connection.
This allows userspace to re-try with a larger tcp_info array if the number
of subflows was larger than the available space in the ti[] array.
olen has to be set to the number of bytes that userspace has allocated to
receive the kernel data. It will be updated to contain the real number
bytes that have been copied to by the kernel.
In the above example, if the number if subflows was 1, olen is equal to
'sizeof(struct mptcp_subflow_data) + sizeof(struct tcp_info).
For 2 or more subflows olen is equal to 'sizeof(struct my_tcp_info)'.
If there was more data that could not be copied due to lack of space
in the option buffer, userspace can detect this by checking
mptcp_subflow_data->num_subflows.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-09-17 16:33:20 -07:00
|
|
|
struct mptcp_subflow_data {
|
|
|
|
|
__u32 size_subflow_data; /* size of this structure in userspace */
|
|
|
|
|
__u32 num_subflows; /* must be 0, set by kernel */
|
|
|
|
|
__u32 size_kernel; /* must be 0, set by kernel */
|
|
|
|
|
__u32 size_user; /* size of one element in data[] */
|
|
|
|
|
} __attribute__((aligned(8)));
|
|
|
|
|
|
2021-09-17 16:33:21 -07:00
|
|
|
struct mptcp_subflow_addrs {
|
|
|
|
|
union {
|
|
|
|
|
__kernel_sa_family_t sa_family;
|
|
|
|
|
struct sockaddr sa_local;
|
|
|
|
|
struct sockaddr_in sin_local;
|
|
|
|
|
struct sockaddr_in6 sin6_local;
|
|
|
|
|
struct __kernel_sockaddr_storage ss_local;
|
|
|
|
|
};
|
|
|
|
|
union {
|
|
|
|
|
struct sockaddr sa_remote;
|
|
|
|
|
struct sockaddr_in sin_remote;
|
|
|
|
|
struct sockaddr_in6 sin6_remote;
|
|
|
|
|
struct __kernel_sockaddr_storage ss_remote;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-17 16:33:19 -07:00
|
|
|
/* MPTCP socket options */
|
mptcp: add MPTCP_TCPINFO getsockopt support
Allow users to retrieve TCP_INFO data of all subflows.
Users need to pre-initialize a meta header that has to be
prepended to the data buffer that will be filled with the tcp info data.
The meta header looks like this:
struct mptcp_subflow_data {
__u32 size_subflow_data;/* size of this structure in userspace */
__u32 num_subflows; /* must be 0, set by kernel */
__u32 size_kernel; /* must be 0, set by kernel */
__u32 size_user; /* size of one element in data[] */
} __attribute__((aligned(8)));
size_subflow_data has to be set to 'sizeof(struct mptcp_subflow_data)'.
This allows to extend mptcp_subflow_data structure later on without
breaking backwards compatibility.
If the structure is extended later on, kernel knows where the
userspace-provided meta header ends, even if userspace uses an older
(smaller) version of the structure.
num_subflows must be set to 0. If the getsockopt request succeeds (return
value is 0), it will be updated to contain the number of active subflows
for the given logical connection.
size_kernel must be set to 0. If the getsockopt request is successful,
it will contain the size of the 'struct tcp_info' as known by the kernel.
This is informational only.
size_user must be set to 'sizeof(struct tcp_info)'.
This allows the kernel to only fill in the space reserved/expected by
userspace.
Example:
struct my_tcp_info {
struct mptcp_subflow_data d;
struct tcp_info ti[2];
};
struct my_tcp_info ti;
socklen_t olen;
memset(&ti, 0, sizeof(ti));
ti.d.size_subflow_data = sizeof(struct mptcp_subflow_data);
ti.d.size_user = sizeof(struct tcp_info);
olen = sizeof(ti);
ret = getsockopt(fd, SOL_MPTCP, MPTCP_TCPINFO, &ti, &olen);
if (ret < 0)
die_perror("getsockopt MPTCP_TCPINFO");
mptcp_subflow_data.num_subflows is populated with the number of
subflows that exist on the kernel side for the logical mptcp connection.
This allows userspace to re-try with a larger tcp_info array if the number
of subflows was larger than the available space in the ti[] array.
olen has to be set to the number of bytes that userspace has allocated to
receive the kernel data. It will be updated to contain the real number
bytes that have been copied to by the kernel.
In the above example, if the number if subflows was 1, olen is equal to
'sizeof(struct mptcp_subflow_data) + sizeof(struct tcp_info).
For 2 or more subflows olen is equal to 'sizeof(struct my_tcp_info)'.
If there was more data that could not be copied due to lack of space
in the option buffer, userspace can detect this by checking
mptcp_subflow_data->num_subflows.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-09-17 16:33:20 -07:00
|
|
|
#define MPTCP_INFO 1
|
|
|
|
|
#define MPTCP_TCPINFO 2
|
2021-09-17 16:33:21 -07:00
|
|
|
#define MPTCP_SUBFLOW_ADDRS 3
|
2021-09-17 16:33:19 -07:00
|
|
|
|
2020-03-27 14:48:49 -07:00
|
|
|
#endif /* _UAPI_MPTCP_H */
|