Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2#ifndef _UAPI_MPTCP_H
3#define _UAPI_MPTCP_H
4
5#ifndef __KERNEL__
6#include <netinet/in.h> /* for sockaddr_in and sockaddr_in6 */
7#include <sys/socket.h> /* for struct sockaddr */
8#endif
9
10#include <linux/const.h>
11#include <linux/types.h>
12#include <linux/in.h> /* for sockaddr_in */
13#include <linux/in6.h> /* for sockaddr_in6 */
14#include <linux/socket.h> /* for sockaddr_storage and sa_family */
15
16#define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
17#define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
18#define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)
19#define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3)
20#define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4)
21#define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5)
22#define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6)
23#define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7)
24#define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8)
25
26#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
27#define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
28
29#include <linux/mptcp_pm.h>
30
31#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
32#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
33
34#define MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 _BITUL(0)
35#define MPTCP_PM_EV_FLAG_SERVER_SIDE _BITUL(1)
36
37#define MPTCP_PM_ADDR_FLAG_SIGNAL _BITUL(0)
38#define MPTCP_PM_ADDR_FLAG_SUBFLOW _BITUL(1)
39#define MPTCP_PM_ADDR_FLAG_BACKUP _BITUL(2)
40#define MPTCP_PM_ADDR_FLAG_FULLMESH _BITUL(3)
41#define MPTCP_PM_ADDR_FLAG_IMPLICIT _BITUL(4)
42#define MPTCP_PM_ADDR_FLAG_LAMINAR _BITUL(5)
43#define MPTCP_PM_ADDR_FLAGS_MASK GENMASK(5, 0)
44
45struct mptcp_info {
46 __u8 mptcpi_subflows;
47 #define mptcpi_extra_subflows mptcpi_subflows
48 __u8 mptcpi_add_addr_signal;
49 __u8 mptcpi_add_addr_accepted;
50 __u8 mptcpi_subflows_max;
51 #define mptcpi_limit_extra_subflows mptcpi_subflows_max
52 __u8 mptcpi_add_addr_signal_max;
53 #define mptcpi_endp_signal_max mptcpi_add_addr_signal_max
54 __u8 mptcpi_add_addr_accepted_max;
55 #define mptcpi_limit_add_addr_accepted mptcpi_add_addr_accepted_max
56 /* 16-bit hole that can no longer be filled */
57 __u32 mptcpi_flags;
58 __u32 mptcpi_token;
59 __u64 mptcpi_write_seq;
60 __u64 mptcpi_snd_una;
61 __u64 mptcpi_rcv_nxt;
62 __u8 mptcpi_local_addr_used;
63 __u8 mptcpi_local_addr_max;
64 #define mptcpi_endp_subflow_max mptcpi_local_addr_max
65 __u8 mptcpi_csum_enabled;
66 /* 8-bit hole that can no longer be filled */
67 __u32 mptcpi_retransmits;
68 __u64 mptcpi_bytes_retrans;
69 __u64 mptcpi_bytes_sent;
70 __u64 mptcpi_bytes_received;
71 __u64 mptcpi_bytes_acked;
72 __u8 mptcpi_subflows_total;
73 __u8 mptcpi_endp_laminar_max;
74 __u8 mptcpi_endp_fullmesh_max;
75 __u8 reserved;
76 __u32 mptcpi_last_data_sent;
77 __u32 mptcpi_last_data_recv;
78 __u32 mptcpi_last_ack_recv;
79};
80
81/* MPTCP Reset reason codes, rfc8684 */
82#define MPTCP_RST_EUNSPEC 0
83#define MPTCP_RST_EMPTCP 1
84#define MPTCP_RST_ERESOURCE 2
85#define MPTCP_RST_EPROHIBIT 3
86#define MPTCP_RST_EWQ2BIG 4
87#define MPTCP_RST_EBADPERF 5
88#define MPTCP_RST_EMIDDLEBOX 6
89
90struct mptcp_subflow_data {
91 __u32 size_subflow_data; /* size of this structure in userspace */
92 __u32 num_subflows; /* must be 0, set by kernel */
93 __u32 size_kernel; /* must be 0, set by kernel */
94 __u32 size_user; /* size of one element in data[] */
95} __attribute__((aligned(8)));
96
97struct mptcp_subflow_addrs {
98 union {
99 __kernel_sa_family_t sa_family;
100 struct sockaddr sa_local;
101 struct sockaddr_in sin_local;
102 struct sockaddr_in6 sin6_local;
103 struct __kernel_sockaddr_storage ss_local;
104 };
105 union {
106 struct sockaddr sa_remote;
107 struct sockaddr_in sin_remote;
108 struct sockaddr_in6 sin6_remote;
109 struct __kernel_sockaddr_storage ss_remote;
110 };
111};
112
113struct mptcp_subflow_info {
114 __u32 id;
115 struct mptcp_subflow_addrs addrs;
116};
117
118struct mptcp_full_info {
119 __u32 size_tcpinfo_kernel; /* must be 0, set by kernel */
120 __u32 size_tcpinfo_user;
121 __u32 size_sfinfo_kernel; /* must be 0, set by kernel */
122 __u32 size_sfinfo_user;
123 __u32 num_subflows; /* must be 0, set by kernel (real subflow count) */
124 __u32 size_arrays_user; /* max subflows that userspace is interested in;
125 * the buffers at subflow_info/tcp_info
126 * are respectively at least:
127 * size_arrays * size_sfinfo_user
128 * size_arrays * size_tcpinfo_user
129 * bytes wide
130 */
131 __aligned_u64 subflow_info;
132 __aligned_u64 tcp_info;
133 struct mptcp_info mptcp_info;
134};
135
136/* MPTCP socket options */
137#define MPTCP_INFO 1
138#define MPTCP_TCPINFO 2
139#define MPTCP_SUBFLOW_ADDRS 3
140#define MPTCP_FULL_INFO 4
141
142#endif /* _UAPI_MPTCP_H */