Skip to content

Commit bab6b88

Browse files
geliangtangdavem330
authored andcommitted
mptcp: add allow_join_id0 in mptcp_out_options
This patch defined a new flag MPTCP_CAP_DENY_JOIN_ID0 for the third bit, labeled "C" of the MP_CAPABLE option. Add a new flag allow_join_id0 in struct mptcp_out_options. If this flag is set, send out the MP_CAPABLE option with the flag MPTCP_CAP_DENY_JOIN_ID0. Acked-by: Paolo Abeni <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d2f7796 commit bab6b88

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

include/net/mptcp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ struct mptcp_out_options {
6767
u8 backup;
6868
u8 reset_reason:4,
6969
reset_transient:1,
70-
csum_reqd:1;
70+
csum_reqd:1,
71+
allow_join_id0:1;
7172
u32 nonce;
7273
u64 thmac;
7374
u32 token;

net/mptcp/options.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
402402
if (subflow->request_mptcp) {
403403
opts->suboptions = OPTION_MPTCP_MPC_SYN;
404404
opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk));
405+
opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk));
405406
*size = TCPOLEN_MPTCP_MPC_SYN;
406407
return true;
407408
} else if (subflow->request_join) {
@@ -490,6 +491,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
490491
opts->sndr_key = subflow->local_key;
491492
opts->rcvr_key = subflow->remote_key;
492493
opts->csum_reqd = READ_ONCE(msk->csum_enabled);
494+
opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk));
493495

494496
/* Section 3.1.
495497
* The MP_CAPABLE option is carried on the SYN, SYN/ACK, and ACK
@@ -827,6 +829,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
827829
opts->suboptions = OPTION_MPTCP_MPC_SYNACK;
828830
opts->sndr_key = subflow_req->local_key;
829831
opts->csum_reqd = subflow_req->csum_reqd;
832+
opts->allow_join_id0 = subflow_req->allow_join_id0;
830833
*size = TCPOLEN_MPTCP_MPC_SYNACK;
831834
pr_debug("subflow_req=%p, local_key=%llu",
832835
subflow_req, subflow_req->local_key);
@@ -1201,6 +1204,9 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
12011204
if (opts->csum_reqd)
12021205
flag |= MPTCP_CAP_CHECKSUM_REQD;
12031206

1207+
if (!opts->allow_join_id0)
1208+
flag |= MPTCP_CAP_DENY_JOIN_ID0;
1209+
12041210
*ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len,
12051211
MPTCP_SUPPORTED_VERSION,
12061212
flag);

net/mptcp/protocol.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@
7979
#define MPTCP_VERSION_MASK (0x0F)
8080
#define MPTCP_CAP_CHECKSUM_REQD BIT(7)
8181
#define MPTCP_CAP_EXTENSIBILITY BIT(6)
82+
#define MPTCP_CAP_DENY_JOIN_ID0 BIT(5)
8283
#define MPTCP_CAP_HMAC_SHA256 BIT(0)
83-
#define MPTCP_CAP_FLAG_MASK (0x3F)
84+
#define MPTCP_CAP_FLAG_MASK (0x1F)
8485

8586
/* MPTCP DSS flags */
8687
#define MPTCP_DSS_DATA_FIN BIT(4)
@@ -350,7 +351,8 @@ struct mptcp_subflow_request_sock {
350351
u16 mp_capable : 1,
351352
mp_join : 1,
352353
backup : 1,
353-
csum_reqd : 1;
354+
csum_reqd : 1,
355+
allow_join_id0 : 1;
354356
u8 local_id;
355357
u8 remote_id;
356358
u64 local_key;

net/mptcp/subflow.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static void subflow_init_req(struct request_sock *req, const struct sock *sk_lis
109109
subflow_req->mp_capable = 0;
110110
subflow_req->mp_join = 0;
111111
subflow_req->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk_listener));
112+
subflow_req->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk_listener));
112113
subflow_req->msk = NULL;
113114
mptcp_token_init_request(req);
114115
}

0 commit comments

Comments
 (0)