mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 00:40:03 +00:00
mptcp: Only send DATA_FIN with final mapping
When a DATA_FIN is sent in a MPTCP DSS option that contains a data mapping, the DATA_FIN consumes one byte of space in the mapping. In this case, the DATA_FIN should only be included in the DSS option if its sequence number aligns with the end of the mapped data. Otherwise the subflow can send an incorrect implicit sequence number for the DATA_FIN, and the DATA_ACK for that sequence number would not close the MPTCP-level connection correctly. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
76c42a29c0
commit
6d37a0b857
1 changed files with 6 additions and 5 deletions
|
@ -304,21 +304,22 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
|
||||||
static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,
|
static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,
|
||||||
struct mptcp_ext *ext)
|
struct mptcp_ext *ext)
|
||||||
{
|
{
|
||||||
ext->data_fin = 1;
|
|
||||||
|
|
||||||
if (!ext->use_map) {
|
if (!ext->use_map) {
|
||||||
/* RFC6824 requires a DSS mapping with specific values
|
/* RFC6824 requires a DSS mapping with specific values
|
||||||
* if DATA_FIN is set but no data payload is mapped
|
* if DATA_FIN is set but no data payload is mapped
|
||||||
*/
|
*/
|
||||||
|
ext->data_fin = 1;
|
||||||
ext->use_map = 1;
|
ext->use_map = 1;
|
||||||
ext->dsn64 = 1;
|
ext->dsn64 = 1;
|
||||||
ext->data_seq = subflow->data_fin_tx_seq;
|
ext->data_seq = subflow->data_fin_tx_seq;
|
||||||
ext->subflow_seq = 0;
|
ext->subflow_seq = 0;
|
||||||
ext->data_len = 1;
|
ext->data_len = 1;
|
||||||
} else {
|
} else if (ext->data_seq + ext->data_len == subflow->data_fin_tx_seq) {
|
||||||
/* If there's an existing DSS mapping, DATA_FIN consumes
|
/* If there's an existing DSS mapping and it is the
|
||||||
* 1 additional byte of mapping space.
|
* final mapping, DATA_FIN consumes 1 additional byte of
|
||||||
|
* mapping space.
|
||||||
*/
|
*/
|
||||||
|
ext->data_fin = 1;
|
||||||
ext->data_len++;
|
ext->data_len++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue