All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback
@ 2022-02-18 15:17 Paolo Abeni
  2022-02-18 15:17 ` [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket Paolo Abeni
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paolo Abeni @ 2022-02-18 15:17 UTC (permalink / raw)
  To: mptcp

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket
  2022-02-18 15:17 [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Paolo Abeni
@ 2022-02-18 15:17 ` Paolo Abeni
  2022-02-18 15:17 ` [PATCH mptcp-net 2/2] selftests: mptcp: do complete cleanup at exit Paolo Abeni
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2022-02-18 15:17 UTC (permalink / raw)
  To: mptcp

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")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index bf5af6bf8756..a033ffa49fd7 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -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;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH mptcp-net 2/2] selftests: mptcp: do complete cleanup at exit
  2022-02-18 15:17 [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Paolo Abeni
  2022-02-18 15:17 ` [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket Paolo Abeni
@ 2022-02-18 15:17 ` Paolo Abeni
  2022-02-18 21:11 ` [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Mat Martineau
  2022-02-19 17:22 ` Matthieu Baerts
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2022-02-18 15:17 UTC (permalink / raw)
  To: mptcp

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")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 5b7a40d73253..621af6895f4d 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback
  2022-02-18 15:17 [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Paolo Abeni
  2022-02-18 15:17 ` [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket Paolo Abeni
  2022-02-18 15:17 ` [PATCH mptcp-net 2/2] selftests: mptcp: do complete cleanup at exit Paolo Abeni
@ 2022-02-18 21:11 ` Mat Martineau
  2022-02-19 17:22 ` Matthieu Baerts
  3 siblings, 0 replies; 5+ messages in thread
From: Mat Martineau @ 2022-02-18 21:11 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: mptcp

On Fri, 18 Feb 2022, Paolo Abeni wrote:

> 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(-)
>
> -- 
> 2.34.1

Looks good for the export branch, thanks Paolo.

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


--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback
  2022-02-18 15:17 [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Paolo Abeni
                   ` (2 preceding siblings ...)
  2022-02-18 21:11 ` [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Mat Martineau
@ 2022-02-19 17:22 ` Matthieu Baerts
  3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts @ 2022-02-19 17:22 UTC (permalink / raw)
  To: Paolo Abeni, mptcp

Hi Paolo, Mat,

On 18/02/2022 16:17, Paolo Abeni wrote:
> 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
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-19 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 15:17 [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Paolo Abeni
2022-02-18 15:17 ` [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket Paolo Abeni
2022-02-18 15:17 ` [PATCH mptcp-net 2/2] selftests: mptcp: do complete cleanup at exit Paolo Abeni
2022-02-18 21:11 ` [PATCH mptcp-net 0/2] mptcp: fix ioctl on fallback Mat Martineau
2022-02-19 17:22 ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.