selftests: mptcp: add mptcp getsockopt test cases
authorFlorian Westphal <fw@strlen.de>
Fri, 17 Sep 2021 23:33:22 +0000 (16:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 18 Sep 2021 13:20:01 +0000 (14:20 +0100)
commitce9979129a0ba700112151a83a6d4cf09c7a1158
tree4252af1ca2a9aefc97ba62cea0f9d78932580f08
parentc11c5906bc0aba62a78da69035f6b30c6da6d13b
selftests: mptcp: add mptcp getsockopt test cases

Add a test program that retrieves the three info types:
1. mptcp meta information
2. tcp info for subflow
3. subflow endpoint addresses

For all three rudimentary checks are added.

1. Meta information checks that the logical mptcp
   sequence numbers advance as expected, based on the bytes read
   (init seq + bytes_received/sent) and the connection state
   (after close, we should exect 1 extra byte due to FIN).

2. TCP info checks the number of bytes sent/received vs.
   sums of read/write syscall return values.

3. Subflow endpoint addresses are checked vs. getsockname/getpeername
   result.

Tests for forward compatibility (0-initialisation of output-only
fields in mptcp_subflow_data structure) are added as well.

Co-developed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/mptcp/.gitignore
tools/testing/selftests/net/mptcp/Makefile
tools/testing/selftests/net/mptcp/mptcp_sockopt.c [new file with mode: 0644]
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh