mptcp: Remove all traces of checksum support
Subsystems (2)
Peter Krystad
PATCH 1/1 mptcp: Remove all traces of checksum support
Since checksum support is not planned remove any references that look it may be supported.
Also re-factor DSS option size calculation and make DSS option size check for exactly correct lengths.
--- net/mptcp/options.c | 69 +++++++++++++++++--------------------------- net/mptcp/protocol.c | 13 ++++----- net/mptcp/protocol.h | 4 +-- net/mptcp/subflow.c | 5 ---- 4 files changed, 32 insertions(+), 59 deletions(-)
net/mptcp/options.c +26 -43
@@ -130,7 +130,6 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,*/ case MPTCPOPT_DSS :pr_debug ("DSS" ); - mp_opt->dss =1 ; ptr++; mp_opt->dss_flags = (*ptr++) &MPTCP_DSS_FLAG_MASK ;
@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, expected_opsize +=TCPOLEN_MPTCP_DSS_ACK64 ; else expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + } + +if (mp_opt->use_map) { +if (mp_opt->dsn64) + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP64 ; +else + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP32 ; + } -if (opsize < expected_opsize) -break ; +/* RFC 6824, Section 3.3: +* If a checksum is present, but its use had +* not been negotiated in the MP_CAPABLE handshake, +* the checksum field MUST be ignored. +*/ +if (opsize != expected_opsize && + opsize != expected_opsize +TCPOLEN_MPTCP_DSS_CHECKSUM ) +break ; + mp_opt->dss =1 ; + +if (mp_opt->use_ack) {if (mp_opt->ack64) { mp_opt->data_ack =get_unaligned_be64 (ptr); ptr +=8 ;
@@ -163,19 +179,10 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, mp_opt->data_ack =get_unaligned_be32 (ptr); ptr +=4 ; } -pr_debug ("data_ack=%llu" , mp_opt->data_ack); }if (mp_opt->use_map) { -if (mp_opt->dsn64) - expected_opsize +=TCPOLEN_MPTCP_DSS_MAP64 ; -else - expected_opsize +=TCPOLEN_MPTCP_DSS_MAP32 ; - -if (opsize < expected_opsize) -break ; -if (mp_opt->dsn64) { mp_opt->data_seq =get_unaligned_be64 (ptr); ptr +=8 ;
@@ -190,13 +197,11 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, mp_opt->data_len =get_unaligned_be16 (ptr); ptr +=2 ; -/* Checksum not currently supported */ - mp_opt->checksum =0 ; - -pr_debug ("data_seq=%llu subflow_seq=%u data_len=%u ck=%u" , +pr_debug ("data_seq=%llu subflow_seq=%u data_len=%u" , mp_opt->data_seq, mp_opt->subflow_seq, - mp_opt->data_len, mp_opt->checksum); + mp_opt->data_len); } +break ;/* MPTCPOPT_ADD_ADDR
@@ -390,12 +395,8 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,if (!skb || (mpext && mpext->use_map)) {unsigned int map_size; -bool use_csum; map_size =TCPOLEN_MPTCP_DSS_BASE +TCPOLEN_MPTCP_DSS_MAP64 ; - use_csum =subflow_ctx (sk)->use_checksum; -if (use_csum) - map_size +=TCPOLEN_MPTCP_DSS_CHECKSUM ;if (map_size <= remaining) { remaining -= map_size;
@@ -404,10 +405,8 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, opts->ext_copy.data_seq = mpext->data_seq; opts->ext_copy.subflow_seq = mpext->subflow_seq; opts->ext_copy.data_len = mpext->data_len; - opts->ext_copy.checksum = mpext->checksum; opts->ext_copy.use_map =1 ; opts->ext_copy.dsn64 = mpext->dsn64; - opts->ext_copy.use_checksum = use_csum; } }else { opts->ext_copy.use_map =0 ;
@@ -573,10 +572,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, mpext->data_seq = mp_opt->data_seq; mpext->subflow_seq = mp_opt->subflow_seq; mpext->data_len = mp_opt->data_len; - mpext->checksum = mp_opt->checksum; mpext->use_map =1 ; mpext->dsn64 = mp_opt->dsn64; - mpext->use_checksum = mp_opt->use_checksum; }if (mp_opt->use_ack) {
@@ -676,12 +673,8 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -pr_debug ("Updating DSS length and flags for map" ); len +=TCPOLEN_MPTCP_DSS_MAP64 ; -if (mpext->use_checksum) - len +=TCPOLEN_MPTCP_DSS_CHECKSUM ; -/* Use only 64-bit mapping flags for now, add * support for optional 32-bit mappings later. */
@@ -690,10 +683,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) flags |=MPTCP_DSS_DATA_FIN ; } - *ptr++ =htonl ((TCPOPT_MPTCP <<24 ) | - (len <<16 ) | - (MPTCPOPT_DSS <<12 ) | - (flags)); + *ptr++ =mptcp_option (MPTCPOPT_DSS , len,0 , flags);if (mpext->use_ack) {put_unaligned_be64 (mpext->data_ack, ptr);
@@ -701,18 +691,11 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__sum16 checksum; - -pr_debug ("Writing map values" );put_unaligned_be64 (mpext->data_seq, ptr); ptr +=2 ; - *ptr++ =htonl (mpext->subflow_seq); - -if (mpext->use_checksum) - checksum = mpext->checksum; -else - checksum =TCPOPT_NOP <<8 |TCPOPT_NOP ; - *ptr =htonl (mpext->data_len <<16 | checksum); +put_unaligned_be32 (mpext->subflow_seq, ptr); + ptr +=1 ; +put_unaligned_be16 (mpext->data_len, ptr); } } }
net/mptcp/protocol.c +5 -8
@@ -156,13 +156,12 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mpext->data_seq = msk->write_seq; mpext->subflow_seq =subflow_ctx (ssk)->rel_write_seq; mpext->data_len = ret; - mpext->checksum =0xbeef ; mpext->use_map =1 ; mpext->dsn64 =1 ; -pr_debug ("data_seq=%llu subflow_seq=%u data_len=%u checksum=%u, dsn64=%d" , +pr_debug ("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d" , mpext->data_seq, mpext->subflow_seq, mpext->data_len, - mpext->checksum, mpext->dsn64); + mpext->dsn64); }/* TODO: else fallback; allocation can fail, but we can't easily retire * skbs from the write_queue, as we need to roll-back TCP status
@@ -337,9 +336,8 @@ static enum mapping_status mptcp_get_mapping(struct sock *ssk) goto del_out; } -pr_debug ("seq=%llu is64=%d ssn=%u data_len=%u ck=%u" , - mpext->data_seq, mpext->dsn64, mpext->subflow_seq, - mpext->data_len, mpext->checksum); +pr_debug ("seq=%llu is64=%d ssn=%u data_len=%u" , mpext->data_seq, + mpext->dsn64, mpext->subflow_seq, mpext->data_len);if (mpext->data_len ==0 ) {pr_err ("Infinite mapping not handled" );
@@ -912,8 +910,7 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk) msk->subflow = ssock; subflow =subflow_ctx (msk->subflow->sk); subflow->request_mptcp =1 ;/* @@ if MPTCP enabled */ - subflow->request_cksum =0 ;/* checksum not supported */ - subflow->request_version =0 ;/* only v0 supported */ + subflow->request_version =0 ;/* currently only v0 supported */ sock_hold (ssock->sk);
net/mptcp/protocol.h +1 -3
@@ -140,7 +140,7 @@ struct subflow_request_sock {struct tcp_request_sock sk; u8 mp_capable : 1, mp_join : 1, - checksum : 1, + unused : 1, backup : 1, version : 4;u8 local_id;
@@ -175,14 +175,12 @@ struct subflow_context {u16 map_data_len; u16 request_mptcp : 1, /* send MP_CAPABLE */ request_join : 1, /* send MP_JOIN */ - request_cksum : 1, request_bkup : 1, request_version : 4, mp_capable : 1, /* remote is MPTCP capable */ mp_join : 1, /* remote is JOINing */ fourth_ack : 1, /* send initial DSS */ conn_finished : 1, - use_checksum : 1, map_valid : 1, backup : 1;u32 remote_nonce;
net/mptcp/subflow.c +0 -5
@@ -117,9 +117,6 @@ static void subflow_v4_init_req(struct request_sock *req, subflow_req->version = listener->request_version; else subflow_req->version = rx_opt.mptcp.version; -if ((rx_opt.mptcp.flags &MPTCP_CAP_CHECKSUM_REQD ) || - listener->request_cksum) - subflow_req->checksum =1 ; subflow_req->remote_key = rx_opt.mptcp.sndr_key;pr_debug ("syn seq=%u" ,TCP_SKB_CB (skb)->seq); subflow_req->ssn_offset =TCP_SKB_CB (skb)->seq;
@@ -435,7 +432,6 @@ static int subflow_ulp_init(struct sock *sk) tp->is_mptcp =1 ; icsk->icsk_af_ops = &subflow_specific; ctx->tcp_sk_data_ready = sk->sk_data_ready; - ctx->use_checksum =0 ; sk->sk_data_ready = subflow_data_ready; out:return err;
@@ -470,7 +466,6 @@ static void subflow_ulp_clone(const struct request_sock *req, new_ctx->conn =NULL ; new_ctx->conn_finished =1 ; new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready; - new_ctx->use_checksum = old_ctx->use_checksum;if (subflow_req->mp_capable) { new_ctx->mp_capable =1 ;
Signature · 1 line
2.17.2
Paolo Abeni
Hi,
Quoted 13 lines · Peter Krystad
net/mptcp/options.c +8
-0@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, expected_opsize +=TCPOLEN_MPTCP_DSS_ACK64 ; else expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + } + +if (mp_opt->use_map) { +if (mp_opt->dsn64) + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP64 ; +else + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP32 ; + }
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 170
Quoted 10 lines
net/mptcp/options.c +8
-2-if (opsize < expected_opsize) -break ; +/* RFC 6824, Section 3.3: +* If a checksum is present, but its use had +* not been negotiated in the MP_CAPABLE handshake, +* the checksum field MUST be ignored. +*/ +if (opsize != expected_opsize && + opsize != expected_opsize +TCPOLEN_MPTCP_DSS_CHECKSUM ) +break ;
My understanding is that we should look for RFC 6824 bis compliance - is that correct?
If so, than we should reset the subflow connection if opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM, and just ignore other bad len. Is that correct? (looks a bit weird to me)
I'm unsure we can reset the stream from mptcp_parse_option() even providing it the relevant sock variable (and that would be a quite invasive change).
Perhaps we can mark the pkts/DSS/MPTCP ext as 'bad' using an additional flag and send the reset later? (even at rcvmsg time)
Quoted 9 lines
net/mptcp/options.c +0
-3@@ -701,18 +691,11 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__sum16 checksum; - -pr_debug ("Writing map values" );put_unaligned_be64 (mpext->data_seq, ptr); ptr +=2 ;
net/mptcp/options.c void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) · line 698
Quoted 10 lines
net/mptcp/options.c +3
-7- *ptr++ =htonl (mpext->subflow_seq); - -if (mpext->use_checksum) - checksum = mpext->checksum; -else - checksum =TCPOPT_NOP <<8 |TCPOPT_NOP ; - *ptr =htonl (mpext->data_len <<16 | checksum); +put_unaligned_be32 (mpext->subflow_seq, ptr); + ptr +=1 ; +put_unaligned_be16 (mpext->data_len, ptr);
I think we should still set 4 bytes here:
put_unaligned_be32(mpext->subflow_seq << 16 | TCPOPT_NOP << 8 |
TCPOPT_NOP, ptr);
or we can hit some 'uninit value used' error triggered by syzbot or the like.
Cheers,
Paolo
Peter Krystad
Quoted 16 lines · Paolo Abeni
Hi,
Quoted 13 lines · Peter Krystad
net/mptcp/options.c +8
-0@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, expected_opsize +=TCPOLEN_MPTCP_DSS_ACK64 ; else expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + } + +if (mp_opt->use_map) { +if (mp_opt->dsn64) + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP64 ; +else + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP32 ; + }
Quoted 13 lines
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 170
Quoted 10 lines
net/mptcp/options.c +8
-2-if (opsize < expected_opsize) -break ; +/* RFC 6824, Section 3.3: +* If a checksum is present, but its use had +* not been negotiated in the MP_CAPABLE handshake, +* the checksum field MUST be ignored. +*/ +if (opsize != expected_opsize && + opsize != expected_opsize +TCPOLEN_MPTCP_DSS_CHECKSUM ) +break ;My understanding is that we should look for RFC 6824 bis compliance - is that correct?
That's the feedback we got.
Quoted 4 lines
If so, than we should reset the subflow connection if opsize ==
expected_opsize+TCPOLEN_MPTCP_DSS_CHECKSUM, and just ignore other bad len. Is that correct? (looks a bit weird to me)
And that's my reading of the 6824bis too. But the code base is v0 right now, so I think this is OK going in like this, the purpose of this patch is just to make it clear we don't support checksum. Maybe add a comment here that it will need revision for v1? I think it will make sense to move to v1 in one (or more) coordinated patchsets instead of trickling support in over time.
Quoted 6 lines
I'm unsure we can reset the stream from
mptcp_parse_option()even providing it the relevant sock variable (and that would be a quite invasive change).Perhaps we can mark the pkts/DSS/MPTCP ext as 'bad' using an additional flag and send the reset later? (even at rcvmsg time)
It is going to have to be something like that, but out-of-scope for this patch.
Peter.
Quoted 32 lines
Quoted 9 lines
net/mptcp/options.c +0
-3@@ -701,18 +691,11 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__sum16 checksum; - -pr_debug ("Writing map values" );put_unaligned_be64 (mpext->data_seq, ptr); ptr +=2 ;net/mptcp/options.c void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) · line 698
Quoted 10 lines
net/mptcp/options.c +3
-7- *ptr++ =htonl (mpext->subflow_seq); - -if (mpext->use_checksum) - checksum = mpext->checksum; -else - checksum =TCPOPT_NOP <<8 |TCPOPT_NOP ; - *ptr =htonl (mpext->data_len <<16 | checksum); +put_unaligned_be32 (mpext->subflow_seq, ptr); + ptr +=1 ; +put_unaligned_be16 (mpext->data_len, ptr);I think we should still set 4 bytes here:
put_unaligned_be32(mpext->subflow_seq << 16 | TCPOPT_NOP << 8 |
TCPOPT_NOP, ptr);or we can hit some 'uninit value used' error triggered by syzbot or the like.
Cheers,
Paolo
Mat Martineau
Quoted 37 lines · Peter Krystad
Quoted 16 lines · Paolo Abeni
Hi,
Quoted 13 lines · Peter Krystad
net/mptcp/options.c +8
-0@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, expected_opsize +=TCPOLEN_MPTCP_DSS_ACK64 ; else expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + } + +if (mp_opt->use_map) { +if (mp_opt->dsn64) + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP64 ; +else + expected_opsize +=TCPOLEN_MPTCP_DSS_MAP32 ; + }Quoted 13 lines
net/mptcp/options.c void mptcp_parse_option(const unsigned char *ptr, int opsize, · line 170
Quoted 10 lines
net/mptcp/options.c +8
-2-if (opsize < expected_opsize) -break ; +/* RFC 6824, Section 3.3: +* If a checksum is present, but its use had +* not been negotiated in the MP_CAPABLE handshake, +* the checksum field MUST be ignored. +*/ +if (opsize != expected_opsize && + opsize != expected_opsize +TCPOLEN_MPTCP_DSS_CHECKSUM ) +break ;My understanding is that we should look for RFC 6824 bis compliance - is that correct?
That's the feedback we got.
Quoted 4 lines
If so, than we should reset the subflow connection if opsize ==
expected_opsize+TCPOLEN_MPTCP_DSS_CHECKSUM, and just ignore other bad len. Is that correct? (looks a bit weird to me)
Quoted 5 lines
And that's my reading of the 6824bis too. But the code base is v0 right now, so I think this is OK going in like this, the purpose of this patch is just to make it clear we don't support checksum. Maybe add a comment here that it will need revision for v1? I think it will make sense to move to v1 in one (or more) coordinated patchsets instead of trickling support in over time.
I agree that we should switch from v0 to v1 all at once - preferably when we have something to test against! I think we would benefit from interoperating with the v0.95 (protocol v0) kernel with the multiple-subflow transmission and reassembly changes and DATA_FIN before jumping in to v1 compliance.
Mat
Quoted 44 lines
Quoted 7 lines
I'm unsure we can reset the stream from
mptcp_parse_option()even providing it the relevant sock variable (and that would be a quite invasive change).Perhaps we can mark the pkts/DSS/MPTCP ext as 'bad' using an additional flag and send the reset later? (even at rcvmsg time)
It is going to have to be something like that, but out-of-scope for this patch.
Peter.
Quoted 30 lines
Quoted 9 lines
net/mptcp/options.c +0
-3@@ -701,18 +691,11 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__sum16 checksum; - -pr_debug ("Writing map values" );put_unaligned_be64 (mpext->data_seq, ptr); ptr +=2 ;net/mptcp/options.c void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) · line 698
Quoted 10 lines
net/mptcp/options.c +3
-7- *ptr++ =htonl (mpext->subflow_seq); - -if (mpext->use_checksum) - checksum = mpext->checksum; -else - checksum =TCPOPT_NOP <<8 |TCPOPT_NOP ; - *ptr =htonl (mpext->data_len <<16 | checksum); +put_unaligned_be32 (mpext->subflow_seq, ptr); + ptr +=1 ; +put_unaligned_be16 (mpext->data_len, ptr);I think we should still set 4 bytes here:
put_unaligned_be32(mpext->subflow_seq << 16 | TCPOPT_NOP << 8 |
TCPOPT_NOP, ptr);or we can hit some 'uninit value used' error triggered by syzbot or the like.
Cheers,
Quoted 8 lines
Quoted 2 lines
Paolo
_______________________________________________
mptcp mailing list
mptcp(a)lists.01.org
https://lists.01.org/mailman/listinfo/mptcp
--
Mat Martineau
Intel
Peter Krystad
Quoted 6 lines · Paolo Abeni
Hi,
Quoted 3 lines · Peter Krystad
net/mptcp/options.c +0
-0@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, expected_opsize +=TCPOLEN_MPTCP_DSS_ACK64 ;
...
Quoted 23 lines
Quoted 10 lines
net/mptcp/options.c +0
-3@@ -701,18 +691,11 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__sum16 checksum; - -pr_debug ("Writing map values" );put_unaligned_be64 (mpext->data_seq, ptr); ptr +=2 ;net/mptcp/options.c void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) · line 698
Quoted 10 lines
net/mptcp/options.c +3
-7- *ptr++ =htonl (mpext->subflow_seq); - -if (mpext->use_checksum) - checksum = mpext->checksum; -else - checksum =TCPOPT_NOP <<8 |TCPOPT_NOP ; - *ptr =htonl (mpext->data_len <<16 | checksum); +put_unaligned_be32 (mpext->subflow_seq, ptr); + ptr +=1 ; +put_unaligned_be16 (mpext->data_len, ptr);I think we should still set 4 bytes here:
Quoted 5 lines
put_unaligned_be32(mpext->subflow_seq << 16 | TCPOPT_NOP << 8 |
TCPOPT_NOP, ptr);or we can hit some 'uninit value used' error triggered by syzbot or the like.
Sorry Paolo I missed this comment before. I'll send a v2.
Peter.
Quoted 4 lines
Cheers,
Paolo