Skip to content

Commit 390b95a

Browse files
geliangtangdavem330
authored andcommitted
mptcp: receive checksum for DSS
In mptcp_parse_option, adjust the expected_opsize, and always parse the data checksum value from the receiving DSS regardless of csum presence. Then save it in mp_opt->csum. Co-developed-by: Paolo Abeni <[email protected]> Signed-off-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 208e8f6 commit 390b95a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

net/mptcp/options.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ static void mptcp_parse_option(const struct sk_buff *skb,
182182
expected_opsize += TCPOLEN_MPTCP_DSS_MAP32;
183183
}
184184

185-
/* RFC 6824, Section 3.3:
186-
* If a checksum is present, but its use had
187-
* not been negotiated in the MP_CAPABLE handshake,
188-
* the checksum field MUST be ignored.
185+
/* Always parse any csum presence combination, we will enforce
186+
* RFC 8684 Section 3.3.0 checks later in subflow_data_ready
189187
*/
190188
if (opsize != expected_opsize &&
191189
opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM)
@@ -220,9 +218,15 @@ static void mptcp_parse_option(const struct sk_buff *skb,
220218
mp_opt->data_len = get_unaligned_be16(ptr);
221219
ptr += 2;
222220

223-
pr_debug("data_seq=%llu subflow_seq=%u data_len=%u",
221+
if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) {
222+
mp_opt->csum_reqd = 1;
223+
mp_opt->csum = (__force __sum16)get_unaligned_be16(ptr);
224+
ptr += 2;
225+
}
226+
227+
pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u",
224228
mp_opt->data_seq, mp_opt->subflow_seq,
225-
mp_opt->data_len);
229+
mp_opt->data_len, mp_opt->csum_reqd, mp_opt->csum);
226230
}
227231

228232
break;

0 commit comments

Comments
 (0)