From nobody Sat May 4 05:14:16 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp1560178jad; Fri, 18 Feb 2022 07:17:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3SH5QIdbmENCKuxbGyMNl2/517fjelOAWgbpYJuQJuE1gzjUdKgZgqB4ZAJL6aN8oqefF X-Received: by 2002:a65:4c4c:0:b0:35e:3c81:5b7f with SMTP id l12-20020a654c4c000000b0035e3c815b7fmr6909577pgr.162.1645197466068; Fri, 18 Feb 2022 07:17:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645197466; cv=none; d=google.com; s=arc-20160816; b=m08oFZ8xRXYOKclqBOGAibiAtkwwYq3tM9UDnTDSO8fL+saXb9oapwGaVp2P447I5p yomOm7Dwaw5PC1nHfV5jWt0i+TBza+1N6BKzxxIGjlkTMewHksU4YLb0uJ3vXJNft1Wn D7LXB2I1AKuAjb/WJfsOcxI4EOYoHaA20JKOVCNXt6hKm1ihf8KTPhInEzxmdKLZ4VOV UlvoQag06+yICeodcvnjPNzmPbniUqE1Gorzcn3kIA0+njaT13AxHmujzoYjaVEsl5wj bfiaoI4v24oR+znJvpRU5mGJf+AUZ7vtMJvgqAWTDwv9oy3yap2Vnz354HBF0h4uGgy7 Tjqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=gGABeR76OT7boktJeZcpdDVx6P1l3sl/4UkqnNBVzUg=; b=jOd7FETzeuciauVBuAj62ebWjDFUQCsdWeE0Ea4J0dybgZ8dllfil1enCJLzW/8mrI M1COmuAAljBqR62qUQZgfLsfKbF3sovqP608tBppr8xvXviLaCQXm8t+wNPNOYt31jFp 2kri2HsepIxcbRkYHgZa5m96ZItIVHxOAgsc025KsesMAxpJ8Dko78H+fSZMsw9q0Iji 1OVItTp7HOS/Oa0ILxZyn5ytDebjUASy01lYwvorHG6NdwC1mxym/if4W6vJe4ztnZzz I/b/AEhMHxf+WSNft48X2xGLim+kZ8/F8z6ywPhpR2dga21SDelrvt6UgawC+88xnXWp u0IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WeRxC2ci; spf=pass (google.com: domain of mptcp+bounces-3851-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3851-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id d132si11141050pgc.614.2022.02.18.07.17.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Feb 2022 07:17:46 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3851-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WeRxC2ci; spf=pass (google.com: domain of mptcp+bounces-3851-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3851-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 88EFE1C0EE9 for ; Fri, 18 Feb 2022 15:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F77E4A9B; Fri, 18 Feb 2022 15:17:38 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C4454A97 for ; Fri, 18 Feb 2022 15:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645197454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGABeR76OT7boktJeZcpdDVx6P1l3sl/4UkqnNBVzUg=; b=WeRxC2ciD74ceBISIrjtfBxuFyHeS4yCJ+5/N1H63LiPcXXdkKpEbUGhN1xmELxwZIEFHw oej5/2Fo9fNjszZxfCKQavaLXROOhXlePtzwTIvNBFyVG/E2VLvcdvf/6Y6xRFNPQh0gah t3Z6Z3rkUTzymPJ88BMSxWY208iagCE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-281-cJ8IPFskM-qqBE4hqvGEOA-1; Fri, 18 Feb 2022 10:17:32 -0500 X-MC-Unique: cJ8IPFskM-qqBE4hqvGEOA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1BC11091DA0 for ; Fri, 18 Feb 2022 15:17:31 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1723F7CAD5 for ; Fri, 18 Feb 2022 15:17:30 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net 1/2] mptcp: accurate SIOCOUTQ for fallback socket Date: Fri, 18 Feb 2022 16:17:20 +0100 Message-Id: <925c8780acf59dbcf647eeec18e5884e4cfc119b.1645196974.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Mat Martineau --- 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; =20 delta =3D msk->write_seq - v; + if (__mptcp_check_fallback(msk) && msk->first) { + struct tcp_sock *tp =3D 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 +=3D READ_ONCE(tp->write_seq) - tp->snd_una; + } if (delta > INT_MAX) delta =3D INT_MAX; =20 --=20 2.34.1 From nobody Sat May 4 05:14:16 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp1560055jad; Fri, 18 Feb 2022 07:17:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoWPUe3NBhDDOJbixFn1Z6l24AiONwz5MOdTn/5RB3xCpkfh/zV3KurGgJcsgBefILJPbh X-Received: by 2002:a63:1848:0:b0:373:41d9:77a2 with SMTP id 8-20020a631848000000b0037341d977a2mr6726765pgy.84.1645197459811; Fri, 18 Feb 2022 07:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645197459; cv=none; d=google.com; s=arc-20160816; b=a1YB2+hQNNaZ28J2WsPKBr6iFEyXMd6Tnr/c99T4jqLkSJ9XeHBMAIF7oc8zGfCTmq N/+MiytfecnB3E4XzBXHgSxT5NjowD4eiQUKwJZhzIQRp9UG27uOIevLy26NVy3k3q18 WngRVHg1rysdgzCR37KdFHLt++UFScZAVnE5rctWxCPkOCfeanTglDCPgUUasCYe6h4o GBVTgN/O5wuuEXlhxWYoCqMhqOdkyf/j73hMeUrYPJwEGjQSCQMiaIBNIX2geB2fgFlE HvtQmp2ySl2fc3UJHYAYDyizrge7Twh4iuhO5O+96yxn8nD8iTJ9h6V/AITbfknTwCWG T4/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=UO8s63RSLtN3B5q4r6cHmPTKfgeKrEnM4eV41MMdVfc=; b=cahK10Nn7G+6iDKpUeAVcsNtmmoy08pNT0J2g6gMtjm+IOPXPyYmdgz78C4cxBNAQS 9WoyZFDYccuHHnLr0qM5quPtVqeThYW3yVjy7RJJ2M3rfzR/9iXGCNhv9sFKYKaoSCUi Wi2ickqKmYgKdbIcW/5Ge+zH9fcihRNSMaV0cWfb+WE6mOfRkEq3tIAhlB8DoyywzTuG he3NUgC1QhgwrWOcWxlYqUvIlYvwkQQcJ8npQOVx9cLfW0wt4Po2jUn94PYmPqmMnt55 15O8zK720vpZRf6tdYPgg8fvRXKZ82bApRLdlqBYqgkZA47SVVwyXnJXMDxSj1Z9gccF +o3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WtxL1+Iv; spf=pass (google.com: domain of mptcp+bounces-3850-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3850-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id z4si11398373pge.854.2022.02.18.07.17.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Feb 2022 07:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3850-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WtxL1+Iv; spf=pass (google.com: domain of mptcp+bounces-3850-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3850-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id 1AD203E0FF2 for ; Fri, 18 Feb 2022 15:17:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC4254A9A; Fri, 18 Feb 2022 15:17:37 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A6192919 for ; Fri, 18 Feb 2022 15:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645197454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UO8s63RSLtN3B5q4r6cHmPTKfgeKrEnM4eV41MMdVfc=; b=WtxL1+IvBHXDrt24xTqWQKp/qFT9e9iX0kGgnerBcEoWgL5Ui4JN6KLl8YCmx9kQidqG0B RBDPR8eZ9pRiCaoYefW62DWEjmDOErh4o4u8039fuXiMoIjteM8qRwlyyXqVwlf68WhZv3 2vEcwpRktxlqibinv1nTOPORusfZksA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-qbDI8CruNTeMYcqS_VEgVQ-1; Fri, 18 Feb 2022 10:17:33 -0500 X-MC-Unique: qbDI8CruNTeMYcqS_VEgVQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90193814243 for ; Fri, 18 Feb 2022 15:17:32 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 048D07CAD7 for ; Fri, 18 Feb 2022 15:17:31 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net 2/2] selftests: mptcp: do complete cleanup at exit Date: Fri, 18 Feb 2022 16:17:21 +0100 Message-Id: <3242f7901090b007a6c491cb971f99c530182d6d.1645196974.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Mat Martineau --- 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/tes= ting/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" =20 # restore previous status - cout=3D$old_cout - cout_disconnect=3D"$cout".disconnect + sin=3D$old_sin + sin_disconnect=3D"$cout".disconnect cin=3D$old_cin cin_disconnect=3D"$cin".disconnect connect_per_transfer=3D1 --=20 2.34.1