mbox series

[mptcp-next,v3,0/5] mptcp: add SOL_MPTCP getsockopt support

Message ID 20210818102756.30734-1-fw@strlen.de (mailing list archive)
Headers show
Series mptcp: add SOL_MPTCP getsockopt support | expand

Message

Florian Westphal Aug. 18, 2021, 10:27 a.m. UTC
Changes in v3:
- address comments from Mat.
  This only affects selftest program (init 'fd' to -1).
  Other than that, the only changes are in commit messages or
  re-format of code (reverse xmas).

Changes in v2:
- move #define to start of file (Mat)
- refer to '"multipath-tcp.org"', not mptcp.org (Mat)
- use __kernel_sa_family_t in uapi header (test robot)
- add test cases with invalid inputs (Paolo)
- avoid duplicate mptcp_sockopt.h in Makefile (Paolo)
- remove _u_optlen (Paolo)

original cover letter:

This adds the MPTCP_INFO, MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS
mptcp getsockopt optnames.

MPTCP_INFO exposes the mptcp_info struct as an alternative to the
existing netlink diag interface.

MPTCP_TCPINFO exposes the tcp_info struct.
Unlike SOL_TCP/TCP_INFO, this returns one struct for each active
subflow.

MPTCP_SUBFLOW_ADDRS allows userspace to discover the ip addresses/ports
used by the local and remote endpoints, one for each active tcp subflow.

MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS share the same meta-header that
needs to be pre-filled by userspace with the size of the data structures
it expects.  This is done to allow extension of the involved structs
later on, without breaking backwards compatibility.

The meta-structure can also be used to discover the required space
to obtain all information, as kernel will fill in the number of
active subflows even if there is not enough room for the requested info
itself.

More information is available in the individual patches.
Last patch adds test cases for the three optnames.

Florian Westphal (5):
  mptcp: add new mptcp_fill_diag helper
  mptcp: add MPTCP_INFO getsockopt
  mptcp: add MPTCP_TCPINFO getsockopt support
  mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support
  selftests: mptcp: add mptcp getsockopt test cases

 include/linux/socket.h                        |   1 +
 include/net/mptcp.h                           |   4 +
 include/uapi/linux/mptcp.h                    |  29 +
 net/mptcp/mptcp_diag.c                        |  26 +-
 net/mptcp/sockopt.c                           | 276 ++++++++
 tools/testing/selftests/net/mptcp/Makefile    |   2 +-
 .../selftests/net/mptcp/mptcp_sockopt.c       | 644 ++++++++++++++++++
 .../selftests/net/mptcp/mptcp_sockopt.sh      |  31 +-
 8 files changed, 985 insertions(+), 28 deletions(-)
 create mode 100644 tools/testing/selftests/net/mptcp/mptcp_sockopt.c

Comments

Mat Martineau Aug. 18, 2021, 4:59 p.m. UTC | #1
On Wed, 18 Aug 2021, Florian Westphal wrote:

> Changes in v3:
> - address comments from Mat.
>  This only affects selftest program (init 'fd' to -1).
>  Other than that, the only changes are in commit messages or
>  re-format of code (reverse xmas).
>

Thanks for the final adjustments - looks ready for the export branch now.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>



> Changes in v2:
> - move #define to start of file (Mat)
> - refer to '"multipath-tcp.org"', not mptcp.org (Mat)
> - use __kernel_sa_family_t in uapi header (test robot)
> - add test cases with invalid inputs (Paolo)
> - avoid duplicate mptcp_sockopt.h in Makefile (Paolo)
> - remove _u_optlen (Paolo)
>
> original cover letter:
>
> This adds the MPTCP_INFO, MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS
> mptcp getsockopt optnames.
>
> MPTCP_INFO exposes the mptcp_info struct as an alternative to the
> existing netlink diag interface.
>
> MPTCP_TCPINFO exposes the tcp_info struct.
> Unlike SOL_TCP/TCP_INFO, this returns one struct for each active
> subflow.
>
> MPTCP_SUBFLOW_ADDRS allows userspace to discover the ip addresses/ports
> used by the local and remote endpoints, one for each active tcp subflow.
>
> MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS share the same meta-header that
> needs to be pre-filled by userspace with the size of the data structures
> it expects.  This is done to allow extension of the involved structs
> later on, without breaking backwards compatibility.
>
> The meta-structure can also be used to discover the required space
> to obtain all information, as kernel will fill in the number of
> active subflows even if there is not enough room for the requested info
> itself.
>
> More information is available in the individual patches.
> Last patch adds test cases for the three optnames.
>
> Florian Westphal (5):
>  mptcp: add new mptcp_fill_diag helper
>  mptcp: add MPTCP_INFO getsockopt
>  mptcp: add MPTCP_TCPINFO getsockopt support
>  mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support
>  selftests: mptcp: add mptcp getsockopt test cases
>
> include/linux/socket.h                        |   1 +
> include/net/mptcp.h                           |   4 +
> include/uapi/linux/mptcp.h                    |  29 +
> net/mptcp/mptcp_diag.c                        |  26 +-
> net/mptcp/sockopt.c                           | 276 ++++++++
> tools/testing/selftests/net/mptcp/Makefile    |   2 +-
> .../selftests/net/mptcp/mptcp_sockopt.c       | 644 ++++++++++++++++++
> .../selftests/net/mptcp/mptcp_sockopt.sh      |  31 +-
> 8 files changed, 985 insertions(+), 28 deletions(-)
> create mode 100644 tools/testing/selftests/net/mptcp/mptcp_sockopt.c
>
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel
Matthieu Baerts Aug. 18, 2021, 7:17 p.m. UTC | #2
Hi Florian, Mat,

On 18/08/2021 12:27, Florian Westphal wrote:

(...)

> Florian Westphal (5):
>   mptcp: add new mptcp_fill_diag helper
>   mptcp: add MPTCP_INFO getsockopt
>   mptcp: add MPTCP_TCPINFO getsockopt support
>   mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support
>   selftests: mptcp: add mptcp getsockopt test cases

Thank you for the patches and the reviews!

Now in our tree with Mat's RvB tags:

- d6eeba5de1d0: mptcp: add new mptcp_fill_diag helper
- d21d692880d0: mptcp: add MPTCP_INFO getsockopt
- b3b5ec766eea: mptcp: add MPTCP_TCPINFO getsockopt support
- efd9c3320c75: mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support
- f8d31bf4060d: selftests: mptcp: add mptcp getsockopt test cases
- Results: e2ce4b28903e..ab36a40efeaf

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210818T191724
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210818T191724

Cheers,
Matt