Skip to contentSkip to conversation

mptcp: fix ioctl on fallback

PATCH In review Paolo Abeni 3 participants 5 messages Feb 18, 2022 – Feb 19, 2022

Subsystems (3)
lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

cover mptcp: fix ioctl on fallback

The first patch fixes the issue, hopefully closing:

https://github.com/multipath-tcp/mptcp_net-next/issues/260

the 2nd patch is self-test cleanup

Paolo Abeni (2):
mptcp: accurate SIOCOUTQ for fallback socket
selftests: mptcp: do complete cleanup at exit

 net/mptcp/protocol.c                               | 11 +++++++++++
 tools/testing/selftests/net/mptcp/mptcp_connect.sh |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/2 mptcp: accurate SIOCOUTQ for fallback socket

The MPTCP SIOCOUTQ implementation is not very accurate in case of fallback: it only measures the data in the MPTCP-level write queue, but it does not take in account the subflow write queue utilization. In case of fallback the first can be empty, while the latter is not.

The above produces sporadic self-tests issues and can foul legit user-space application.

Fix the issue additionally querying the subflow in case of fallback.

Fixes 644807e3e462 ("mptcp: add SIOCINQ, OUTQ and OUTQNSD ioctls")
---
 net/mptcp/protocol.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
net/mptcp/protocol.c +11 -0
index bf5af6bf8756..a033ffa49fd7 100644
@@ -3325,6 +3325,17 @@ static int mptcp_ioctl_outq(const struct mptcp_sock *msk, u64 v)
 		return 0;
 
 	delta = msk->write_seq - v;
+	if (__mptcp_check_fallback(msk) && msk->first) {
+		struct tcp_sock *tp = tcp_sk(msk->first);
+
+		/* the first subflow is disconnected after close - see
+		 * __mptcp_close_ssk(). tcp_disconnect() moves the write_seq
+		 * so ignore that status, too.
+		 */
+		if (!((1 << msk->first->sk_state) &
+		      (TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_CLOSE)))
+			delta += READ_ONCE(tp->write_seq) - tp->snd_una;
+	}
 	if (delta > INT_MAX)
 		delta = INT_MAX;
 
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/2 selftests: mptcp: do complete cleanup at exit

In reply to Paolo Abeni

After commit 05be5e273c84 ("selftests: mptcp: add disconnect tests") the mptcp selftests leave behind a couple of tmp files after each run. run_tests_disconnect() misnames a few fariables used to track them. Address the issue setting the appropriate global variables

Fixes 05be5e273c84 ("selftests: mptcp: add disconnect tests")
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +2 -2
index 5b7a40d73253..621af6895f4d 100755
@@ -782,8 +782,8 @@ run_tests_disconnect()
 	run_tests_lo "$ns1" "$ns1" dead:beef:1::1 1 "-I 3 -i $old_cin"
 
 	# restore previous status
-	cout=$old_cout
-	cout_disconnect="$cout".disconnect
+	sin=$old_sin
+	sin_disconnect="$cout".disconnect
 	cin=$old_cin
 	cin_disconnect="$cin".disconnect
 	connect_per_transfer=1
Signature · 1 line
2.34.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Paolo Abeni
Quoted 6 lines · Paolo Abeni

The first patch fixes the issue, hopefully closing:

https://github.com/multipath-tcp/mptcp_net-next/issues/260

the 2nd patch is self-test cleanup

Quoted 10 lines

Paolo Abeni (2):
mptcp: accurate SIOCOUTQ for fallback socket
selftests: mptcp: do complete cleanup at exit

net/mptcp/protocol.c | 11 +++++++++++
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ++--

2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1

Looks good for the export branch, thanks Paolo.

--
Mat Martineau
Intel

#4 lore raw
In reply to Paolo Abeni

Hi Paolo, Mat,

Quoted 9 lines · Paolo Abeni

The first patch fixes the issue, hopefully closing:

https://github.com/multipath-tcp/mptcp_net-next/issues/260

the 2nd patch is self-test cleanup

Paolo Abeni (2):
mptcp: accurate SIOCOUTQ for fallback socket
selftests: mptcp: do complete cleanup at exit

Thank you for the patches and the reviews!

Now in our tree (fixes for -net) with Mat's RvB tag and the Closes tag on the first one.

- 9b0586e72457: mptcp: accurate SIOCOUTQ for fallback socket
- 155ad8f4c292: selftests: mptcp: do complete cleanup at exit
- Results: 785fa0377037..aa13e81cbcb8

Builds and tests are now in progress:

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

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net