blob: d97f29bd844cb134982509f5123043d15f391dec [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferrisaf09c702020-06-01 20:29:29 -07007#ifndef _UAPI_MPTCP_H
8#define _UAPI_MPTCP_H
Christopher Ferris80ae69d2022-08-02 16:32:21 -07009#include <netinet/in.h>
10#include <sys/socket.h>
Christopher Ferrisaf09c702020-06-01 20:29:29 -070011#include <linux/const.h>
12#include <linux/types.h>
Christopher Ferrisa4792612022-01-10 13:51:15 -080013#include <linux/in.h>
14#include <linux/in6.h>
15#include <linux/socket.h>
Christopher Ferrisaf09c702020-06-01 20:29:29 -070016#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)
25enum {
26 MPTCP_SUBFLOW_ATTR_UNSPEC,
27 MPTCP_SUBFLOW_ATTR_TOKEN_REM,
28 MPTCP_SUBFLOW_ATTR_TOKEN_LOC,
29 MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ,
30 MPTCP_SUBFLOW_ATTR_MAP_SEQ,
31 MPTCP_SUBFLOW_ATTR_MAP_SFSEQ,
32 MPTCP_SUBFLOW_ATTR_SSN_OFFSET,
33 MPTCP_SUBFLOW_ATTR_MAP_DATALEN,
34 MPTCP_SUBFLOW_ATTR_FLAGS,
35 MPTCP_SUBFLOW_ATTR_ID_REM,
36 MPTCP_SUBFLOW_ATTR_ID_LOC,
37 MPTCP_SUBFLOW_ATTR_PAD,
38 __MPTCP_SUBFLOW_ATTR_MAX
39};
40#define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1)
41#define MPTCP_PM_NAME "mptcp_pm"
42#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070043#define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
Christopher Ferrisaf09c702020-06-01 20:29:29 -070044#define MPTCP_PM_VER 0x1
45enum {
46 MPTCP_PM_ATTR_UNSPEC,
47 MPTCP_PM_ATTR_ADDR,
48 MPTCP_PM_ATTR_RCV_ADD_ADDRS,
49 MPTCP_PM_ATTR_SUBFLOWS,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070050 MPTCP_PM_ATTR_TOKEN,
51 MPTCP_PM_ATTR_LOC_ID,
52 MPTCP_PM_ATTR_ADDR_REMOTE,
Christopher Ferrisaf09c702020-06-01 20:29:29 -070053 __MPTCP_PM_ATTR_MAX
54};
55#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
56enum {
57 MPTCP_PM_ADDR_ATTR_UNSPEC,
58 MPTCP_PM_ADDR_ATTR_FAMILY,
59 MPTCP_PM_ADDR_ATTR_ID,
60 MPTCP_PM_ADDR_ATTR_ADDR4,
61 MPTCP_PM_ADDR_ATTR_ADDR6,
62 MPTCP_PM_ADDR_ATTR_PORT,
63 MPTCP_PM_ADDR_ATTR_FLAGS,
64 MPTCP_PM_ADDR_ATTR_IF_IDX,
65 __MPTCP_PM_ADDR_ATTR_MAX
66};
67#define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1)
68#define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
69#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
70#define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070071#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
Christopher Ferris10a76e62022-06-08 13:31:52 -070072#define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070073enum {
74 MPTCP_PM_CMD_UNSPEC,
75 MPTCP_PM_CMD_ADD_ADDR,
76 MPTCP_PM_CMD_DEL_ADDR,
77 MPTCP_PM_CMD_GET_ADDR,
78 MPTCP_PM_CMD_FLUSH_ADDRS,
79 MPTCP_PM_CMD_SET_LIMITS,
80 MPTCP_PM_CMD_GET_LIMITS,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070081 MPTCP_PM_CMD_SET_FLAGS,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070082 MPTCP_PM_CMD_ANNOUNCE,
83 MPTCP_PM_CMD_REMOVE,
84 MPTCP_PM_CMD_SUBFLOW_CREATE,
85 MPTCP_PM_CMD_SUBFLOW_DESTROY,
Christopher Ferrisaf09c702020-06-01 20:29:29 -070086 __MPTCP_PM_CMD_AFTER_LAST
87};
Christopher Ferris25c18d42020-10-14 17:42:58 -070088#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
89#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
90struct mptcp_info {
91 __u8 mptcpi_subflows;
92 __u8 mptcpi_add_addr_signal;
93 __u8 mptcpi_add_addr_accepted;
94 __u8 mptcpi_subflows_max;
95 __u8 mptcpi_add_addr_signal_max;
96 __u8 mptcpi_add_addr_accepted_max;
97 __u32 mptcpi_flags;
98 __u32 mptcpi_token;
99 __u64 mptcpi_write_seq;
100 __u64 mptcpi_snd_una;
101 __u64 mptcpi_rcv_nxt;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700102 __u8 mptcpi_local_addr_used;
103 __u8 mptcpi_local_addr_max;
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000104 __u8 mptcpi_csum_enabled;
Christopher Ferris8666d042023-09-06 14:55:31 -0700105 __u32 mptcpi_retransmits;
106 __u64 mptcpi_bytes_retrans;
107 __u64 mptcpi_bytes_sent;
108 __u64 mptcpi_bytes_received;
109 __u64 mptcpi_bytes_acked;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700110};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700111enum mptcp_event_type {
112 MPTCP_EVENT_UNSPEC = 0,
113 MPTCP_EVENT_CREATED = 1,
114 MPTCP_EVENT_ESTABLISHED = 2,
115 MPTCP_EVENT_CLOSED = 3,
116 MPTCP_EVENT_ANNOUNCED = 6,
117 MPTCP_EVENT_REMOVED = 7,
118 MPTCP_EVENT_SUB_ESTABLISHED = 10,
119 MPTCP_EVENT_SUB_CLOSED = 11,
120 MPTCP_EVENT_SUB_PRIORITY = 13,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800121 MPTCP_EVENT_LISTENER_CREATED = 15,
122 MPTCP_EVENT_LISTENER_CLOSED = 16,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700123};
124enum mptcp_event_attr {
125 MPTCP_ATTR_UNSPEC = 0,
126 MPTCP_ATTR_TOKEN,
127 MPTCP_ATTR_FAMILY,
128 MPTCP_ATTR_LOC_ID,
129 MPTCP_ATTR_REM_ID,
130 MPTCP_ATTR_SADDR4,
131 MPTCP_ATTR_SADDR6,
132 MPTCP_ATTR_DADDR4,
133 MPTCP_ATTR_DADDR6,
134 MPTCP_ATTR_SPORT,
135 MPTCP_ATTR_DPORT,
136 MPTCP_ATTR_BACKUP,
137 MPTCP_ATTR_ERROR,
138 MPTCP_ATTR_FLAGS,
139 MPTCP_ATTR_TIMEOUT,
140 MPTCP_ATTR_IF_IDX,
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000141 MPTCP_ATTR_RESET_REASON,
142 MPTCP_ATTR_RESET_FLAGS,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700143 MPTCP_ATTR_SERVER_SIDE,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700144 __MPTCP_ATTR_AFTER_LAST
145};
146#define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000147#define MPTCP_RST_EUNSPEC 0
148#define MPTCP_RST_EMPTCP 1
149#define MPTCP_RST_ERESOURCE 2
150#define MPTCP_RST_EPROHIBIT 3
151#define MPTCP_RST_EWQ2BIG 4
152#define MPTCP_RST_EBADPERF 5
153#define MPTCP_RST_EMIDDLEBOX 6
Christopher Ferrisa4792612022-01-10 13:51:15 -0800154struct mptcp_subflow_data {
155 __u32 size_subflow_data;
156 __u32 num_subflows;
157 __u32 size_kernel;
158 __u32 size_user;
159} __attribute__((aligned(8)));
160struct mptcp_subflow_addrs {
161 union {
162 __kernel_sa_family_t sa_family;
163 struct sockaddr sa_local;
164 struct sockaddr_in sin_local;
165 struct sockaddr_in6 sin6_local;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800166 struct sockaddr_storage ss_local;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800167 };
168 union {
169 struct sockaddr sa_remote;
170 struct sockaddr_in sin_remote;
171 struct sockaddr_in6 sin6_remote;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800172 struct sockaddr_storage ss_remote;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800173 };
174};
Christopher Ferris8666d042023-09-06 14:55:31 -0700175struct mptcp_subflow_info {
176 __u32 id;
177 struct mptcp_subflow_addrs addrs;
178};
179struct mptcp_full_info {
180 __u32 size_tcpinfo_kernel;
181 __u32 size_tcpinfo_user;
182 __u32 size_sfinfo_kernel;
183 __u32 size_sfinfo_user;
184 __u32 num_subflows;
185 __u32 size_arrays_user;
186 __aligned_u64 subflow_info;
187 __aligned_u64 tcp_info;
188 struct mptcp_info mptcp_info;
189};
Christopher Ferrisa4792612022-01-10 13:51:15 -0800190#define MPTCP_INFO 1
191#define MPTCP_TCPINFO 2
192#define MPTCP_SUBFLOW_ADDRS 3
Christopher Ferris8666d042023-09-06 14:55:31 -0700193#define MPTCP_FULL_INFO 4
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700194#endif