• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 #ifndef _UAPI_MPTCP_H
3 #define _UAPI_MPTCP_H
4 
5 #include <linux/const.h>
6 #include <linux/types.h>
7 
8 #define MPTCP_SUBFLOW_FLAG_MCAP_REM		_BITUL(0)
9 #define MPTCP_SUBFLOW_FLAG_MCAP_LOC		_BITUL(1)
10 #define MPTCP_SUBFLOW_FLAG_JOIN_REM		_BITUL(2)
11 #define MPTCP_SUBFLOW_FLAG_JOIN_LOC		_BITUL(3)
12 #define MPTCP_SUBFLOW_FLAG_BKUP_REM		_BITUL(4)
13 #define MPTCP_SUBFLOW_FLAG_BKUP_LOC		_BITUL(5)
14 #define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED	_BITUL(6)
15 #define MPTCP_SUBFLOW_FLAG_CONNECTED		_BITUL(7)
16 #define MPTCP_SUBFLOW_FLAG_MAPVALID		_BITUL(8)
17 
18 enum {
19 	MPTCP_SUBFLOW_ATTR_UNSPEC,
20 	MPTCP_SUBFLOW_ATTR_TOKEN_REM,
21 	MPTCP_SUBFLOW_ATTR_TOKEN_LOC,
22 	MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ,
23 	MPTCP_SUBFLOW_ATTR_MAP_SEQ,
24 	MPTCP_SUBFLOW_ATTR_MAP_SFSEQ,
25 	MPTCP_SUBFLOW_ATTR_SSN_OFFSET,
26 	MPTCP_SUBFLOW_ATTR_MAP_DATALEN,
27 	MPTCP_SUBFLOW_ATTR_FLAGS,
28 	MPTCP_SUBFLOW_ATTR_ID_REM,
29 	MPTCP_SUBFLOW_ATTR_ID_LOC,
30 	MPTCP_SUBFLOW_ATTR_PAD,
31 	__MPTCP_SUBFLOW_ATTR_MAX
32 };
33 
34 #define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1)
35 
36 /* netlink interface */
37 #define MPTCP_PM_NAME		"mptcp_pm"
38 #define MPTCP_PM_CMD_GRP_NAME	"mptcp_pm_cmds"
39 #define MPTCP_PM_EV_GRP_NAME	"mptcp_pm_events"
40 #define MPTCP_PM_VER		0x1
41 
42 /*
43  * ATTR types defined for MPTCP
44  */
45 enum {
46 	MPTCP_PM_ATTR_UNSPEC,
47 
48 	MPTCP_PM_ATTR_ADDR,				/* nested address */
49 	MPTCP_PM_ATTR_RCV_ADD_ADDRS,			/* u32 */
50 	MPTCP_PM_ATTR_SUBFLOWS,				/* u32 */
51 
52 	__MPTCP_PM_ATTR_MAX
53 };
54 
55 #define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
56 
57 enum {
58 	MPTCP_PM_ADDR_ATTR_UNSPEC,
59 
60 	MPTCP_PM_ADDR_ATTR_FAMILY,			/* u16 */
61 	MPTCP_PM_ADDR_ATTR_ID,				/* u8 */
62 	MPTCP_PM_ADDR_ATTR_ADDR4,			/* struct in_addr */
63 	MPTCP_PM_ADDR_ATTR_ADDR6,			/* struct in6_addr */
64 	MPTCP_PM_ADDR_ATTR_PORT,			/* u16 */
65 	MPTCP_PM_ADDR_ATTR_FLAGS,			/* u32 */
66 	MPTCP_PM_ADDR_ATTR_IF_IDX,			/* s32 */
67 
68 	__MPTCP_PM_ADDR_ATTR_MAX
69 };
70 
71 #define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1)
72 
73 #define MPTCP_PM_ADDR_FLAG_SIGNAL			(1 << 0)
74 #define MPTCP_PM_ADDR_FLAG_SUBFLOW			(1 << 1)
75 #define MPTCP_PM_ADDR_FLAG_BACKUP			(1 << 2)
76 
77 enum {
78 	MPTCP_PM_CMD_UNSPEC,
79 
80 	MPTCP_PM_CMD_ADD_ADDR,
81 	MPTCP_PM_CMD_DEL_ADDR,
82 	MPTCP_PM_CMD_GET_ADDR,
83 	MPTCP_PM_CMD_FLUSH_ADDRS,
84 	MPTCP_PM_CMD_SET_LIMITS,
85 	MPTCP_PM_CMD_GET_LIMITS,
86 	MPTCP_PM_CMD_SET_FLAGS,
87 
88 	__MPTCP_PM_CMD_AFTER_LAST
89 };
90 
91 #define MPTCP_INFO_FLAG_FALLBACK		_BITUL(0)
92 #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED	_BITUL(1)
93 
94 struct mptcp_info {
95 	__u8	mptcpi_subflows;
96 	__u8	mptcpi_add_addr_signal;
97 	__u8	mptcpi_add_addr_accepted;
98 	__u8	mptcpi_subflows_max;
99 	__u8	mptcpi_add_addr_signal_max;
100 	__u8	mptcpi_add_addr_accepted_max;
101 	__u32	mptcpi_flags;
102 	__u32	mptcpi_token;
103 	__u64	mptcpi_write_seq;
104 	__u64	mptcpi_snd_una;
105 	__u64	mptcpi_rcv_nxt;
106 	__u8	mptcpi_local_addr_used;
107 	__u8	mptcpi_local_addr_max;
108 };
109 
110 /*
111  * MPTCP_EVENT_CREATED: token, family, saddr4 | saddr6, daddr4 | daddr6,
112  *                      sport, dport
113  * A new MPTCP connection has been created. It is the good time to allocate
114  * memory and send ADD_ADDR if needed. Depending on the traffic-patterns
115  * it can take a long time until the MPTCP_EVENT_ESTABLISHED is sent.
116  *
117  * MPTCP_EVENT_ESTABLISHED: token, family, saddr4 | saddr6, daddr4 | daddr6,
118  *			    sport, dport
119  * A MPTCP connection is established (can start new subflows).
120  *
121  * MPTCP_EVENT_CLOSED: token
122  * A MPTCP connection has stopped.
123  *
124  * MPTCP_EVENT_ANNOUNCED: token, rem_id, family, daddr4 | daddr6 [, dport]
125  * A new address has been announced by the peer.
126  *
127  * MPTCP_EVENT_REMOVED: token, rem_id
128  * An address has been lost by the peer.
129  *
130  * MPTCP_EVENT_SUB_ESTABLISHED: token, family, saddr4 | saddr6,
131  *                              daddr4 | daddr6, sport, dport, backup,
132  *                              if_idx [, error]
133  * A new subflow has been established. 'error' should not be set.
134  *
135  * MPTCP_EVENT_SUB_CLOSED: token, family, saddr4 | saddr6, daddr4 | daddr6,
136  *                         sport, dport, backup, if_idx [, error]
137  * A subflow has been closed. An error (copy of sk_err) could be set if an
138  * error has been detected for this subflow.
139  *
140  * MPTCP_EVENT_SUB_PRIORITY: token, family, saddr4 | saddr6, daddr4 | daddr6,
141  *                           sport, dport, backup, if_idx [, error]
142  *       The priority of a subflow has changed. 'error' should not be set.
143  */
144 enum mptcp_event_type {
145 	MPTCP_EVENT_UNSPEC = 0,
146 	MPTCP_EVENT_CREATED = 1,
147 	MPTCP_EVENT_ESTABLISHED = 2,
148 	MPTCP_EVENT_CLOSED = 3,
149 
150 	MPTCP_EVENT_ANNOUNCED = 6,
151 	MPTCP_EVENT_REMOVED = 7,
152 
153 	MPTCP_EVENT_SUB_ESTABLISHED = 10,
154 	MPTCP_EVENT_SUB_CLOSED = 11,
155 
156 	MPTCP_EVENT_SUB_PRIORITY = 13,
157 };
158 
159 enum mptcp_event_attr {
160 	MPTCP_ATTR_UNSPEC = 0,
161 
162 	MPTCP_ATTR_TOKEN,	/* u32 */
163 	MPTCP_ATTR_FAMILY,	/* u16 */
164 	MPTCP_ATTR_LOC_ID,	/* u8 */
165 	MPTCP_ATTR_REM_ID,	/* u8 */
166 	MPTCP_ATTR_SADDR4,	/* be32 */
167 	MPTCP_ATTR_SADDR6,	/* struct in6_addr */
168 	MPTCP_ATTR_DADDR4,	/* be32 */
169 	MPTCP_ATTR_DADDR6,	/* struct in6_addr */
170 	MPTCP_ATTR_SPORT,	/* be16 */
171 	MPTCP_ATTR_DPORT,	/* be16 */
172 	MPTCP_ATTR_BACKUP,	/* u8 */
173 	MPTCP_ATTR_ERROR,	/* u8 */
174 	MPTCP_ATTR_FLAGS,	/* u16 */
175 	MPTCP_ATTR_TIMEOUT,	/* u32 */
176 	MPTCP_ATTR_IF_IDX,	/* s32 */
177 
178 	__MPTCP_ATTR_AFTER_LAST
179 };
180 
181 #define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
182 
183 #endif /* _UAPI_MPTCP_H */
184