1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6 #include <netinet/in.h> /* for sockaddr_in and sockaddr_in6 */
7 #include <sys/socket.h> /* for struct sockaddr */
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 */
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)
26 #define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
27 #define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
29 #include <linux/mptcp_pm.h>
31 #define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
32 #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
34 #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
35 #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
36 #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
37 #define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
38 #define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4)
42 __u8 mptcpi_add_addr_signal;
43 __u8 mptcpi_add_addr_accepted;
44 __u8 mptcpi_subflows_max;
45 __u8 mptcpi_add_addr_signal_max;
46 __u8 mptcpi_add_addr_accepted_max;
49 __u64 mptcpi_write_seq;
52 __u8 mptcpi_local_addr_used;
53 __u8 mptcpi_local_addr_max;
54 __u8 mptcpi_csum_enabled;
55 __u32 mptcpi_retransmits;
56 __u64 mptcpi_bytes_retrans;
57 __u64 mptcpi_bytes_sent;
58 __u64 mptcpi_bytes_received;
59 __u64 mptcpi_bytes_acked;
62 /* MPTCP Reset reason codes, rfc8684 */
63 #define MPTCP_RST_EUNSPEC 0
64 #define MPTCP_RST_EMPTCP 1
65 #define MPTCP_RST_ERESOURCE 2
66 #define MPTCP_RST_EPROHIBIT 3
67 #define MPTCP_RST_EWQ2BIG 4
68 #define MPTCP_RST_EBADPERF 5
69 #define MPTCP_RST_EMIDDLEBOX 6
71 struct mptcp_subflow_data {
72 __u32 size_subflow_data; /* size of this structure in userspace */
73 __u32 num_subflows; /* must be 0, set by kernel */
74 __u32 size_kernel; /* must be 0, set by kernel */
75 __u32 size_user; /* size of one element in data[] */
76 } __attribute__((aligned(8)));
78 struct mptcp_subflow_addrs {
80 __kernel_sa_family_t sa_family;
81 struct sockaddr sa_local;
82 struct sockaddr_in sin_local;
83 struct sockaddr_in6 sin6_local;
84 struct __kernel_sockaddr_storage ss_local;
87 struct sockaddr sa_remote;
88 struct sockaddr_in sin_remote;
89 struct sockaddr_in6 sin6_remote;
90 struct __kernel_sockaddr_storage ss_remote;
94 struct mptcp_subflow_info {
96 struct mptcp_subflow_addrs addrs;
99 struct mptcp_full_info {
100 __u32 size_tcpinfo_kernel; /* must be 0, set by kernel */
101 __u32 size_tcpinfo_user;
102 __u32 size_sfinfo_kernel; /* must be 0, set by kernel */
103 __u32 size_sfinfo_user;
104 __u32 num_subflows; /* must be 0, set by kernel (real subflow count) */
105 __u32 size_arrays_user; /* max subflows that userspace is interested in;
106 * the buffers at subflow_info/tcp_info
107 * are respectively at least:
108 * size_arrays * size_sfinfo_user
109 * size_arrays * size_tcpinfo_user
112 __aligned_u64 subflow_info;
113 __aligned_u64 tcp_info;
114 struct mptcp_info mptcp_info;
117 /* MPTCP socket options */
119 #define MPTCP_TCPINFO 2
120 #define MPTCP_SUBFLOW_ADDRS 3
121 #define MPTCP_FULL_INFO 4
123 #endif /* _UAPI_MPTCP_H */