mptcp: Remove all traces of checksum support
Subsystems (2)
Peter Krystad
PATCH v2 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 | 70 +++++++++++++++++--------------------------- net/mptcp/pm.c | 1 - net/mptcp/protocol.c | 13 ++++---- net/mptcp/protocol.h | 4 +-- net/mptcp/subflow.c | 5 ---- 5 files changed, 33 insertions(+), 60 deletions(-)
net/mptcp/options.c +27 -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 ;
@@ -614,10 +613,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; } mpext->data_fin = mp_opt->data_fin;
@@ -711,12 +708,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. */
@@ -725,10 +718,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);
@@ -736,18 +726,12 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) }if (mpext->use_map) { -__u16 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 = (u16 __force )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_be32 (mpext->data_len <<16 | +TCPOPT_NOP <<8 |TCPOPT_NOP , ptr); } } }
net/mptcp/pm.c +0 -1
@@ -74,7 +74,6 @@ int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,if (family ==AF_INET ) local.sin_addr.s_addr = addr->s_addr;else - local.sin_addr.s_addr =INADDR_ANY ; local.sin_addr.s_addr =htonl (INADDR_ANY ); remote.sin_family = msk->pm.remote_family;
net/mptcp/protocol.c +5 -8
@@ -305,13 +305,12 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mpext->data_seq = *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
@@ -482,9 +481,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" );
@@ -1225,8 +1223,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
@@ -173,7 +173,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;
@@ -208,14 +208,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;
@@ -434,7 +431,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;
@@ -472,7 +468,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
Matthieu Baerts
Hi Paolo, Mat,
Quoted 5 lines · Peter Krystad
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.
Is this new version OK for you? :)
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
Paolo Abeni
Hi,
net/mptcp/protocol.h struct subflow_request_sock { · line 179
Quoted 13 lines · Peter Krystad
net/mptcp/protocol.h +1
-1@@ -173,7 +173,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;
Sorry I did not notice this beforehand. It looks a little strange to me creating a new struct with some 'unused' field. But I think is not
blocking: we can merge the patch as-is and ev. drop the field later - if there is agreement on that.
Cheers,
Paolo
Matthieu Baerts
Hi Paolo, Peter,
Quoted 13 lines · Paolo Abeni
Hi,
Quoted 10 lines · Peter Krystad
net/mptcp/protocol.h +1
-1@@ -173,7 +173,7 @@ struct subflow_request_sock {struct tcp_request_sock sk; u8 mp_capable : 1, mp_join : 1, - checksum : 1, + unused : 1,
Quoted 8 lines
net/mptcp/protocol.h struct subflow_request_sock { · line 179
Quoted 3 lines
net/mptcp/protocol.h +0
-0backup :1 , version : 4;u8 local_id;Sorry I did not notice this beforehand. It looks a little strange to me creating a new struct with some 'unused' field. But I think is not
blocking: we can merge the patch as-is and ev. drop the field later - if there is agreement on that.
I agree that it is certainly better to remove it in this context.
On my side, I was looking at applying this patch. And after having split it in 5 smaller patches and starting applying half of them, I don't know if it is a good idea to fully drop the checksum (partial) support.
The main part of this patch is removing the parsing of the checksum option. But in the commits where this is introduced, we also parse other possible options we could have and we act differently if one option is not supported. And in these commits, it makes sense to do that.
We could see that as "we are parsing stuff we don't need". But we are already doing that for the "backup" bit for example. Or for the "MP_JOIN" while we don't support it when subflow_request_sock structure is introduced, etc.
In other words, do we really need to remove this code linked to the checksum? If we plan never to support it, it makes sense. But I guess in the near future, we will want to support it, no?
So should I continue applying this patch? :)
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 25 lines · Matthieu Baerts
Hi Paolo, Peter,
Quoted 13 lines · Paolo Abeni
Hi,
Quoted 10 lines · Peter Krystad
net/mptcp/protocol.h +1
-1@@ -173,7 +173,7 @@ struct subflow_request_sock {struct tcp_request_sock sk; u8 mp_capable : 1, mp_join : 1, - checksum : 1, + unused : 1,Quoted 8 lines
net/mptcp/protocol.h struct subflow_request_sock { · line 179
Quoted 3 lines
net/mptcp/protocol.h +0
-0backup :1 , version : 4;u8 local_id;Sorry I did not notice this beforehand. It looks a little strange to me creating a new struct with some 'unused' field. But I think is not
blocking: we can merge the patch as-is and ev. drop the field later - if there is agreement on that.
Quoted 1 line
I agree that it is certainly better to remove it in this context.
I hope you don't mind if I remove this "unused" field when applying your patch. I had to apply this bit manually anyway and I guess if we need an "unused" field, it would be better at the end.
I can of course still change that again later if needed!
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, Paolo, Mat,
Quoted 7 lines · Peter Krystad
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.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>
Thank you for this patch and the reviews!
- a03d15e6a899: "squashed" in "mptcp: Associate MPTCP context with TCP socket"
- 5120702d34e9: conflict in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- fa25b3cfa037: build-fix in "mptcp: Create SUBFLOW socket for incoming connections"
- 7704ceb50e99: "squashed" in "mptcp: Create SUBFLOW socket for incoming connections" (note: I removed the "unused" field)
- 4f11988a5b9e: "squashed" in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- 5b8a09821448: conflict in t/mptcp-Implement-MPTCP-receive-path
- 4e656f41fa2e: "squashed" (part 2) in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- c1090854bf0c: conflict in t/mptcp-Implement-MPTCP-receive-path
- d50aa0ccca60: "squashed" in "mptcp: Implement MPTCP receive path"
- 8dc529a9be69: conflict in t/mptcp-allow-collapsing-consecutive-sendpages-on-the-same-substream
- c94ba96b727c: "squashed" in "mptcp: Add ADD_ADDR handling"
- 5261fb90316d: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-request
- ca58392a1268: conflict in t/mptcp-harmonize-locking-on-all-socket-operations
- 868fc953e348: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 3d566a4b1ebc..6e3f43237e22: result
Tests are still OK!
Note: I still see some refs to "checksum" fields in include/net/mptcp.h and include/linux/tcp.h. I will do a follow-up patch for that :)
Also, I have one comment below:
Quoted 13 lines
--- net/mptcp/options.c | 70 +++++++++++++++++--------------------------- net/mptcp/pm.c | 1 - net/mptcp/protocol.c | 13 ++++---- net/mptcp/protocol.h | 4 +-- net/mptcp/subflow.c | 5 ---- 5 files changed, 33 insertions(+), 60 deletions(-)net/mptcp/pm.c +0
-0
net/mptcp/pm.c int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family, · line 79
Quoted 7 lines
net/mptcp/pm.c +0
-1@@ -74,7 +74,6 @@ int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,if (family ==AF_INET ) local.sin_addr.s_addr = addr->s_addr;else - local.sin_addr.s_addr =INADDR_ANY ; local.sin_addr.s_addr =htonl (INADDR_ANY ); remote.sin_family = msk->pm.remote_family;
I guess this part was not supposed to be here, right?
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
Peter Krystad
Quoted 64 lines · Matthieu Baerts
Hi Peter, Paolo, Mat,
Quoted 7 lines · Peter Krystad
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.
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>Thank you for this patch and the reviews!
-
a03d15e6a899: "squashed" in "mptcp: Associate MPTCP context with TCP socket"
-5120702d34e9: conflict in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
-fa25b3cfa037: build-fix in "mptcp: Create SUBFLOW socket for incoming connections"
-7704ceb50e99: "squashed" in "mptcp: Create SUBFLOW socket for incoming connections" (note: I removed the "unused" field)
-4f11988a5b9e: "squashed" in "mptcp: Write MPTCP DSS headers to outgoing data packets"
-5b8a09821448: conflict in t/mptcp-Implement-MPTCP-receive-path
-4e656f41fa2e: "squashed" (part 2) in "mptcp: Write MPTCP DSS headers to outgoing data packets"
-c1090854bf0c: conflict in t/mptcp-Implement-MPTCP-receive-path
-d50aa0ccca60: "squashed" in "mptcp: Implement MPTCP receive path"
-8dc529a9be69: conflict in t/mptcp-allow-collapsing-consecutive-sendpages-on-the-same-substream
-c94ba96b727c: "squashed" in "mptcp: AddADD_ADDRhandling"
-5261fb90316d: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-request
-ca58392a1268: conflict in t/mptcp-harmonize-locking-on-all-socket-operations
-868fc953e348: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
-3d566a4b1ebc..6e3f43237e22: resultTests are still OK!
Note: I still see some refs to "checksum" fields in
include/net/mptcp.handinclude/linux/tcp.h. I will do a follow-up patch for that :)Also, I have one comment below:
Quoted 19 lines
--- net/mptcp/options.c | 70 +++++++++++++++++--------------------------- net/mptcp/pm.c | 1 - net/mptcp/protocol.c | 13 ++++---- net/mptcp/protocol.h | 4 +-- net/mptcp/subflow.c | 5 ---- 5 files changed, 33 insertions(+), 60 deletions(-)net/mptcp/pm.c +0
-1@@ -74,7 +74,6 @@ int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,if (family ==AF_INET ) local.sin_addr.s_addr = addr->s_addr;else - local.sin_addr.s_addr =INADDR_ANY ; local.sin_addr.s_addr =htonl (INADDR_ANY );
Quoted 3 lines
net/mptcp/pm.c int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family, · line 79
Quoted 1 line
net/mptcp/pm.c +0
-0remote.sin_family = msk->pm.remote_family;I guess this part was not supposed to be here, right?
Right.
Peter.
Quoted 3 lines
Cheers,
Matt
Peter Krystad
Quoted 28 lines · Matthieu Baerts
Hi Peter,
Quoted 25 lines · Matthieu Baerts
Hi Paolo, Peter,
Quoted 21 lines · Paolo Abeni
Hi,
net/mptcp/protocol.h struct subflow_request_sock { · line 179
Quoted 13 lines · Peter Krystad
net/mptcp/protocol.h +1
-1@@ -173,7 +173,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;Sorry I did not notice this beforehand. It looks a little strange to me creating a new struct with some 'unused' field. But I think is not
blocking: we can merge the patch as-is and ev. drop the field later - if there is agreement on that.
Quoted 5 lines
Quoted 1 line
I agree that it is certainly better to remove it in this context.
I hope you don't mind if I remove this "unused" field when applying your patch. I had to apply this bit manually anyway and I guess if we need an "unused" field, it would be better at the end.
No problem.
Peter.
Quoted 4 lines
I can of course still change that again later if needed!
Cheers,
Matt