Skip to content

Commit 017512a

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: more DATA FIN fixes
Currently data fin on data packet are not handled properly: the 'rcv_data_fin_seq' field is interpreted as the last sequence number carrying a valid data, but for data fin packet with valid maps we currently store map_seq + map_len, that is, the next value. The 'write_seq' fields carries instead the value subseguent to the last valid byte, so in mptcp_write_data_fin() we never detect correctly the last DSS map. Fixes: 7279da6 ("mptcp: Use MPTCP-level flag for sending DATA_FIN") Fixes: 1a49b2c ("mptcp: Handle incoming 32-bit DATA_FIN values") Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c88c5ed commit 017512a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

net/mptcp/options.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,10 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
451451
static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,
452452
struct sk_buff *skb, struct mptcp_ext *ext)
453453
{
454-
u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq);
454+
/* The write_seq value has already been incremented, so the actual
455+
* sequence number for the DATA_FIN is one less.
456+
*/
457+
u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1;
455458

456459
if (!ext->use_map || !skb->len) {
457460
/* RFC6824 requires a DSS mapping with specific values
@@ -460,10 +463,7 @@ static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,
460463
ext->data_fin = 1;
461464
ext->use_map = 1;
462465
ext->dsn64 = 1;
463-
/* The write_seq value has already been incremented, so
464-
* the actual sequence number for the DATA_FIN is one less.
465-
*/
466-
ext->data_seq = data_fin_tx_seq - 1;
466+
ext->data_seq = data_fin_tx_seq;
467467
ext->subflow_seq = 0;
468468
ext->data_len = 1;
469469
} else if (ext->data_seq + ext->data_len == data_fin_tx_seq) {

net/mptcp/subflow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
749749
return MAPPING_DATA_FIN;
750750
}
751751
} else {
752-
u64 data_fin_seq = mpext->data_seq + data_len;
752+
u64 data_fin_seq = mpext->data_seq + data_len - 1;
753753

754754
/* If mpext->data_seq is a 32-bit value, data_fin_seq
755755
* must also be limited to 32 bits.

0 commit comments

Comments
 (0)