Minor patches
Subsystems (3)
Peter Krystad
cover Minor patches
Mostly responding to some of Paolo's comments on the MP_JOIN RFC.
Peter Krystad (7):
mptcp: reduce number of pr_debug() calls.
mptcp: reduce number of pr_debug() calls.
mptcp: reduce number of pr_debug() calls.
mptcp: reduce number of pr_debug() calls.
mptcp: parsing DSS option should use own flags field.
mptcp: Check flags in MP_CAPABLE option
mptcp: Refactor mptcp_established_options() to single hook
include/linux/tcp.h | 1 + include/net/mptcp.h | 30 +++----------- net/ipv4/tcp_output.c | 21 +++------- net/mptcp/options.c | 95 ++++++++++++++++++++++++++++--------------- net/mptcp/protocol.c | 9 +--- net/mptcp/protocol.h | 15 +++++-- net/mptcp/subflow.c | 5 +-- 7 files changed, 91 insertions(+), 85 deletions(-)
Signature · 1 line
2.17.2
Peter Krystad
PATCH 1/7 mptcp: reduce number of pr_debug() calls.
squash to: Handle MPTCP TCP options
--- net/mptcp/options.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
net/mptcp/options.c +19 -17
@@ -13,7 +13,7 @@void mptcp_parse_option (const unsigned char *ptr,int opsize,struct tcp_options_received *opt_rx) { -struct mptcp_options_received *mp_opt; +struct mptcp_options_received *mp_opt = &opt_rx->mptcp;u8 subtype = *ptr >>4 ;int expected_opsize;
@@ -25,25 +25,28 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,* 10-17: Receiver key (optional) */ case MPTCPOPT_MP_CAPABLE : -if (opsize !=TCPOLEN_MPTCP_MPC_SYN && - opsize !=TCPOLEN_MPTCP_MPC_SYNACK ) -break ; - -pr_debug ("MP_CAPABLE" ); - opt_rx->mptcp.version = *ptr++ &MPTCPOPT_VERSION_MASK ; -if (opt_rx->mptcp.version !=0 ) + mp_opt->version = *ptr++ &MPTCPOPT_VERSION_MASK ; +if (mp_opt->version !=0 )break ; - opt_rx->mptcp.mp_capable =1 ; -pr_debug ("flags=%02x" , *ptr); - opt_rx->mptcp.flags = *ptr++; - opt_rx->mptcp.sndr_key =get_unaligned_be64 (ptr); -pr_debug ("sndr_key=%llu" , opt_rx->mptcp.sndr_key); + mp_opt->mp_capable =1 ; + mp_opt->flags = *ptr++; + mp_opt->sndr_key =get_unaligned_be64 (ptr); ptr +=8 ; -if (opsize ==TCPOLEN_MPTCP_MPC_SYNACK ) { - opt_rx->mptcp.rcvr_key =get_unaligned_be64 (ptr); -pr_debug ("rcvr_key=%llu" , opt_rx->mptcp.rcvr_key); + +if (opsize ==TCPOLEN_MPTCP_MPC_SYN ) { +pr_debug ("MP_CAPABLE flags=%x, sndr=%llu" , + mp_opt->flags, mp_opt->sndr_key); + }else if ((opsize ==TCPOLEN_MPTCP_MPC_SYNACK ) || + (opsize ==TCPOLEN_MPTCP_MPC_ACK )) { + mp_opt->rcvr_key =get_unaligned_be64 (ptr); ptr +=8 ; +pr_debug ("MP_CAPABLE flags=%x, sndr=%llu, rcvr=%llu" , + mp_opt->flags, mp_opt->sndr_key, + mp_opt->rcvr_key); + }else { +pr_warn ("MP_CAPABLE bad option size" ); + mp_opt->mp_capable =0 ; }break ;
@@ -79,7 +82,6 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,*/ case MPTCPOPT_DSS :pr_debug ("DSS" ); - mp_opt = &opt_rx->mptcp; mp_opt->dss =1 ; ptr++;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 2/7 mptcp: reduce number of pr_debug() calls.
In reply to Peter Krystadsquash to: Handle MP_CAPABLE options for outgoing connections
--- net/mptcp/options.c | 5 ++--- net/mptcp/protocol.c | 2 -- net/mptcp/subflow.c | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-)
net/mptcp/options.c +2 -3
@@ -250,15 +250,14 @@ bool mptcp_established_options(struct sock *sk, unsigned int *size, {struct subflow_context *subflow =subflow_ctx (sk); -pr_debug ("subflow=%p" , subflow);if (subflow->mp_capable && !subflow->fourth_ack) { opts->suboptions =OPTION_MPTCP_MPC_ACK ; opts->sndr_key = subflow->local_key; opts->rcvr_key = subflow->remote_key; *size =TCPOLEN_MPTCP_MPC_ACK ; subflow->fourth_ack =1 ; -pr_debug ("local_key=%llu" , subflow->local_key); -pr_debug ("remote_key=%llu" , subflow->remote_key); +pr_debug ("subflow=%p, local_key=%llu, remote_key=%llu" , + subflow, subflow->local_key, subflow->remote_key);return true; }return false;
net/mptcp/protocol.c +0 -2
@@ -721,8 +721,6 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable)struct mptcp_sock *msk =mptcp_sk (sk);struct subflow_context *subflow =subflow_ctx (msk->subflow->sk); -pr_debug ("msk=%p" , msk); -if (mp_capable) {u64 ack_seq;
net/mptcp/subflow.c +2 -3
@@ -80,10 +80,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)inet_sk_rx_dst_set (sk, skb); -pr_debug ("subflow=%p" ,subflow_ctx (sk)); -if (subflow->conn && !subflow->conn_finished) { -pr_debug ("remote_key=%llu" , subflow->remote_key); +pr_debug ("subflow=%p, remote_key=%llu" ,subflow_ctx (sk), + subflow->remote_key);mptcp_finish_connect (subflow->conn, subflow->mp_capable); subflow->conn_finished =1 ;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 3/7 mptcp: reduce number of pr_debug() calls.
In reply to Peter Krystadsquash to: Create SUBFLOW socket for incoming connections
--- net/mptcp/options.c | 6 +++--- net/mptcp/protocol.c | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-)
net/mptcp/options.c +3 -3
@@ -339,14 +339,14 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, {struct subflow_request_sock *subflow_req =subflow_rsk (req); -pr_debug ("subflow_req=%p" , subflow_req);if (subflow_req->mp_capable) { opts->suboptions =OPTION_MPTCP_MPC_SYNACK ; opts->sndr_key = subflow_req->local_key; opts->rcvr_key = subflow_req->remote_key; *size =TCPOLEN_MPTCP_MPC_SYNACK ; -pr_debug ("local_key=%llu" , subflow_req->local_key); -pr_debug ("remote_key=%llu" , subflow_req->remote_key); +pr_debug ("subflow_req=%p, local_key=%llu, remote_key=%llu" , + subflow_req, subflow_req->local_key, + subflow_req->remote_key);return true; }return false;
net/mptcp/protocol.c +1 -4
@@ -596,9 +596,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,return NULL ; subflow =subflow_ctx (new_sock->sk); -pr_debug ("new subflow=%p" , subflow); - -pr_debug ("new msk=%p" , msk); +pr_debug ("msk=%p, new subflow=%p, " , msk, subflow);if (subflow->mp_capable) {struct sock *new_mptcp_sock;
@@ -623,7 +621,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token; -pr_debug ("token=%u" , msk->token);token_update_accept (new_sock->sk, new_mptcp_sock); msk->subflow =NULL ;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 4/7 mptcp: reduce number of pr_debug() calls.
In reply to Peter Krystadsquash to: Implement MPTCP receive path
--- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/protocol.c +1 -1
@@ -747,7 +747,7 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable) msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token; -pr_debug ("token=%u" , msk->token); +pr_debug ("msk=%p, token=%u" , msk, msk->token);crypto_key_sha1 (msk->remote_key,NULL , &ack_seq); msk->write_seq = subflow->idsn +1 ;
Signature · 1 line
2.17.2
Peter Krystad
PATCH 5/7 mptcp: parsing DSS option should use own flags field.
In reply to Peter KrystadIt is possible that both MP_CAPABLE and DSS options are received in the same header, so they cannot share fields.
squashto: Implement MPTCP reveive path.
--- include/linux/tcp.h | 1 + include/net/mptcp.h | 9 --------- net/mptcp/options.c | 12 ++++++------ net/mptcp/protocol.h | 8 ++++++++ 4 files changed, 15 insertions(+), 15 deletions(-)
include/linux/tcp.h +1 -0
@@ -118,6 +118,7 @@ struct tcp_options_received { dss :1 , version : 4;u8 flags; +u8 dss_flags; u8 use_map:1, dsn64:1, use_checksum:1,
include/net/mptcp.h +0 -9
@@ -8,15 +8,6 @@ #ifndef __NET_MPTCP_H #define __NET_MPTCP_H -/* MPTCP DSS flags */ - -#define MPTCP_DSS_DATA_FIN BIT(4) -#define MPTCP_DSS_DSN64 BIT(3) -#define MPTCP_DSS_HAS_MAP BIT(2) -#define MPTCP_DSS_ACK64 BIT(1) -#define MPTCP_DSS_HAS_ACK BIT(0) -#define MPTCP_DSS_FLAG_MASK (0x1F) - /* MPTCP sk_buff extension data */ struct mptcp_ext { u64 data_ack;
net/mptcp/options.c +6 -6
@@ -85,12 +85,12 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, mp_opt->dss =1 ; ptr++; - mp_opt->flags = (*ptr++) &MPTCP_DSS_FLAG_MASK ; - mp_opt->data_fin = (mp_opt->flags &MPTCP_DSS_DATA_FIN ) !=0 ; - mp_opt->dsn64 = (mp_opt->flags &MPTCP_DSS_DSN64 ) !=0 ; - mp_opt->use_map = (mp_opt->flags &MPTCP_DSS_HAS_MAP ) !=0 ; - mp_opt->ack64 = (mp_opt->flags &MPTCP_DSS_ACK64 ) !=0 ; - mp_opt->use_ack = (mp_opt->flags &MPTCP_DSS_HAS_ACK ); + mp_opt->dss_flags = (*ptr++) &MPTCP_DSS_FLAG_MASK ; + mp_opt->data_fin = (mp_opt->dss_flags &MPTCP_DSS_DATA_FIN ) !=0 ; + mp_opt->dsn64 = (mp_opt->dss_flags &MPTCP_DSS_DSN64 ) !=0 ; + mp_opt->use_map = (mp_opt->dss_flags &MPTCP_DSS_HAS_MAP ) !=0 ; + mp_opt->ack64 = (mp_opt->dss_flags &MPTCP_DSS_ACK64 ) !=0 ; + mp_opt->use_ack = (mp_opt->dss_flags &MPTCP_DSS_HAS_ACK ); pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d", mp_opt->data_fin, mp_opt->dsn64,
net/mptcp/protocol.h +8 -0
@@ -27,6 +27,14 @@#define MPTCP_CAP_EXTENSIBILITY (1 << 6)#define MPTCP_CAP_HMAC_SHA1 (1 << 0) +/* MPTCP DSS flags */ +#define MPTCP_DSS_DATA_FIN BIT(4) +#define MPTCP_DSS_DSN64 BIT(3) +#define MPTCP_DSS_HAS_MAP BIT(2) +#define MPTCP_DSS_ACK64 BIT(1) +#define MPTCP_DSS_HAS_ACK BIT(0) +#define MPTCP_DSS_FLAG_MASK (0x1F) +/* MPTCP connection sock */ struct mptcp_sock {/* inet_connection_sock must be the first member */
Signature · 1 line
2.17.2
Peter Krystad
PATCH 6/7 mptcp: Check flags in MP_CAPABLE option
In reply to Peter Krystadsquashto: Handle MPTCP TCP options
--- net/mptcp/options.c | 6 +++++- net/mptcp/protocol.h | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
net/mptcp/options.c +5 -1
@@ -29,8 +29,12 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,if (mp_opt->version !=0 )break ; - mp_opt->mp_capable =1 ; mp_opt->flags = *ptr++; +if (!((mp_opt->flags &MPTCP_CAP_FLAG_MASK ) ==MPTCP_CAP_HMAC_SHA1 ) || + (mp_opt->flags &MPTCP_CAP_EXTENSIBILITY )) +break ; + + mp_opt->mp_capable =1 ; mp_opt->sndr_key =get_unaligned_be64 (ptr); ptr +=8 ;
net/mptcp/protocol.h +4 -3
@@ -23,9 +23,10 @@#define MPTCPOPT_VERSION_MASK 0x0F/* MPTCP handshake flags */ -#define MPTCP_CAP_CHECKSUM_REQD (1 << 7) -#define MPTCP_CAP_EXTENSIBILITY (1 << 6) -#define MPTCP_CAP_HMAC_SHA1 (1 << 0) +#define MPTCP_CAP_CHECKSUM_REQD BIT(7) +#define MPTCP_CAP_EXTENSIBILITY BIT(6) +#define MPTCP_CAP_HMAC_SHA1 BIT(0) +#define MPTCP_CAP_FLAG_MASK (0x3F)/* MPTCP DSS flags */ #define MPTCP_DSS_DATA_FIN BIT(4)
Signature · 1 line
2.17.2
Peter Krystad
PATCH 7/7 mptcp: Refactor mptcp_established_options() to single hook
In reply to Peter KrystadMake there only be one callout from tcp_output.c for this. Includes refactoring from the first patch in the MP_JOIN RFC.
squash to: Write MPTCP DSS headers
--- include/net/mptcp.h | 21 ++++++--------------- net/ipv4/tcp_output.c | 21 ++++++--------------- net/mptcp/options.c | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 36 deletions(-)
include/net/mptcp.h +6 -15
@@ -57,13 +57,11 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,bool mptcp_syn_options (struct sock *sk,unsigned int *size,struct mptcp_out_options * opts);void mptcp_rcv_synsent (struct sock *sk); -bool mptcp_established_options_dss (struct sock *sk,struct sk_buff *skb, -unsigned int *size,unsigned int remaining, -struct mptcp_out_options * opts);bool mptcp_synack_options (const struct request_sock *req,unsigned int *size,struct mptcp_out_options *opts); -bool mptcp_established_options (struct sock *sk,unsigned int *size, -struct mptcp_out_options *opts); +bool mptcp_established_options (struct sock *sk,struct sk_buff *skb, +unsigned int *size,unsigned int remaining, +struct mptcp_out_options * opts);void mptcp_attach_dss (struct sock *sk,struct sk_buff *skb,struct tcp_options_received *opt_rx);
@@ -106,15 +104,6 @@ static inline void mptcp_rcv_synsent(struct sock *sk) { } -static inline bool mptcp_established_options_dss (struct sock *sk, -struct sk_buff *skb, -unsigned int *size, -unsigned int remaining, -struct mptcp_out_options * opts) -{ -return false; -} -static inline bool mptcp_synack_options (const struct request_sock *req,unsigned int *size,struct mptcp_out_options *opts)
@@ -123,8 +112,10 @@ static inline bool mptcp_synack_options(const struct request_sock *req, }static inline bool mptcp_established_options (struct sock *sk, +struct sk_buff *skb,unsigned int *size, -struct mptcp_out_options *opts) +unsigned int remaining, +struct mptcp_out_options * opts); {return false; }
net/ipv4/tcp_output.c +6 -15
@@ -443,6 +443,7 @@ struct tcp_out_options {static void mptcp_options_write (__be32 *ptr,struct tcp_out_options *opts) { +pr_debug ("entered" );#if IS_ENABLED (CONFIG_MPTCP )if (unlikely (OPTION_MPTCP & opts->options))mptcp_write_options (ptr, &opts->mptcp);
@@ -796,22 +797,12 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb*/ if (sk_is_mptcp (sk)) {unsigned int remaining =MAX_TCP_OPTION_SPACE - size; -unsigned int opt_size; +unsigned int opt_size =0 ; -if (mptcp_established_options (sk, &opt_size, &opts->mptcp)) { -if (remaining >= opt_size) { - opts->options |=OPTION_MPTCP ; - size += opt_size; - } - }else { -unsigned int dss_size; - -if (mptcp_established_options_dss (sk, skb, &dss_size, - remaining, - &opts->mptcp)) { - opts->options |=OPTION_MPTCP ; - size += dss_size; - } +if (mptcp_established_options (sk, skb, &opt_size, remaining, + &opts->mptcp)) { + opts->options |=OPTION_MPTCP ; + size += opt_size; } }
net/mptcp/options.c +30 -6
@@ -249,12 +249,14 @@ void mptcp_rcv_synsent(struct sock *sk) } } -bool mptcp_established_options (struct sock *sk,unsigned int *size, -struct mptcp_out_options *opts) +static bool mptcp_established_options_mp (struct sock *sk,unsigned int *size, +unsigned int remaining, +struct mptcp_out_options *opts) {struct subflow_context *subflow =subflow_ctx (sk); -if (subflow->mp_capable && !subflow->fourth_ack) { +if (subflow->mp_capable && !subflow->fourth_ack && + remaining >=TCPOLEN_MPTCP_MPC_ACK ) { opts->suboptions =OPTION_MPTCP_MPC_ACK ; opts->sndr_key = subflow->local_key; opts->rcvr_key = subflow->remote_key;
@@ -267,9 +269,10 @@ bool mptcp_established_options(struct sock *sk, unsigned int *size,return false; } -bool mptcp_established_options_dss (struct sock *sk,struct sk_buff *skb, -unsigned int *size,unsigned int remaining, -struct mptcp_out_options *opts) +static bool mptcp_established_options_dss (struct sock *sk,struct sk_buff *skb, +unsigned int *size, +unsigned int remaining, +struct mptcp_out_options *opts) {unsigned int dss_size =0 ;struct mptcp_ext *mpext;
@@ -338,6 +341,27 @@ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,return true; } +bool mptcp_established_options (struct sock *sk,struct sk_buff *skb, +unsigned int *size,unsigned int remaining, +struct mptcp_out_options *opts) +{ +unsigned int opt_size =0 ; + +if (mptcp_established_options_mp (sk, &opt_size, remaining, opts)) { + *size += opt_size; + remaining -= opt_size; +return true; + } +else if (mptcp_established_options_dss (sk, skb, &opt_size, remaining, + opts)) { + *size += opt_size; + remaining -= opt_size; +return true; + } + +return false; +} +bool mptcp_synack_options (const struct request_sock *req,unsigned int *size,struct mptcp_out_options *opts) {
Signature · 1 line
2.17.2
Paolo Abeni
Re: [MPTCP] [PATCH 1/7] mptcp: reduce number of pr_debug() calls.
In reply to Peter KrystadHi Peter,
Thank you for the great effort!
I have a few comments, see below...
Quoted 24 lines · Peter Krystad
squash to: Handle MPTCP TCP options
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- net/mptcp/options.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)net/mptcp/options.c +1
-1@@ -13,7 +13,7 @@void mptcp_parse_option (const unsigned char *ptr,int opsize,struct tcp_options_received *opt_rx) { -struct mptcp_options_received *mp_opt; +struct mptcp_options_received *mp_opt = &opt_rx->mptcp;u8 subtype = *ptr >>4 ;int expected_opsize;@@ -25,25 +25,28 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,* 10-17: Receiver key (optional) */ case MPTCPOPT_MP_CAPABLE :
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 30
Quoted 10 lines
net/mptcp/options.c +2
-7-if (opsize !=TCPOLEN_MPTCP_MPC_SYN && - opsize !=TCPOLEN_MPTCP_MPC_SYNACK ) -break ; - -pr_debug ("MP_CAPABLE" ); - opt_rx->mptcp.version = *ptr++ &MPTCPOPT_VERSION_MASK ; -if (opt_rx->mptcp.version !=0 ) + mp_opt->version = *ptr++ &MPTCPOPT_VERSION_MASK ; +if (mp_opt->version !=0 )break ;
I think we need to check the optsize before accessiong the option data, or we could end-up reading after the packet end, for malformed/malicious pkts.
Quoted 9 lines
net/mptcp/options.c +3
-5- opt_rx->mptcp.mp_capable =1 ; -pr_debug ("flags=%02x" , *ptr); - opt_rx->mptcp.flags = *ptr++; - opt_rx->mptcp.sndr_key =get_unaligned_be64 (ptr); -pr_debug ("sndr_key=%llu" , opt_rx->mptcp.sndr_key); + mp_opt->mp_capable =1 ; + mp_opt->flags = *ptr++; + mp_opt->sndr_key =get_unaligned_be64 (ptr);
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 41
Quoted 10 lines
net/mptcp/options.c +6
-3ptr +=8 ; -if (opsize ==TCPOLEN_MPTCP_MPC_SYNACK ) { - opt_rx->mptcp.rcvr_key =get_unaligned_be64 (ptr); -pr_debug ("rcvr_key=%llu" , opt_rx->mptcp.rcvr_key); + +if (opsize ==TCPOLEN_MPTCP_MPC_SYN ) { +pr_debug ("MP_CAPABLE flags=%x, sndr=%llu" , + mp_opt->flags, mp_opt->sndr_key); + }else if ((opsize ==TCPOLEN_MPTCP_MPC_SYNACK ) || + (opsize ==TCPOLEN_MPTCP_MPC_ACK )) {
Since TCPOLEN_MPTCP_MPC_ACK == TCPOLEN_MPTCP_MPC_SYNACK, possibly some compilers may emit a warning here?!? perhpas we can just drop the second comparison, with a comment.
Thanks,
Paolo
Paolo Abeni
Re: [MPTCP] [PATCH 7/7] mptcp: Refactor mptcp_established_options() to single hook
In reply to Peter KrystadHi,
I have a couple of very minor comments here, please see below.
b/ struct tcp_out_options { · line 446
Quoted 9 lines · Peter Krystad
b/ renamed from net/ipv4/tcp_output.c +1
-0@@ -443,6 +443,7 @@ struct tcp_out_options { static void mptcp_options_write(__be32 *ptr, struct tcp_out_options *opts) { + pr_debug("entered");
I think the above debug message could be moved under the CONFIG_MPTCP conditional, or possibly even dropped.
Quoted 3 lines
b/ renamed from net/ipv4/tcp_output.c +0
-0#if IS_ENABLED(CONFIG_MPTCP) if (unlikely(OPTION_MPTCP & opts->options)) mptcp_write_options(ptr, &opts->mptcp);
[...]
Quoted 7 lines
b/ renamed from net/ipv4/tcp_output.c +3
-0@@ -338,6 +341,27 @@ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, return true; } +bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, + unsigned int *size, unsigned int remaining, + struct mptcp_out_options *opts)
b/ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · line 356
Quoted 10 lines
b/ renamed from net/ipv4/tcp_output.c +10
-0+{ + unsigned int opt_size = 0; + + if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) { + *size += opt_size; + remaining -= opt_size; + return true; + } + else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining, + opts)) {
I think the preferred kernel style is: '} else if ('...
Perhpas moving here the 'if (subflow->mp_capable' test from both mptcp_established_options_dss() and mptcp_established_options_mp() would simplify the code?
Thanks!
Paolo
Matthieu Baerts
Re: [MPTCP] [PATCH 2/7] mptcp: reduce number of pr_debug() calls.
In reply to Peter KrystadHi Peter, Paolo,
Quoted 1 line · Peter Krystad
squash to: Handle
MP_CAPABLEoptions for outgoing connections
Thank you for the patch and the review!
- 7b596f5c7e54: "squash"
- signed-off was already there
- no conflict
- 139b7751e395..0569a65aca45: result
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
Re: [MPTCP] [PATCH 3/7] mptcp: reduce number of pr_debug() calls.
In reply to Peter KrystadHi Peter, Paolo,
Quoted 1 line · Peter Krystad
squash to: Create SUBFLOW socket for incoming connections
Thank you for the patch and the review!
- 17c4b4cad16d: "squash" in "mptcp: Create SUBFLOW socket for incoming connections": I didn't take one diff, see below
- signed-off was already there
- 5d1039667868: "squash" (part 2) in "mptcp: accept: don't leak mptcp socket structure"
- no conflict
- 0569a65aca45..eec1d25d9283: result
Quoted 44 lines
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- net/mptcp/options.c | 6 +++--- net/mptcp/protocol.c | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-)net/mptcp/options.c +3
-3@@ -339,14 +339,14 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, {struct subflow_request_sock *subflow_req =subflow_rsk (req); -pr_debug ("subflow_req=%p" , subflow_req);if (subflow_req->mp_capable) { opts->suboptions =OPTION_MPTCP_MPC_SYNACK ; opts->sndr_key = subflow_req->local_key; opts->rcvr_key = subflow_req->remote_key; *size =TCPOLEN_MPTCP_MPC_SYNACK ; -pr_debug ("local_key=%llu" , subflow_req->local_key); -pr_debug ("remote_key=%llu" , subflow_req->remote_key); +pr_debug ("subflow_req=%p, local_key=%llu, remote_key=%llu" , + subflow_req, subflow_req->local_key, + subflow_req->remote_key);return true; }return false;net/mptcp/protocol.c +1
-3@@ -596,9 +596,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,return NULL ; subflow =subflow_ctx (new_sock->sk); -pr_debug ("new subflow=%p" , subflow); - -pr_debug ("new msk=%p" , msk); +pr_debug ("msk=%p, new subflow=%p, " , msk, subflow);if (subflow->mp_capable) {struct sock *new_mptcp_sock;
net/mptcp/protocol.c static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · line 626
Quoted 4 lines
net/mptcp/protocol.c +0
-1@@ -623,7 +621,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token; -pr_debug ("token=%u" , msk->token);
This pr_debug() has been added after, in "mptcp: Implement MPTCP receive path". I then moved this change to the next patch (4/7).
Cheers,
Matt
Quoted 4 lines
net/mptcp/protocol.c +0
-0token_update_accept (new_sock->sk, new_mptcp_sock); msk->subflow =NULL ;
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
Re: [MPTCP] [PATCH 4/7] mptcp: reduce number of pr_debug() calls.
In reply to Peter KrystadHi Peter, Paolo,
Quoted 1 line · Peter Krystad
squash to: Implement MPTCP receive path
Thank you for the patch and the review!
- e2fd582aa5c1: "squash" in "mptcp: Implement MPTCP receive path": I also added a diff from the previous patch (3/7), see below
- c1873d1e4ed6: signed-off
- 5d1039667868: "squash" (part 2) in "mptcp: accept: don't leak mptcp socket structure"
- c4df6da5e7d3: conflict
- a9c9e1105ce0: conflict
- a053cbcf3dd5: conflict
- eec1d25d9283..612e3f6c26e6: result
net/mptcp/protocol.c
Quoted 9 lines
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/mptcp/protocol.c +0
-0
I also added this block from patch 3/7:
@@ -623,7 +621,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token;
- pr_debug("token=%u", msk->token);
token_update_accept(new_sock->sk, new_mptcp_sock); msk->subflow = NULL;
Cheers,
Matt
Quoted 10 lines
net/mptcp/protocol.c +1
-1@@ -747,7 +747,7 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable) msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token; -pr_debug ("token=%u" , msk->token); +pr_debug ("msk=%p, token=%u" , msk, msk->token);crypto_key_sha1 (msk->remote_key,NULL , &ack_seq); msk->write_seq = subflow->idsn +1 ;
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
Re: [MPTCP] [PATCH 5/7] mptcp: parsing DSS option should use own flags field.
In reply to Peter KrystadHi Peter, Paolo,
Quoted 4 lines · Peter Krystad
It is possible that both
MP_CAPABLEand DSS options are received in the same header, so they cannot share fields.squashto: Implement MPTCP reveive path.
Thank you for the patch and the review!
- c30fe64dafe0: "squash" in "mptcp: Implement MPTCP reveive path"
- signed-off was already there
- no conflict
- 612e3f6c26e6..666387ce8fc1: result
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
Re: [MPTCP] [PATCH 6/7] mptcp: Check flags in MP_CAPABLE option
In reply to Peter KrystadHi Peter, Paolo,
Quoted 1 line · Peter Krystad
squashto: Handle MPTCP TCP options
Thank you for the patch and the review!
- 5f1e8d8943f5: "squash" in "mptcp: Handle MPTCP TCP options". Note that I had to modify the variables, please see below
- signed-off was already there
- 062cef9d7641: conflict
- 666387ce8fc1..2d097652ba6c: result
Quoted 11 lines
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>--- net/mptcp/options.c | 6 +++++- net/mptcp/protocol.h | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-)net/mptcp/options.c +0
-0
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 37
Quoted 10 lines
net/mptcp/options.c +5
-1@@ -29,8 +29,12 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,if (mp_opt->version !=0 )break ; - mp_opt->mp_capable =1 ; mp_opt->flags = *ptr++; +if (!((mp_opt->flags &MPTCP_CAP_FLAG_MASK ) ==MPTCP_CAP_HMAC_SHA1 ) || + (mp_opt->flags &MPTCP_CAP_EXTENSIBILITY )) +break ; + + mp_opt->mp_capable =1 ;
I had to switch back to "opt_rx->mptcp" instead of "mp_opt" as I didn't take your first patch of this series. When you will provide a v2 for this patch 1/7, can you do a rebase first and do the opposite change to use "mp_opt" please?
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
Hi Peter,
Quoted 10 lines · Peter Krystad
Mostly responding to some of Paolo's comments on the
MP_JOINRFC.Peter Krystad (7):
mptcp: reduce number ofpr_debug()calls.
mptcp: reduce number ofpr_debug()calls.
mptcp: reduce number ofpr_debug()calls.
mptcp: reduce number ofpr_debug()calls.
mptcp: parsing DSS option should use own flags field.
mptcp: Check flags inMP_CAPABLEoption
mptcp: Refactormptcp_established_options()to single hook
Thank you for this patch-set!
As agreed yesterday at the meeting, I added patches 2 → 6 in the repo.
Please note that the first patch was also doing some refactoring that were affecting the 6th patch ("mptcp: Check flags in MP_CAPABLE option"). For more details about that, please see the corresponding email.
When you will send a v2 for the first and last patch, may you do a rebase and also apply the refactoring in the code changed by the 6th patch? Anyway I guess you should get a small and simple conflict when doing the rebase.
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Mat Martineau
Re: [MPTCP] [PATCH 7/7] mptcp: Refactor mptcp_established_options() to single hook
In reply to Peter KrystadQuoted 12 lines · Peter Krystad
Make there only be one callout from
tcp_output.cfor this. Includes refactoring from the first patch in theMP_JOINRFC.squash to: Write MPTCP DSS headers
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>---
include/net/mptcp.h | 21 ++++++--------------- net/ipv4/tcp_output.c | 21 ++++++--------------- net/mptcp/options.c | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 36 deletions(-)
...
Quoted 4 lines
net/mptcp/options.c +0
-0
...
Quoted 11 lines
net/mptcp/options.c +7
-0@@ -338,6 +341,27 @@ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,return true; } +bool mptcp_established_options (struct sock *sk,struct sk_buff *skb, +unsigned int *size,unsigned int remaining, +struct mptcp_out_options *opts) +{ +unsigned int opt_size =0 ; + +if (mptcp_established_options_mp (sk, &opt_size, remaining, opts)) {
net/mptcp/options.c bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · line 360
Quoted 10 lines
net/mptcp/options.c +10
-0+ *size += opt_size; + remaining -= opt_size; +return true; + } +else if (mptcp_established_options_dss (sk, skb, &opt_size, remaining, + opts)) { + *size += opt_size; + remaining -= opt_size; +return true; + }
Given that the code for both clauses is the same, maybe
if (mptcp_established_options_mp(...) ||
mptcp_established_options_dss(...)) {
*size += opt_size;
remaining -= opt_size;
return true;
}would reduce duplication.
Since the DSS variant is the common case, I was tempted to suggest collapsing all the MP and DSS code in to this one function. I don't think that makes a real difference since the compiler will probably inline everything anyway.
I agree with Paolo's suggestion to do a single, early mp_capable check.
net/mptcp/options.c bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · line 367
Quoted 7 lines
net/mptcp/options.c +4
-0+ +return false; +} +bool mptcp_synack_options (const struct request_sock *req,unsigned int *size,struct mptcp_out_options *opts) {
--
Mat Martineau
Intel
Peter Krystad
Re: [MPTCP] [PATCH 7/7] mptcp: Refactor mptcp_established_options() to single hook
Quoted 48 lines · Mat Martineau
Quoted 12 lines · Peter Krystad
Make there only be one callout from
tcp_output.cfor this. Includes refactoring from the first patch in theMP_JOINRFC.squash to: Write MPTCP DSS headers
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>---
include/net/mptcp.h | 21 ++++++--------------- net/ipv4/tcp_output.c | 21 ++++++--------------- net/mptcp/options.c | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 36 deletions(-)...
Quoted 4 lines
net/mptcp/options.c +0
-0...
Quoted 11 lines
net/mptcp/options.c +7
-0@@ -338,6 +341,27 @@ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,return true; } +bool mptcp_established_options (struct sock *sk,struct sk_buff *skb, +unsigned int *size,unsigned int remaining, +struct mptcp_out_options *opts) +{ +unsigned int opt_size =0 ; + +if (mptcp_established_options_mp (sk, &opt_size, remaining, opts)) {net/mptcp/options.c bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · line 360
Quoted 10 lines
net/mptcp/options.c +10
-0+ *size += opt_size; + remaining -= opt_size; +return true; + } +else if (mptcp_established_options_dss (sk, skb, &opt_size, remaining, + opts)) { + *size += opt_size; + remaining -= opt_size; +return true; + }Given that the code for both clauses is the same, maybe
Quoted 8 lines
if (
mptcp_established_options_mp(...)||mptcp_established_options_dss(...)) { *size += opt_size; remaining -= opt_size; return true; }would reduce duplication.
In the future I think it is likely this if/else clause will be changed to allow sending multiple options a single header so I was planning to leave as is.
Quoted 7 lines
Since the DSS variant is the common case, I was tempted to suggest collapsing all the MP and DSS code in to this one function. I don't think that makes a real difference since the compiler will probably inline everything anyway.
I agree with Paolo's suggestion to do a single, early
mp_capablecheck.
This I did.
Peter.
Quoted 11 lines
net/mptcp/options.c bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · line 367
Quoted 7 lines
net/mptcp/options.c +4
-0+ +return false; +} +bool mptcp_synack_options (const struct request_sock *req,unsigned int *size,struct mptcp_out_options *opts) {--
Mat Martineau
Intel