@@ -519,6 +519,9 @@ static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,
*/
ext->data_fin = 1;
ext->data_len++;
+
+ /* the pseudo header has changed, update the csum accordingly */
+ csum_replace2(&ext->csum, ext->data_len - 1, ext->data_len);
}
}
@@ -1271,6 +1271,9 @@ static bool mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk)
return __mptcp_alloc_tx_skb(sk, ssk, sk->sk_allocation);
}
+/* note: this always recompute the csum on the whole skb, even
+ * if we just appended a single frag. More status info needed
+ */
static __sum16 mptcp_generate_data_checksum(struct sk_buff *skb)
{
struct csum_pseudo_header header;
@@ -1384,8 +1387,10 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
if (zero_window_probe) {
mptcp_subflow_ctx(ssk)->rel_write_seq += ret;
mpext->frozen = 1;
- ret = 0;
+ if (READ_ONCE(msk->csum_enabled))
+ mpext->csum = mptcp_generate_data_checksum(tail);
tcp_push_pending_frames(ssk);
+ return 0;
}
out:
if (READ_ONCE(msk->csum_enabled))
We must generate the csum for zero window probe, too. Additionally we must update the checksum when setting the data_fin on a data packet. Note that in a later patch we will skip unneeded csum related operation. Changes not included here to keep the delta small. Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- net/mptcp/options.c | 3 +++ net/mptcp/protocol.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)