diff options
| author | Mat Martineau <[email protected]> | 2020-07-28 22:12:03 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2020-07-29 00:02:42 +0000 |
| commit | 3721b9b64676b3377a966f3d96acafd70bb32dd9 (patch) | |
| tree | 381876e12b5314fc7a6ec64e8deff9a3ba89fbce /net/mptcp/options.c | |
| parent | mptcp: Use MPTCP-level flag for sending DATA_FIN (diff) | |
| download | kernel-3721b9b64676b3377a966f3d96acafd70bb32dd9.tar.gz kernel-3721b9b64676b3377a966f3d96acafd70bb32dd9.zip | |
mptcp: Track received DATA_FIN sequence number and add related helpers
Incoming DATA_FIN headers need to propagate the presence of the DATA_FIN
bit and the associated sequence number to the MPTCP layer, even when
arriving on a bare ACK that does not get added to the receive queue. Add
structure members to store the DATA_FIN information and helpers to set
and check those values.
Signed-off-by: Mat Martineau <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/mptcp/options.c')
| -rw-r--r-- | net/mptcp/options.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/mptcp/options.c b/net/mptcp/options.c index f157cb7e14c0..38583d1b9b5f 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -782,6 +782,22 @@ static void update_una(struct mptcp_sock *msk, } } +bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq) +{ + /* Skip if DATA_FIN was already received. + * If updating simultaneously with the recvmsg loop, values + * should match. If they mismatch, the peer is misbehaving and + * we will prefer the most recent information. + */ + if (READ_ONCE(msk->rcv_data_fin) || !READ_ONCE(msk->first)) + return false; + + WRITE_ONCE(msk->rcv_data_fin_seq, data_fin_seq); + WRITE_ONCE(msk->rcv_data_fin, 1); + + return true; +} + static bool add_addr_hmac_valid(struct mptcp_sock *msk, struct mptcp_options_received *mp_opt) { |
