mptcp: validate the data checksum
authorPaolo Abeni <pabeni@redhat.com>
Thu, 17 Jun 2021 23:46:16 +0000 (16:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jun 2021 18:40:11 +0000 (11:40 -0700)
commitdd8bcd1768ff76bf2da1154897871adcc4ec078a
tree053ba3e1aa3f63d05f6bd1146d71b7f3f9afe5c9
parent390b95a5fb84e7999eedb021382c96d1500e01fc
mptcp: validate the data checksum

This patch added three new members named data_csum, csum_len and
map_csum in struct mptcp_subflow_context, implemented a new function
named mptcp_validate_data_checksum().

If the current mapping is valid and csum is enabled traverse the later
pending skbs and compute csum incrementally till the whole mapping has
been covered. If not enough data is available in the rx queue, return
MAPPING_EMPTY - that is, no data.

Next subflow_data_ready invocation will trigger again csum computation.

When the full DSS is available, validate the csum and return to the
caller an appropriate error code, to trigger subflow reset of fallback
as required by the RFC.

Additionally:
- if the csum prevence in the DSS don't match the negotiated value e.g.
  csum present, but not requested, return invalid mapping to trigger
  subflow reset.
- keep some csum state, to avoid re-compute the csum on the same data
  when multiple rx queue traversal are required.
- clean-up the uncompleted mapping from the receive queue on close, to
  allow proper subflow disposal

Co-developed-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.h
net/mptcp/subflow.c