Branch data Line data Source code
1 : : /* SPDX-License-Identifier: GPL-2.0 */
2 : : /* Multipath TCP
3 : : *
4 : : * Copyright (c) 2017 - 2019, Intel Corporation.
5 : : */
6 : :
7 : : #ifndef __MPTCP_PROTOCOL_H
8 : : #define __MPTCP_PROTOCOL_H
9 : :
10 : : #include <linux/random.h>
11 : : #include <net/tcp.h>
12 : : #include <net/inet_connection_sock.h>
13 : : #include <uapi/linux/mptcp.h>
14 : : #include <net/genetlink.h>
15 : : #include <net/rstreason.h>
16 : :
17 : : #define MPTCP_SUPPORTED_VERSION 1
18 : :
19 : : /* MPTCP option bits */
20 : : #define OPTION_MPTCP_MPC_SYN BIT(0)
21 : : #define OPTION_MPTCP_MPC_SYNACK BIT(1)
22 : : #define OPTION_MPTCP_MPC_ACK BIT(2)
23 : : #define OPTION_MPTCP_MPJ_SYN BIT(3)
24 : : #define OPTION_MPTCP_MPJ_SYNACK BIT(4)
25 : : #define OPTION_MPTCP_MPJ_ACK BIT(5)
26 : : #define OPTION_MPTCP_ADD_ADDR BIT(6)
27 : : #define OPTION_MPTCP_RM_ADDR BIT(7)
28 : : #define OPTION_MPTCP_FASTCLOSE BIT(8)
29 : : #define OPTION_MPTCP_PRIO BIT(9)
30 : : #define OPTION_MPTCP_RST BIT(10)
31 : : #define OPTION_MPTCP_DSS BIT(11)
32 : : #define OPTION_MPTCP_FAIL BIT(12)
33 : :
34 : : #define OPTION_MPTCP_CSUMREQD BIT(13)
35 : :
36 : : #define OPTIONS_MPTCP_MPC (OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK | \
37 : : OPTION_MPTCP_MPC_ACK)
38 : : #define OPTIONS_MPTCP_MPJ (OPTION_MPTCP_MPJ_SYN | OPTION_MPTCP_MPJ_SYNACK | \
39 : : OPTION_MPTCP_MPJ_ACK)
40 : : #define OPTIONS_MPTCP_DSS (OPTION_MPTCP_DSS | OPTION_MPTCP_CSUMREQD)
41 : :
42 : : /* MPTCP option subtypes */
43 : : #define MPTCPOPT_MP_CAPABLE 0
44 : : #define MPTCPOPT_MP_JOIN 1
45 : : #define MPTCPOPT_DSS 2
46 : : #define MPTCPOPT_ADD_ADDR 3
47 : : #define MPTCPOPT_RM_ADDR 4
48 : : #define MPTCPOPT_MP_PRIO 5
49 : : #define MPTCPOPT_MP_FAIL 6
50 : : #define MPTCPOPT_MP_FASTCLOSE 7
51 : : #define MPTCPOPT_RST 8
52 : :
53 : : /* MPTCP suboption lengths */
54 : : #define TCPOLEN_MPTCP_MPC_SYN 4
55 : : #define TCPOLEN_MPTCP_MPC_SYNACK 12
56 : : #define TCPOLEN_MPTCP_MPC_ACK 20
57 : : #define TCPOLEN_MPTCP_MPC_ACK_DATA 22
58 : : #define TCPOLEN_MPTCP_MPJ_SYN 12
59 : : #define TCPOLEN_MPTCP_MPJ_SYNACK 16
60 : : #define TCPOLEN_MPTCP_MPJ_ACK 24
61 : : #define TCPOLEN_MPTCP_DSS_BASE 4
62 : : #define TCPOLEN_MPTCP_DSS_ACK32 4
63 : : #define TCPOLEN_MPTCP_DSS_ACK64 8
64 : : #define TCPOLEN_MPTCP_DSS_MAP32 10
65 : : #define TCPOLEN_MPTCP_DSS_MAP64 14
66 : : #define TCPOLEN_MPTCP_DSS_CHECKSUM 2
67 : : #define TCPOLEN_MPTCP_ADD_ADDR 16
68 : : #define TCPOLEN_MPTCP_ADD_ADDR_PORT 18
69 : : #define TCPOLEN_MPTCP_ADD_ADDR_BASE 8
70 : : #define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 10
71 : : #define TCPOLEN_MPTCP_ADD_ADDR6 28
72 : : #define TCPOLEN_MPTCP_ADD_ADDR6_PORT 30
73 : : #define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20
74 : : #define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 22
75 : : #define TCPOLEN_MPTCP_PORT_LEN 2
76 : : #define TCPOLEN_MPTCP_PORT_ALIGN 2
77 : : #define TCPOLEN_MPTCP_RM_ADDR_BASE 3
78 : : #define TCPOLEN_MPTCP_PRIO 3
79 : : #define TCPOLEN_MPTCP_PRIO_ALIGN 4
80 : : #define TCPOLEN_MPTCP_FASTCLOSE 12
81 : : #define TCPOLEN_MPTCP_RST 4
82 : : #define TCPOLEN_MPTCP_FAIL 12
83 : :
84 : : #define TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM (TCPOLEN_MPTCP_DSS_CHECKSUM + TCPOLEN_MPTCP_MPC_ACK_DATA)
85 : :
86 : : /* MPTCP MP_JOIN flags */
87 : : #define MPTCPOPT_BACKUP BIT(0)
88 : : #define MPTCPOPT_THMAC_LEN 8
89 : :
90 : : /* MPTCP MP_CAPABLE flags */
91 : : #define MPTCP_VERSION_MASK (0x0F)
92 : : #define MPTCP_CAP_CHECKSUM_REQD BIT(7)
93 : : #define MPTCP_CAP_EXTENSIBILITY BIT(6)
94 : : #define MPTCP_CAP_DENY_JOIN_ID0 BIT(5)
95 : : #define MPTCP_CAP_HMAC_SHA256 BIT(0)
96 : : #define MPTCP_CAP_FLAG_MASK (0x1F)
97 : :
98 : : /* MPTCP DSS flags */
99 : : #define MPTCP_DSS_DATA_FIN BIT(4)
100 : : #define MPTCP_DSS_DSN64 BIT(3)
101 : : #define MPTCP_DSS_HAS_MAP BIT(2)
102 : : #define MPTCP_DSS_ACK64 BIT(1)
103 : : #define MPTCP_DSS_HAS_ACK BIT(0)
104 : : #define MPTCP_DSS_FLAG_MASK (0x1F)
105 : :
106 : : /* MPTCP ADD_ADDR flags */
107 : : #define MPTCP_ADDR_ECHO BIT(0)
108 : :
109 : : /* MPTCP MP_PRIO flags */
110 : : #define MPTCP_PRIO_BKUP BIT(0)
111 : :
112 : : /* MPTCP TCPRST flags */
113 : : #define MPTCP_RST_TRANSIENT BIT(0)
114 : :
115 : : /* MPTCP socket atomic flags */
116 : : #define MPTCP_WORK_RTX 1
117 : : #define MPTCP_FALLBACK_DONE 2
118 : : #define MPTCP_WORK_CLOSE_SUBFLOW 3
119 : : #define MPTCP_RTX_ENABLED 4
120 : :
121 : : /* MPTCP socket release cb flags */
122 : : #define MPTCP_PUSH_PENDING 1
123 : : #define MPTCP_CLEAN_UNA 2
124 : : #define MPTCP_ERROR_REPORT 3
125 : : #define MPTCP_RETRANSMIT 4
126 : : #define MPTCP_FLUSH_JOIN_LIST 5
127 : : #define MPTCP_SYNC_STATE 6
128 : : #define MPTCP_SYNC_SNDBUF 7
129 : :
130 : : struct mptcp_skb_cb {
131 : : u64 map_seq;
132 : : u64 end_seq;
133 : : u32 offset;
134 : : u8 has_rxtstamp;
135 : : u8 cant_coalesce;
136 : : };
137 : :
138 : : #define MPTCP_SKB_CB(__skb) ((struct mptcp_skb_cb *)&((__skb)->cb[0]))
139 : :
140 : 24 : static inline bool before64(__u64 seq1, __u64 seq2)
141 : : {
142 [ + ][ + + + : 13306861 : return (__s64)(seq1 - seq2) < 0;
+ + + +
+ ][ + + +
+ + + + +
+ + + + +
+ + + + +
+ - ][ + ]
[ + + - +
+ + + + ]
[ + - + +
+ + + + +
+ + + + +
+ + + + +
- ]
143 : : }
144 : :
145 : : #define after64(seq2, seq1) before64(seq1, seq2)
146 : :
147 : : struct mptcp_options_received {
148 : : u64 sndr_key;
149 : : u64 rcvr_key;
150 : : u64 data_ack;
151 : : u64 data_seq;
152 : : u32 subflow_seq;
153 : : u16 data_len;
154 : : __sum16 csum;
155 : : struct_group(status,
156 : : u16 suboptions;
157 : : u16 use_map:1,
158 : : dsn64:1,
159 : : data_fin:1,
160 : : use_ack:1,
161 : : ack64:1,
162 : : mpc_map:1,
163 : : reset_reason:4,
164 : : reset_transient:1,
165 : : echo:1,
166 : : backup:1,
167 : : deny_join_id0:1,
168 : : __unused:2;
169 : : );
170 : : u8 join_id;
171 : : u32 token;
172 : : u32 nonce;
173 : : u64 thmac;
174 : : u8 hmac[MPTCPOPT_HMAC_LEN];
175 : : struct mptcp_addr_info addr;
176 : : struct mptcp_rm_list rm_list;
177 : : u64 ahmac;
178 : : u64 fail_seq;
179 : : };
180 : :
181 : 0 : static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
182 : : {
183 [ - + + ]: 1752472 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
[ - + + - ]
184 : : ((nib & 0xF) << 8) | field);
185 : : }
186 : :
187 : : enum mptcp_pm_status {
188 : : MPTCP_PM_ADD_ADDR_RECEIVED,
189 : : MPTCP_PM_ADD_ADDR_SEND_ACK,
190 : : MPTCP_PM_RM_ADDR_RECEIVED,
191 : : MPTCP_PM_ESTABLISHED,
192 : : MPTCP_PM_SUBFLOW_ESTABLISHED,
193 : : MPTCP_PM_ALREADY_ESTABLISHED, /* persistent status, set after ESTABLISHED event */
194 : : MPTCP_PM_MPC_ENDPOINT_ACCOUNTED, /* persistent status, set after MPC local address is
195 : : * accounted int id_avail_bitmap
196 : : */
197 : : MPTCP_PM_DESTROYING, /* To fence out PM list allocs */
198 : : };
199 : :
200 : : enum mptcp_pm_type {
201 : : MPTCP_PM_TYPE_KERNEL = 0,
202 : : MPTCP_PM_TYPE_USERSPACE,
203 : :
204 : : __MPTCP_PM_TYPE_NR,
205 : : __MPTCP_PM_TYPE_MAX = __MPTCP_PM_TYPE_NR - 1,
206 : : };
207 : :
208 : : /* Status bits below MPTCP_PM_ALREADY_ESTABLISHED need pm worker actions */
209 : : #define MPTCP_PM_WORK_MASK ((1 << MPTCP_PM_ALREADY_ESTABLISHED) - 1)
210 : :
211 : : enum mptcp_addr_signal_status {
212 : : MPTCP_ADD_ADDR_SIGNAL,
213 : : MPTCP_ADD_ADDR_ECHO,
214 : : MPTCP_RM_ADDR_SIGNAL,
215 : : };
216 : :
217 : : /* max value of mptcp_addr_info.id */
218 : : #define MPTCP_PM_MAX_ADDR_ID U8_MAX
219 : :
220 : : struct mptcp_pm_data {
221 : : struct mptcp_addr_info local;
222 : : struct mptcp_addr_info remote;
223 : : struct list_head anno_list;
224 : : struct list_head userspace_pm_local_addr_list;
225 : :
226 : : spinlock_t lock; /*protects the whole PM data */
227 : :
228 : : struct_group(reset,
229 : :
230 : : u8 addr_signal;
231 : : bool server_side;
232 : : bool work_pending;
233 : : bool accept_addr;
234 : : bool accept_subflow;
235 : : bool remote_deny_join_id0;
236 : : u8 add_addr_signaled;
237 : : u8 add_addr_accepted;
238 : : u8 local_addr_used;
239 : : u8 pm_type;
240 : : u8 extra_subflows;
241 : : u8 status;
242 : :
243 : : );
244 : :
245 : : DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
246 : : struct mptcp_rm_list rm_list_tx;
247 : : struct mptcp_rm_list rm_list_rx;
248 : : };
249 : :
250 : : struct mptcp_pm_local {
251 : : struct mptcp_addr_info addr;
252 : : u32 flags;
253 : : int ifindex;
254 : : };
255 : :
256 : : struct mptcp_pm_addr_entry {
257 : : struct list_head list;
258 : : struct mptcp_addr_info addr;
259 : : u32 flags;
260 : : int ifindex;
261 : : struct socket *lsk;
262 : : };
263 : :
264 : : struct mptcp_data_frag {
265 : : struct list_head list;
266 : : u64 data_seq;
267 : : u16 data_len;
268 : : u16 offset;
269 : : u8 overhead;
270 : : u8 eor; /* currently using 1 bit */
271 : : u16 already_sent;
272 : : struct page *page;
273 : : };
274 : :
275 : : /* Arbitrary compromise between as low as possible to react timely to subflow
276 : : * close event and as big as possible to avoid being fouled by biased large
277 : : * samples due to peer sending data on a different subflow WRT to the incoming
278 : : * ack.
279 : : */
280 : : #define MPTCP_RTT_SAMPLES 5
281 : :
282 : : /* MPTCP connection sock */
283 : : struct mptcp_sock {
284 : : /* inet_connection_sock must be the first member */
285 : : struct inet_connection_sock sk;
286 : : u64 local_key; /* protected by the first subflow socket lock
287 : : * lockless access read
288 : : */
289 : : u64 remote_key; /* same as above */
290 : : u64 write_seq;
291 : : u64 bytes_sent;
292 : : u64 snd_nxt;
293 : : u64 bytes_received;
294 : : u64 ack_seq;
295 : : atomic64_t rcv_wnd_sent;
296 : : u64 rcv_data_fin_seq;
297 : : u64 bytes_retrans;
298 : : u64 bytes_consumed;
299 : : int snd_burst;
300 : : int old_wspace;
301 : : u64 recovery_snd_nxt; /* in recovery mode accept up to this seq;
302 : : * recovery related fields are under data_lock
303 : : * protection
304 : : */
305 : : u64 bytes_acked;
306 : : u64 snd_una;
307 : : u64 wnd_end;
308 : : u32 last_data_sent;
309 : : u32 last_data_recv;
310 : : u32 last_ack_recv;
311 : : unsigned long timer_ival;
312 : : u32 token;
313 : : unsigned long flags;
314 : : unsigned long cb_flags;
315 : : bool recovery; /* closing subflow write queue reinjected */
316 : : bool can_ack;
317 : : bool fully_established;
318 : : bool rcv_data_fin;
319 : : bool snd_data_fin_enable;
320 : : bool rcv_fastclose;
321 : : bool use_64bit_ack; /* Set when we received a 64-bit DSN */
322 : : bool csum_enabled;
323 : : bool allow_infinite_fallback;
324 : : u8 pending_state; /* A subflow asked to set this sk_state,
325 : : * protected by the msk data lock
326 : : */
327 : : u8 mpc_endpoint_id;
328 : : u8 recvmsg_inq:1,
329 : : cork:1,
330 : : nodelay:1,
331 : : fastopening:1,
332 : : in_accept_queue:1,
333 : : free_first:1,
334 : : rcvspace_init:1,
335 : : fastclosing:1;
336 : : u32 notsent_lowat;
337 : : int keepalive_cnt;
338 : : int keepalive_idle;
339 : : int keepalive_intvl;
340 : : int maxseg;
341 : : struct work_struct work;
342 : : struct sk_buff *ooo_last_skb;
343 : : struct rb_root out_of_order_queue;
344 : : struct list_head conn_list;
345 : : struct list_head rtx_queue;
346 : : struct mptcp_data_frag *first_pending;
347 : : struct list_head join_list;
348 : : struct sock *first; /* The mptcp ops can safely dereference, using suitable
349 : : * ONCE annotation, the subflow outside the socket
350 : : * lock as such sock is freed after close().
351 : : */
352 : : struct mptcp_pm_data pm;
353 : : struct mptcp_sched_ops *sched;
354 : :
355 : : /* Most recent rtt_us observed by in use incoming subflows. */
356 : : struct {
357 : : u32 samples[MPTCP_RTT_SAMPLES];
358 : : u32 next_sample;
359 : : } rcv_rtt_est;
360 : :
361 : : struct {
362 : : int space; /* bytes copied in last measurement window */
363 : : int copied; /* bytes copied in this measurement window */
364 : : u64 time; /* start time of measurement window */
365 : : } rcvq_space;
366 : : u8 scaling_ratio;
367 : : bool allow_subflows;
368 : :
369 : : u32 subflow_id;
370 : : u32 setsockopt_seq;
371 : : char ca_name[TCP_CA_NAME_MAX];
372 : :
373 : : spinlock_t fallback_lock; /* protects fallback,
374 : : * allow_infinite_fallback and
375 : : * allow_join
376 : : */
377 : :
378 : : struct list_head backlog_list; /* protected by the data lock */
379 : : u32 backlog_len;
380 : : u32 backlog_unaccounted;
381 : : };
382 : :
383 : : #define mptcp_data_lock(sk) spin_lock_bh(&(sk)->sk_lock.slock)
384 : : #define mptcp_data_unlock(sk) spin_unlock_bh(&(sk)->sk_lock.slock)
385 : :
386 : : #define mptcp_for_each_subflow(__msk, __subflow) \
387 : : list_for_each_entry(__subflow, &((__msk)->conn_list), node)
388 : : #define mptcp_for_each_subflow_safe(__msk, __subflow, __tmp) \
389 : : list_for_each_entry_safe(__subflow, __tmp, &((__msk)->conn_list), node)
390 : : #define mptcp_next_subflow(__msk, __subflow) \
391 : : list_next_entry_circular(__subflow, &((__msk)->conn_list), node)
392 : :
393 : : extern struct genl_family mptcp_genl_family;
394 : :
395 : 73 : static inline void msk_owned_by_me(const struct mptcp_sock *msk)
396 : : {
397 : 1700530 : sock_owned_by_me((const struct sock *)msk);
398 : : }
399 : :
400 : : #ifdef CONFIG_DEBUG_NET
401 : : /* MPTCP-specific: we might (indirectly) call this helper with the wrong sk */
402 : : #undef tcp_sk
403 : : #define tcp_sk(ptr) ({ \
404 : : typeof(ptr) _ptr = (ptr); \
405 : : WARN_ON(_ptr->sk_protocol != IPPROTO_TCP); \
406 : : container_of_const(_ptr, struct tcp_sock, inet_conn.icsk_inet.sk); \
407 : : })
408 : : #define mptcp_sk(ptr) ({ \
409 : : typeof(ptr) _ptr = (ptr); \
410 : : WARN_ON(_ptr->sk_protocol != IPPROTO_MPTCP); \
411 : : container_of_const(_ptr, struct mptcp_sock, sk.icsk_inet.sk); \
412 : : })
413 : :
414 : : #else /* !CONFIG_DEBUG_NET */
415 : : #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk)
416 : : #endif
417 : :
418 : 6770137 : static inline int mptcp_win_from_space(const struct sock *sk, int space)
419 : : {
420 [ + ]: 6770137 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
421 : : }
422 : :
423 : 5456 : static inline int mptcp_space_from_win(const struct sock *sk, int win)
424 : : {
425 [ + ]: 5456 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win);
426 : : }
427 : :
428 : 4155056 : static inline int __mptcp_space(const struct sock *sk)
429 : : {
430 : 14828349 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) -
431 [ + ]: 4155056 : READ_ONCE(mptcp_sk(sk)->backlog_len) -
432 : 4155056 : sk_rmem_alloc_get(sk));
433 : : }
434 : :
435 : 3997335 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk)
436 : : {
437 [ + ]: 3997335 : const struct mptcp_sock *msk = mptcp_sk(sk);
438 : :
439 : 3997335 : return msk->first_pending;
440 : : }
441 : :
442 : 0 : static inline void mptcp_init_rtt_est(struct mptcp_sock *msk)
443 : : {
444 : 5169 : int i;
445 : :
446 [ + + ][ + + ]: 31662 : for (i = 0; i < MPTCP_RTT_SAMPLES; ++i)
447 : 25845 : msk->rcv_rtt_est.samples[i] = U32_MAX;
448 : 5169 : msk->rcv_rtt_est.next_sample = 0;
449 : 5169 : msk->scaling_ratio = TCP_DEFAULT_SCALING_RATIO;
450 : : }
451 : :
452 : 0 : static inline u32 mptcp_rtt_us_est(const struct mptcp_sock *msk)
453 : : {
454 : 0 : u32 rtt_us = READ_ONCE(msk->rcv_rtt_est.samples[0]);
455 : 0 : int i;
456 : :
457 : : /* Lockless access of collected samples. */
458 [ + - - ]: 5868805 : for (i = 1; i < MPTCP_RTT_SAMPLES; ++i)
[ + - - ]
459 : 0 : rtt_us = min(rtt_us, READ_ONCE(msk->rcv_rtt_est.samples[i]));
460 [ + ][ + ]: 1173761 : return rtt_us;
461 : : }
462 : :
463 : 482612 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk)
464 : : {
465 [ + ]: 482612 : struct mptcp_sock *msk = mptcp_sk(sk);
466 : 482612 : struct mptcp_data_frag *cur;
467 : :
468 : 482612 : cur = msk->first_pending;
469 [ + ]: 482612 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL :
470 : : list_next_entry(cur, list);
471 : : }
472 : :
473 : 646838 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
474 : : {
475 [ + ]: 646838 : const struct mptcp_sock *msk = mptcp_sk(sk);
476 : :
477 [ + ]: 646838 : if (!msk->first_pending)
478 : : return NULL;
479 : :
480 [ + - ]: 368763 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue)))
481 : : return NULL;
482 : :
483 : 368763 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
484 : : }
485 : :
486 : 503060 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk)
487 : : {
488 [ + ]: 503060 : struct mptcp_sock *msk = mptcp_sk(sk);
489 : :
490 [ + ]: 503060 : if (msk->snd_una == msk->snd_nxt)
491 : : return NULL;
492 : :
493 [ + ]: 423968 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
494 : : }
495 : :
496 : : struct csum_pseudo_header {
497 : : __be64 data_seq;
498 : : __be32 subflow_seq;
499 : : __be16 data_len;
500 : : __sum16 csum;
501 : : };
502 : :
503 : : struct mptcp_subflow_request_sock {
504 : : struct tcp_request_sock sk;
505 : : u16 mp_capable : 1,
506 : : mp_join : 1,
507 : : backup : 1,
508 : : request_bkup : 1,
509 : : csum_reqd : 1,
510 : : allow_join_id0 : 1;
511 : : u8 local_id;
512 : : u8 remote_id;
513 : : u64 local_key;
514 : : u64 idsn;
515 : : u32 token;
516 : : u32 ssn_offset;
517 : : u64 thmac;
518 : : u32 local_nonce;
519 : : u32 remote_nonce;
520 : : struct mptcp_sock *msk;
521 : : struct hlist_nulls_node token_node;
522 : : };
523 : :
524 : : static inline struct mptcp_subflow_request_sock *
525 : : mptcp_subflow_rsk(const struct request_sock *rsk)
526 : : {
527 : : return (struct mptcp_subflow_request_sock *)rsk;
528 : : }
529 : :
530 : : struct mptcp_delegated_action {
531 : : struct napi_struct napi;
532 : : local_lock_t bh_lock;
533 : : struct list_head head;
534 : : };
535 : :
536 : : DECLARE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);
537 : :
538 : : #define MPTCP_DELEGATE_SCHEDULED 0
539 : : #define MPTCP_DELEGATE_SEND 1
540 : : #define MPTCP_DELEGATE_ACK 2
541 : : #define MPTCP_DELEGATE_SNDBUF 3
542 : :
543 : : #define MPTCP_DELEGATE_ACTIONS_MASK (~BIT(MPTCP_DELEGATE_SCHEDULED))
544 : : /* MPTCP subflow context */
545 : : struct mptcp_subflow_context {
546 : : struct list_head node;/* conn_list of subflows */
547 : :
548 : : struct_group(reset,
549 : :
550 : : unsigned long avg_pacing_rate; /* protected by msk socket lock */
551 : : u64 local_key;
552 : : u64 remote_key;
553 : : u64 idsn;
554 : : u64 map_seq;
555 : : u64 rcv_wnd_sent;
556 : : u32 snd_isn;
557 : : u32 token;
558 : : u32 rel_write_seq;
559 : : u32 map_subflow_seq;
560 : : u32 ssn_offset;
561 : : u32 map_data_len;
562 : : __wsum map_data_csum;
563 : : u32 map_csum_len;
564 : : u32 prev_rtt_seq;
565 : : u32 request_mptcp : 1, /* send MP_CAPABLE */
566 : : request_join : 1, /* send MP_JOIN */
567 : : request_bkup : 1,
568 : : mp_capable : 1, /* remote is MPTCP capable */
569 : : mp_join : 1, /* remote is JOINing */
570 : : pm_notified : 1, /* PM hook called for established status */
571 : : conn_finished : 1,
572 : : map_valid : 1,
573 : : map_csum_reqd : 1,
574 : : map_data_fin : 1,
575 : : mpc_map : 1,
576 : : backup : 1,
577 : : send_mp_prio : 1,
578 : : send_mp_fail : 1,
579 : : send_fastclose : 1,
580 : : send_infinite_map : 1,
581 : : remote_key_valid : 1, /* received the peer key from */
582 : : disposable : 1, /* ctx can be free at ulp release time */
583 : : closing : 1, /* must not pass rx data to msk anymore */
584 : : valid_csum_seen : 1, /* at least one csum validated */
585 : : is_mptfo : 1, /* subflow is doing TFO */
586 : : mpc_drop : 1, /* the MPC option has been dropped in a rtx */
587 : : resetting : 1, /* subflow is resetting */
588 : : __unused : 9;
589 : : bool data_avail;
590 : : bool scheduled;
591 : : bool pm_listener; /* a listener managed by the kernel PM? */
592 : : bool fully_established; /* path validated */
593 : : bool close_event_done; /* has done the post-closed part,
594 : : * protected by msk socket lock
595 : : */
596 : : u32 lent_mem_frag;
597 : : u32 remote_nonce;
598 : : u64 thmac;
599 : : u32 local_nonce;
600 : : u32 remote_token;
601 : : union {
602 : : u8 hmac[MPTCPOPT_HMAC_LEN]; /* MPJ subflow only */
603 : : u64 iasn; /* initial ack sequence number, MPC subflows only */
604 : : };
605 : : s16 local_id; /* if negative not initialized yet */
606 : : u8 remote_id;
607 : : u8 reset_seen:1;
608 : : u8 reset_transient:1;
609 : : u8 reset_reason:4;
610 : : u8 stale_count; /* Protected by the msk socket lock */
611 : : u8 stale; /* Protected by the msk socket lock,
612 : : * if set the subflow is unable to snd/rcv
613 : : * data, the schedule should skip it
614 : : */
615 : :
616 : : u32 subflow_id;
617 : :
618 : : long delegated_status;
619 : : unsigned long fail_tout;
620 : :
621 : : );
622 : :
623 : : struct list_head delegated_node; /* link into delegated_action, protected by local BH */
624 : :
625 : : u32 setsockopt_seq;
626 : : u32 stale_rcv_tstamp;
627 : : int cached_sndbuf; /* sndbuf size when last synced with the msk sndbuf,
628 : : * protected by the msk socket lock
629 : : */
630 : :
631 : : struct sock *tcp_sock; /* tcp sk backpointer */
632 : : struct sock *conn; /* parent mptcp_sock */
633 : : const struct inet_connection_sock_af_ops *icsk_af_ops;
634 : : void (*tcp_state_change)(struct sock *sk);
635 : : void (*tcp_error_report)(struct sock *sk);
636 : :
637 : : struct rcu_head rcu;
638 : : };
639 : :
640 : : static inline struct mptcp_subflow_context *
641 : 48 : mptcp_subflow_ctx(const struct sock *sk)
642 : : {
643 [ + ][ + - ]: 685112 : const struct inet_connection_sock *icsk = inet_csk(sk);
644 : :
645 : : /* Use RCU on icsk_ulp_data only for sock diag code */
646 [ - + ][ + ]: 56768772 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data;
[ + - + +
+ + - + -
+ + + +
- ][ + + -
+ + + + +
+ - + + +
+ + + ][ -
- - - + +
+ + + + +
+ + - - +
- + - - +
+ - + - ]
[ + - + +
+ + - - -
- - + + +
- - ][ + -
- - + + +
+ + - + -
+ - - + -
+ - - + -
- - - ][ -
- - - + +
+ + + - +
- + - - +
- + - - +
- - - - ]
[ + - + ]
[ + - + + ]
[ + + + +
+ + + + -
+ + + + +
+ ][ + - +
+ + + - -
+ - + + +
+ - - ][ +
- - - + +
+ + + + +
+ + - - +
- + - - +
+ - - - ]
[ + ][ - + ]
[ + ]
647 : : }
648 : :
649 : : static inline struct sock *
650 : 0 : mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
651 : : {
652 [ - ][ + ]: 5458748 : return subflow->tcp_sock;
[ + + + ][ -
+ + + - +
+ - - ][ -
+ + + - -
+ + - - ]
653 : : }
654 : :
655 : : static inline void
656 : 0 : mptcp_subflow_ctx_reset(struct mptcp_subflow_context *subflow)
657 : : {
658 : 1266 : memset(&subflow->reset, 0, sizeof(subflow->reset));
659 : 1266 : subflow->request_mptcp = 1;
660 : 6 : WRITE_ONCE(subflow->local_id, -1);
661 : 1605 : }
662 : :
663 : : /* Convert reset reasons in MPTCP to enum sk_rst_reason type */
664 : : static inline enum sk_rst_reason
665 : : sk_rst_convert_mptcp_reason(u32 reason)
666 : : {
667 : : switch (reason) {
668 : : case MPTCP_RST_EUNSPEC:
669 : : return SK_RST_REASON_MPTCP_RST_EUNSPEC;
670 : : case MPTCP_RST_EMPTCP:
671 : : return SK_RST_REASON_MPTCP_RST_EMPTCP;
672 : : case MPTCP_RST_ERESOURCE:
673 : : return SK_RST_REASON_MPTCP_RST_ERESOURCE;
674 : : case MPTCP_RST_EPROHIBIT:
675 : : return SK_RST_REASON_MPTCP_RST_EPROHIBIT;
676 : : case MPTCP_RST_EWQ2BIG:
677 : : return SK_RST_REASON_MPTCP_RST_EWQ2BIG;
678 : : case MPTCP_RST_EBADPERF:
679 : : return SK_RST_REASON_MPTCP_RST_EBADPERF;
680 : : case MPTCP_RST_EMIDDLEBOX:
681 : : return SK_RST_REASON_MPTCP_RST_EMIDDLEBOX;
682 : : default:
683 : : /* It should not happen, or else errors may occur
684 : : * in MPTCP layer
685 : : */
686 : : return SK_RST_REASON_ERROR;
687 : : }
688 : : }
689 : :
690 : : static inline void
691 : 53 : mptcp_send_active_reset_reason(struct sock *sk)
692 : : {
693 : 53 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
694 : 53 : enum sk_rst_reason reason;
695 : :
696 [ - ]: 53 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason);
697 : 53 : tcp_send_active_reset(sk, reason);
698 : 53 : }
699 : :
700 : : /* Made the fwd mem carried by the given skb available to the msk,
701 : : * To be paired with a previous mptcp_subflow_lend_fwdmem() before freeing
702 : : * the skb or setting the skb ownership.
703 : : */
704 : 1273225 : static inline void mptcp_borrow_fwdmem(struct sock *sk, struct sk_buff *skb)
705 : : {
706 : 1273225 : struct sock *ssk = skb->sk;
707 : :
708 : : /* The subflow just lend the skb fwd memory; if the subflow meanwhile
709 : : * closed, mptcp_close_ssk() already released the ssk rcv memory.
710 : : */
711 [ + ]: 1273225 : DEBUG_NET_WARN_ON_ONCE(skb->destructor);
712 [ - ][ - ]: 1273225 : sk_forward_alloc_add(sk, skb->truesize);
713 [ - ][ - ]: 1273225 : if (!ssk)
714 : : return;
715 : :
716 : 1273225 : atomic_sub(skb->truesize, &ssk->sk_rmem_alloc);
717 : 1273225 : skb->sk = NULL;
718 : : }
719 : :
720 : : static inline void
721 : 0 : __mptcp_subflow_lend_fwdmem(struct mptcp_subflow_context *subflow, int size)
722 : : {
723 : 1301762 : int frag = (subflow->lent_mem_frag + size) & (PAGE_SIZE - 1);
724 : :
725 : 28611 : subflow->lent_mem_frag = frag;
726 : : }
727 : :
728 : : static inline void
729 : 0 : mptcp_subflow_lend_fwdmem(struct mptcp_subflow_context *subflow,
730 : : struct sk_buff *skb)
731 : : {
732 : 1273201 : __mptcp_subflow_lend_fwdmem(subflow, skb->truesize);
733 : 1273201 : skb->destructor = NULL;
734 : : }
735 : :
736 : : static inline u64
737 : 5992756 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow)
738 : : {
739 [ + ]: 5992756 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq -
740 : 5992756 : subflow->ssn_offset -
741 : 5992756 : subflow->map_subflow_seq;
742 : : }
743 : :
744 : : static inline u64
745 : 48 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow)
746 : : {
747 [ - ][ - ]: 2572698 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow);
748 : : }
749 : :
750 : : void mptcp_subflow_process_delegated(struct sock *ssk, long actions);
751 : :
752 : 141072 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action)
753 : : {
754 [ + ]: 141072 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action);
755 : 141072 : struct mptcp_delegated_action *delegated;
756 : 141072 : bool schedule;
757 : :
758 : : /* the caller held the subflow bh socket lock */
759 [ - - - - : 141072 : lockdep_assert_in_softirq();
+ ]
760 : :
761 : : /* The implied barrier pairs with tcp_release_cb_override()
762 : : * mptcp_napi_poll(), and ensures the below list check sees list
763 : : * updates done prior to delegated status bits changes
764 : : */
765 [ + - ][ + - ]: 141072 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits);
766 [ + ][ + ]: 141072 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) {
767 [ + - ][ + - ]: 61150 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node)))
768 : : return;
769 : :
770 [ - - - - : 61150 : local_lock_nested_bh(&mptcp_delegated_actions.bh_lock);
+ ]
771 : 61150 : delegated = this_cpu_ptr(&mptcp_delegated_actions);
772 : 61150 : schedule = list_empty(&delegated->head);
773 : 61150 : list_add_tail(&subflow->delegated_node, &delegated->head);
774 : 61150 : local_unlock_nested_bh(&mptcp_delegated_actions.bh_lock);
775 : 61150 : sock_hold(mptcp_subflow_tcp_sock(subflow));
776 [ + ][ + ]: 61150 : if (schedule)
777 : 59656 : napi_schedule(&delegated->napi);
778 : : }
779 : : }
780 : :
781 : : static inline struct mptcp_subflow_context *
782 : 120696 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated)
783 : : {
784 : 120696 : struct mptcp_subflow_context *ret;
785 : :
786 [ - - - - : 120696 : local_lock_nested_bh(&mptcp_delegated_actions.bh_lock);
+ ]
787 [ + ][ + ]: 120696 : if (list_empty(&delegated->head)) {
788 : 44085 : local_unlock_nested_bh(&mptcp_delegated_actions.bh_lock);
789 : 44079 : return NULL;
790 : : }
791 : :
792 : 61150 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node);
793 : 61150 : list_del_init(&ret->delegated_node);
794 : 61150 : local_unlock_nested_bh(&mptcp_delegated_actions.bh_lock);
795 : 61150 : return ret;
796 : : }
797 : :
798 : : void __mptcp_inherit_memcg(struct sock *sk, struct sock *ssk, gfp_t gfp);
799 : : void __mptcp_inherit_cgrp_data(struct sock *sk, struct sock *ssk);
800 : :
801 : : int mptcp_is_enabled(const struct net *net);
802 : : unsigned int mptcp_get_add_addr_timeout(const struct net *net);
803 : : int mptcp_is_checksum_enabled(const struct net *net);
804 : : int mptcp_allow_join_id0(const struct net *net);
805 : : unsigned int mptcp_stale_loss_cnt(const struct net *net);
806 : : unsigned int mptcp_close_timeout(const struct sock *sk);
807 : : int mptcp_get_pm_type(const struct net *net);
808 : : const char *mptcp_get_path_manager(const struct net *net);
809 : : const char *mptcp_get_scheduler(const struct net *net);
810 : : unsigned int mptcp_add_addr_v6_port_drop_ts(const struct net *net);
811 : :
812 : : void mptcp_active_disable(struct sock *sk);
813 : : bool mptcp_active_should_disable(struct sock *ssk);
814 : : void mptcp_active_enable(struct sock *sk);
815 : :
816 : : void mptcp_get_available_schedulers(char *buf, size_t maxlen);
817 : : void __mptcp_subflow_fully_established(struct mptcp_sock *msk,
818 : : struct mptcp_subflow_context *subflow,
819 : : const struct mptcp_options_received *mp_opt);
820 : : bool __mptcp_retransmit_pending_data(struct sock *sk);
821 : : void mptcp_check_and_set_pending(struct sock *sk);
822 : : void __mptcp_push_pending(struct sock *sk, unsigned int flags);
823 : : bool mptcp_subflow_data_available(struct sock *sk);
824 : : void __init mptcp_subflow_init(void);
825 : : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);
826 : : void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
827 : : struct mptcp_subflow_context *subflow);
828 : : void __mptcp_subflow_send_ack(struct sock *ssk);
829 : : void mptcp_subflow_reset(struct sock *ssk);
830 : : void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
831 : : void mptcp_sock_graft(struct sock *sk, struct socket *parent);
832 : : struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk);
833 : : bool __mptcp_close(struct sock *sk, long timeout);
834 : : void mptcp_cancel_work(struct sock *sk);
835 : : void __mptcp_unaccepted_force_close(struct sock *sk);
836 : : void mptcp_set_state(struct sock *sk, int state);
837 : :
838 : : bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
839 : : const struct mptcp_addr_info *b, bool use_port);
840 : : void mptcp_local_address(const struct sock_common *skc,
841 : : struct mptcp_addr_info *addr);
842 : : void mptcp_remote_address(const struct sock_common *skc,
843 : : struct mptcp_addr_info *addr);
844 : :
845 : : /* called with sk socket lock held */
846 : : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local,
847 : : const struct mptcp_addr_info *remote);
848 : : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
849 : : struct socket **new_sock);
850 : : void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
851 : : struct sockaddr_storage *addr,
852 : : unsigned short family);
853 : : struct mptcp_sched_ops *mptcp_sched_find(const char *name);
854 : : int mptcp_validate_scheduler(struct mptcp_sched_ops *sched);
855 : : int mptcp_register_scheduler(struct mptcp_sched_ops *sched);
856 : : void mptcp_unregister_scheduler(struct mptcp_sched_ops *sched);
857 : : void mptcp_sched_init(void);
858 : : int mptcp_init_sched(struct mptcp_sock *msk,
859 : : struct mptcp_sched_ops *sched);
860 : : void mptcp_release_sched(struct mptcp_sock *msk);
861 : : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
862 : : bool scheduled);
863 : : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk);
864 : : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk);
865 : : int mptcp_sched_get_send(struct mptcp_sock *msk);
866 : : int mptcp_sched_get_retrans(struct mptcp_sock *msk);
867 : :
868 : 90 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk)
869 : : {
870 [ + ][ + ][ + ]: 1267504 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed);
[ + ]
871 : : }
872 : :
873 : 1947926 : static inline bool mptcp_epollin_ready(const struct sock *sk)
874 : : {
875 [ + ]: 1947926 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk));
876 : :
877 [ + ]: 1947926 : if (!data_avail)
878 : : return false;
879 : :
880 : : /* mptcp doesn't have to deal with small skbs in the receive queue,
881 : : * as it can always coalesce them
882 : : */
883 [ + - ]: 2807034 : return (data_avail >= sk->sk_rcvlowat) ||
884 : 0 : tcp_under_memory_pressure(sk);
885 : : }
886 : :
887 : : int mptcp_set_rcvlowat(struct sock *sk, int val);
888 : :
889 : 1358251 : static inline bool __tcp_can_send(const struct sock *ssk)
890 : : {
891 : : /* only send if our side has not closed yet */
892 [ + ][ - ]: 2091399 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT));
893 : : }
894 : :
895 : 1516653 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow)
896 : : {
897 : : /* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */
898 [ + + + ]: 1516653 : if (subflow->request_join && !READ_ONCE(subflow->fully_established))
[ + + ]
899 : : return false;
900 : :
901 : 1516191 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow));
902 : : }
903 : :
904 : : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow);
905 : :
906 : : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow);
907 : :
908 : : void mptcp_subflow_drop_ctx(struct sock *ssk);
909 : :
910 : 36 : static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
911 : : struct mptcp_subflow_context *ctx)
912 : : {
913 : 228 : sk->sk_data_ready = sock_def_readable;
914 : 228 : sk->sk_state_change = ctx->tcp_state_change;
915 : 228 : sk->sk_write_space = sk_stream_write_space;
916 : 228 : sk->sk_error_report = ctx->tcp_error_report;
917 : :
918 [ + ]: 228 : inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops;
919 : : }
920 : :
921 : : void __init mptcp_proto_init(void);
922 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6)
923 : : int __init mptcp_proto_v6_init(void);
924 : : void __init mptcp_subflow_v6_init(void);
925 : : #endif
926 : :
927 : : struct sock *mptcp_sk_clone_init(const struct sock *sk,
928 : : const struct mptcp_options_received *mp_opt,
929 : : struct sock *ssk,
930 : : struct request_sock *req);
931 : : void mptcp_get_options(const struct sk_buff *skb,
932 : : struct mptcp_options_received *mp_opt);
933 : :
934 : : void mptcp_finish_connect(struct sock *sk);
935 : : void __mptcp_sync_state(struct sock *sk, int state);
936 : : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout);
937 : :
938 : 1261 : static inline void mptcp_stop_tout_timer(struct sock *sk)
939 : : {
940 [ + ]: 1261 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp)
941 : : return;
942 : :
943 : 4 : sk_stop_timer(sk, &inet_csk(sk)->mptcp_tout_timer);
944 : 4 : inet_csk(sk)->icsk_mtup.probe_timestamp = 0;
945 : : }
946 : :
947 : 66 : static inline void mptcp_set_close_tout(struct sock *sk, unsigned long tout)
948 : : {
949 : : /* avoid 0 timestamp, as that means no close timeout */
950 : 42 : inet_csk(sk)->icsk_mtup.probe_timestamp = tout ? : 1;
951 : : }
952 : :
953 : 1464 : static inline void mptcp_start_tout_timer(struct sock *sk)
954 : : {
955 : 1464 : mptcp_set_close_tout(sk, tcp_jiffies32);
956 [ + ]: 1464 : mptcp_reset_tout_timer(mptcp_sk(sk), 0);
957 : 1464 : }
958 : :
959 : 4116 : static inline bool mptcp_is_fully_established(struct sock *sk)
960 : : {
961 [ + ][ + ]: 4116 : return inet_sk_state_load(sk) == TCP_ESTABLISHED &&
962 [ + + + ]: 3604 : READ_ONCE(mptcp_sk(sk)->fully_established);
[ + + ]
963 : : }
964 : :
965 : 72 : static inline u64 mptcp_stamp(void)
966 : : {
967 : 1176886 : return div_u64(tcp_clock_ns(), NSEC_PER_USEC);
968 : : }
969 : :
970 : : void mptcp_data_ready(struct sock *sk, struct sock *ssk);
971 : : bool mptcp_finish_join(struct sock *sk);
972 : : bool mptcp_schedule_work(struct sock *sk);
973 : : int mptcp_setsockopt(struct sock *sk, int level, int optname,
974 : : sockptr_t optval, unsigned int optlen);
975 : : int mptcp_getsockopt(struct sock *sk, int level, int optname,
976 : : char __user *optval, int __user *option);
977 : :
978 : : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq);
979 : 182 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit)
980 : : {
981 [ + ][ + + ]: 3441216 : if (use_64bit)
[ + ][ + + ]
982 : : return cur_seq;
983 : :
984 : 443798 : return __mptcp_expand_seq(old_seq, cur_seq);
985 : : }
986 : : void __mptcp_check_push(struct sock *sk, struct sock *ssk);
987 : : void __mptcp_data_acked(struct sock *sk);
988 : : void __mptcp_error_report(struct sock *sk);
989 : : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
990 : 1900865 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk)
991 : : {
992 [ + + ][ + ]: 3797819 : return READ_ONCE(msk->snd_data_fin_enable) &&
[ + + ]
993 [ + ][ + ]: 187435 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt);
[ + + ]
994 : : }
995 : :
996 : 2940590 : static inline u32 mptcp_notsent_lowat(const struct sock *sk)
997 : : {
998 [ + ]: 2940590 : struct net *net = sock_net(sk);
999 : 2940590 : u32 val;
1000 : :
1001 [ + ][ + ]: 2940590 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat);
1002 [ + ][ + ]: 2940590 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
1003 : : }
1004 : :
1005 : 2293752 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake)
1006 : : {
1007 [ + ]: 2293752 : const struct mptcp_sock *msk = mptcp_sk(sk);
1008 : 2293752 : u32 notsent_bytes;
1009 : :
1010 : 2293752 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt);
1011 [ + ]: 2293752 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk);
1012 : : }
1013 : :
1014 : 662216 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake)
1015 : : {
1016 [ - + ]: 1324432 : return mptcp_stream_memory_free(sk, wake) &&
1017 : 662216 : __sk_stream_is_writeable(sk, wake);
1018 : : }
1019 : :
1020 : 1037027 : static inline void mptcp_write_space(struct sock *sk)
1021 : : {
1022 : : /* pairs with memory barrier in mptcp_poll */
1023 : 1037027 : smp_mb();
1024 [ + ]: 1037027 : if (mptcp_stream_memory_free(sk, 1))
1025 [ - ]: 1036967 : INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk);
1026 : 1037027 : }
1027 : :
1028 : 29927 : static inline void __mptcp_sync_sndbuf(struct sock *sk)
1029 : : {
1030 : 29927 : struct mptcp_subflow_context *subflow;
1031 : 29927 : int ssk_sndbuf, new_sndbuf;
1032 : :
1033 [ - ][ - ]: 29927 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK)
1034 : : return;
1035 : :
1036 [ + ]: 29927 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]);
1037 [ + + + ]: 91248 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) {
[ + + + ]
1038 : 61321 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf);
1039 : :
1040 : 61321 : subflow->cached_sndbuf = ssk_sndbuf;
1041 : 61321 : new_sndbuf += ssk_sndbuf;
1042 : : }
1043 : :
1044 : : /* the msk max wmem limit is <nr_subflows> * tcp wmem[2] */
1045 : 29927 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf);
1046 : 29927 : mptcp_write_space(sk);
1047 : : }
1048 : :
1049 : : /* The called held both the msk socket and the subflow socket locks,
1050 : : * possibly under BH
1051 : : */
1052 : 48 : static inline void __mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk)
1053 : : {
1054 : 3875 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
1055 : :
1056 [ + ][ + - ]: 3875 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf)
[ + - ]
1057 : 3779 : __mptcp_sync_sndbuf(sk);
1058 : : }
1059 : :
1060 : : /* the caller held only the subflow socket lock, either in process or
1061 : : * BH context. Additionally this can be called under the msk data lock,
1062 : : * so we can't acquire such lock here: let the delegate action acquires
1063 : : * the needed locks in suitable order.
1064 : : */
1065 : 896337 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk)
1066 : : {
1067 : 896337 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
1068 : :
1069 [ + ]: 896337 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf))
1070 : : return;
1071 : :
1072 : 131228 : local_bh_disable();
1073 : 131228 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF);
1074 : 131228 : local_bh_enable();
1075 : : }
1076 : :
1077 : : #define MPTCP_TOKEN_MAX_RETRIES 4
1078 : :
1079 : : void __init mptcp_token_init(void);
1080 : 54 : static inline void mptcp_token_init_request(struct request_sock *req)
1081 : : {
1082 : 2546 : mptcp_subflow_rsk(req)->token_node.pprev = NULL;
1083 : 0 : }
1084 : :
1085 : : int mptcp_token_new_request(struct request_sock *req);
1086 : : void mptcp_token_move_request(struct request_sock *req,
1087 : : struct request_sock *new_req);
1088 : : void mptcp_token_destroy_request(struct request_sock *req);
1089 : : int mptcp_token_new_connect(struct sock *ssk);
1090 : : bool mptcp_token_accept(struct mptcp_subflow_request_sock *r,
1091 : : struct mptcp_sock *msk);
1092 : : bool mptcp_token_exists(u32 token);
1093 : : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token);
1094 : : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot,
1095 : : long *s_num);
1096 : : void mptcp_token_destroy(struct mptcp_sock *msk);
1097 : :
1098 : : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn);
1099 : :
1100 : : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac);
1101 : : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum);
1102 : :
1103 : : void __init mptcp_pm_init(void);
1104 : : void mptcp_pm_data_init(struct mptcp_sock *msk);
1105 : : void mptcp_pm_data_reset(struct mptcp_sock *msk);
1106 : : void mptcp_pm_destroy(struct mptcp_sock *msk);
1107 : : int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
1108 : : struct mptcp_addr_info *addr);
1109 : : int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
1110 : : bool require_family,
1111 : : struct mptcp_pm_addr_entry *entry);
1112 : : bool mptcp_pm_addr_families_match(const struct sock *sk,
1113 : : const struct mptcp_addr_info *loc,
1114 : : const struct mptcp_addr_info *rem);
1115 : : void mptcp_pm_chk_stale(const struct mptcp_sock *msk);
1116 : : void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);
1117 : : void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk);
1118 : : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
1119 : : void mptcp_pm_connection_closed(struct mptcp_sock *msk);
1120 : : void mptcp_pm_subflow_established(struct mptcp_sock *msk);
1121 : : bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk);
1122 : : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
1123 : : const struct mptcp_subflow_context *subflow);
1124 : : void mptcp_pm_add_addr_received(const struct sock *ssk,
1125 : : const struct mptcp_addr_info *addr);
1126 : : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
1127 : : const struct mptcp_addr_info *addr);
1128 : : void mptcp_pm_send_ack(struct mptcp_sock *msk,
1129 : : struct mptcp_subflow_context *subflow,
1130 : : bool prio, bool backup);
1131 : : void mptcp_pm_addr_send_ack(struct mptcp_sock *msk);
1132 : : void mptcp_pm_nl_rm_addr(struct mptcp_sock *msk, u8 rm_id);
1133 : : void mptcp_pm_rm_subflow(struct mptcp_sock *msk,
1134 : : const struct mptcp_rm_list *rm_list);
1135 : : void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
1136 : : const struct mptcp_rm_list *rm_list);
1137 : : void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
1138 : : void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq);
1139 : : int mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
1140 : : struct mptcp_addr_info *addr,
1141 : : struct mptcp_addr_info *rem,
1142 : : u8 bkup);
1143 : : bool mptcp_pm_announced_alloc(struct mptcp_sock *msk,
1144 : : const struct mptcp_addr_info *addr);
1145 : : bool mptcp_pm_announced_remove(struct mptcp_sock *msk,
1146 : : const struct mptcp_addr_info *addr);
1147 : : bool mptcp_pm_announced_has_ssk(struct mptcp_sock *msk, const struct sock *ssk);
1148 : : bool mptcp_pm_has_subflow_saddr(const struct mptcp_sock *msk,
1149 : : const struct mptcp_addr_info *saddr);
1150 : : int mptcp_pm_nl_set_flags(struct mptcp_pm_addr_entry *local,
1151 : : struct genl_info *info);
1152 : : int mptcp_userspace_pm_set_flags(struct mptcp_pm_addr_entry *local,
1153 : : struct genl_info *info);
1154 : : int mptcp_pm_announce_addr(struct mptcp_sock *msk,
1155 : : const struct mptcp_addr_info *addr,
1156 : : bool echo);
1157 : : int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
1158 : :
1159 : : /* the default path manager, used in mptcp_pm_unregister */
1160 : : extern struct mptcp_pm_ops mptcp_pm_kernel;
1161 : :
1162 : : struct mptcp_pm_ops *mptcp_pm_find(const char *name);
1163 : : int mptcp_pm_register(struct mptcp_pm_ops *pm_ops);
1164 : : void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops);
1165 : : int mptcp_pm_validate(struct mptcp_pm_ops *pm_ops);
1166 : : void mptcp_pm_get_available(char *buf, size_t maxlen);
1167 : :
1168 : : void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk);
1169 : :
1170 : : void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
1171 : : const struct sock *ssk, gfp_t gfp);
1172 : : void mptcp_event_addr_announced(const struct sock *ssk, const struct mptcp_addr_info *info);
1173 : : void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id);
1174 : : void mptcp_event_pm_listener(const struct sock *ssk,
1175 : : enum mptcp_event_type event);
1176 : : bool mptcp_userspace_pm_active(const struct mptcp_sock *msk);
1177 : :
1178 : : void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow,
1179 : : struct request_sock *req);
1180 : : int mptcp_pm_genl_fill_addr(struct sk_buff *msg,
1181 : : struct netlink_callback *cb,
1182 : : struct mptcp_pm_addr_entry *entry);
1183 : :
1184 : 222 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk)
1185 : : {
1186 [ + ]: 3752411 : return READ_ONCE(msk->pm.addr_signal) &
[ + - + - ]
[ + - + - ]
1187 : : (BIT(MPTCP_ADD_ADDR_SIGNAL) | BIT(MPTCP_ADD_ADDR_ECHO));
1188 : : }
1189 : :
1190 : 0 : static inline bool mptcp_pm_should_add_signal_addr(struct mptcp_sock *msk)
1191 : : {
1192 [ + - ][ + - ]: 146 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_SIGNAL);
1193 : : }
1194 : :
1195 : 6 : static inline bool mptcp_pm_should_add_signal_echo(struct mptcp_sock *msk)
1196 : : {
1197 [ + ]: 914 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO);
1198 : : }
1199 : :
1200 : 216 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
1201 : : {
1202 [ + ][ + + ]: 3749659 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL);
[ + + ]
1203 : : }
1204 : :
1205 : 6 : static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk)
1206 : : {
1207 [ + ][ + + + : 5688 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE;
+ + ][ + ]
[ + + + +
+ ]
1208 : : }
1209 : :
1210 : 21 : static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk)
1211 : : {
1212 [ + ][ - - ]: 1118 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_KERNEL;
[ - - ]
1213 : : }
1214 : :
1215 : : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, int *size, int remaining,
1216 : : struct mptcp_addr_info *addr, bool *echo,
1217 : : bool *drop_ts);
1218 : : bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
1219 : : struct mptcp_rm_list *rm_list, int *len);
1220 : : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
1221 : : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
1222 : : struct mptcp_pm_addr_entry *skc);
1223 : : int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
1224 : : struct mptcp_pm_addr_entry *skc);
1225 : : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
1226 : : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
1227 : : bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
1228 : : int mptcp_pm_nl_dump_addr(struct sk_buff *msg,
1229 : : struct netlink_callback *cb);
1230 : : int mptcp_userspace_pm_dump_addr(struct sk_buff *msg,
1231 : : struct netlink_callback *cb);
1232 : : int mptcp_pm_nl_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,
1233 : : struct genl_info *info);
1234 : : int mptcp_userspace_pm_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,
1235 : : struct genl_info *info);
1236 : :
1237 : 0 : static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow)
1238 : : {
1239 : 1141 : int local_id = READ_ONCE(subflow->local_id);
1240 : :
1241 : 1141 : if (local_id < 0)
1242 : : return 0;
1243 : : return local_id;
1244 : : }
1245 : :
1246 : : void __init mptcp_pm_kernel_register(void);
1247 : : void __init mptcp_pm_userspace_register(void);
1248 : : void __init mptcp_pm_nl_init(void);
1249 : : void mptcp_pm_worker(struct mptcp_sock *msk);
1250 : : void __mptcp_pm_kernel_worker(struct mptcp_sock *msk);
1251 : : u8 mptcp_pm_get_endp_signal_max(const struct mptcp_sock *msk);
1252 : : u8 mptcp_pm_get_endp_subflow_max(const struct mptcp_sock *msk);
1253 : : u8 mptcp_pm_get_endp_laminar_max(const struct mptcp_sock *msk);
1254 : : u8 mptcp_pm_get_endp_fullmesh_max(const struct mptcp_sock *msk);
1255 : : u8 mptcp_pm_get_limit_add_addr_accepted(const struct mptcp_sock *msk);
1256 : : u8 mptcp_pm_get_limit_extra_subflows(const struct mptcp_sock *msk);
1257 : :
1258 : : /* called under PM lock */
1259 : 790 : static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk)
1260 : : {
1261 [ + - ]: 1580 : if (!WARN_ON_ONCE(msk->pm.extra_subflows == 0) &&
1262 : 790 : --msk->pm.extra_subflows < mptcp_pm_get_limit_extra_subflows(msk))
1263 : 790 : WRITE_ONCE(msk->pm.accept_subflow, true);
1264 : 790 : }
1265 : :
1266 : 47 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk)
1267 : : {
1268 : 47 : spin_lock_bh(&msk->pm.lock);
1269 : 47 : __mptcp_pm_close_subflow(msk);
1270 : 47 : spin_unlock_bh(&msk->pm.lock);
1271 : 47 : }
1272 : :
1273 : 1178 : static inline bool mptcp_pm_add_addr_c_flag_case(struct mptcp_sock *msk)
1274 : : {
1275 [ + ]: 1025 : return READ_ONCE(msk->pm.remote_deny_join_id0) &&
1276 [ + + ][ + + ]: 38 : msk->pm.local_addr_used == 0 &&
[ # ][ # ]
1277 [ + - ][ + - ]: 1184 : mptcp_pm_get_limit_add_addr_accepted(msk) == 0 &&
[ + - ][ + - ]
1278 [ # ][ # ]: 4 : msk->pm.extra_subflows < mptcp_pm_get_limit_extra_subflows(msk);
1279 : : }
1280 : :
1281 : : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk);
1282 : :
1283 : 0 : static inline struct mptcp_ext *mptcp_get_ext(const struct sk_buff *skb)
1284 : : {
1285 [ + - ]: 4531154 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP);
[ - - - ]
[ - + + + ]
[ - - - - ]
[ - - - -
- ][ - - +
+ + - - ]
1286 : : }
1287 : :
1288 : : void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops);
1289 : :
1290 : 12155527 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk)
1291 : : {
1292 [ + - - ]: 12155527 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags);
1293 : : }
1294 : :
1295 : 1310517 : static inline bool mptcp_check_fallback(const struct sock *sk)
1296 : : {
1297 : 1310517 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
1298 [ + ]: 1310517 : struct mptcp_sock *msk = mptcp_sk(subflow->conn);
1299 : :
1300 : 1310517 : return __mptcp_check_fallback(msk);
1301 : : }
1302 : :
1303 : 1072 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk)
1304 : : {
1305 : 1072 : struct sock *ssk = READ_ONCE(msk->first);
1306 : :
1307 [ - + + ]: 2144 : return ssk && ((1 << inet_sk_state_load(ssk)) &
[ - + ]
1308 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT |
1309 : : TCPF_SYN_RECV | TCPF_LISTEN));
1310 : : }
1311 : :
1312 : : bool __mptcp_try_fallback(struct mptcp_sock *msk, int fb_mib);
1313 : :
1314 : 184 : static inline bool mptcp_try_fallback(struct sock *ssk, int fb_mib)
1315 : : {
1316 : 184 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
1317 : 184 : struct sock *sk = subflow->conn;
1318 : 184 : struct mptcp_sock *msk;
1319 : :
1320 [ + ]: 184 : msk = mptcp_sk(sk);
1321 [ + ][ + ]: 184 : if (!__mptcp_try_fallback(msk, fb_mib))
1322 : : return false;
1323 [ + + - ]: 172 : if (READ_ONCE(msk->snd_data_fin_enable) && !(ssk->sk_shutdown & SEND_SHUTDOWN)) {
[ + - ]
1324 : 0 : gfp_t saved_allocation = ssk->sk_allocation;
1325 : :
1326 : : /* we are in a atomic (BH) scope, override ssk default for data
1327 : : * fin allocation
1328 : : */
1329 : 0 : ssk->sk_allocation = GFP_ATOMIC;
1330 : 0 : ssk->sk_shutdown |= SEND_SHUTDOWN;
1331 : 0 : tcp_shutdown(ssk, SEND_SHUTDOWN);
1332 : 0 : ssk->sk_allocation = saved_allocation;
1333 : : }
1334 : : return true;
1335 : : }
1336 : :
1337 : 42 : static inline void mptcp_early_fallback(struct mptcp_sock *msk,
1338 : : struct mptcp_subflow_context *subflow,
1339 : : int fb_mib)
1340 : : {
1341 : 42 : subflow->request_mptcp = 0;
1342 [ + ]: 42 : WARN_ON_ONCE(!__mptcp_try_fallback(msk, fb_mib));
1343 : 42 : }
1344 : :
1345 : 128324 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb)
1346 : : {
1347 : 128324 : struct mptcp_ext *mpext;
1348 : :
1349 [ + ][ + ]: 128324 : mpext = skb ? mptcp_get_ext(skb) : NULL;
1350 [ + + ][ - + ]: 23143 : if (mpext && mpext->infinite_map)
1351 : 1 : return true;
1352 : :
1353 : : return false;
1354 : : }
1355 : :
1356 : 0 : static inline bool is_active_ssk(struct mptcp_subflow_context *subflow)
1357 : : {
1358 [ - - ]: 6 : return (subflow->request_mptcp || subflow->request_join);
1359 : : }
1360 : :
1361 : 1763 : static inline bool subflow_simultaneous_connect(struct sock *sk)
1362 : : {
1363 : 1763 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
1364 : :
1365 : : /* Note that the sk state implies !subflow->conn_finished. */
1366 [ + ]: 1763 : return sk->sk_state == TCP_SYN_RECV && is_active_ssk(subflow);
1367 : : }
1368 : :
1369 : : #ifdef CONFIG_SYN_COOKIES
1370 : : void subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
1371 : : struct sk_buff *skb);
1372 : : bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
1373 : : struct sk_buff *skb);
1374 : : void __init mptcp_join_cookie_init(void);
1375 : : #else
1376 : : static inline void
1377 : : subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
1378 : : struct sk_buff *skb) {}
1379 : : static inline bool
1380 : : mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
1381 : : struct sk_buff *skb)
1382 : : {
1383 : : return false;
1384 : : }
1385 : :
1386 : : static inline void mptcp_join_cookie_init(void) {}
1387 : : #endif
1388 : :
1389 : : #endif /* __MPTCP_PROTOCOL_H */
|