From nobody Sun Apr 28 00:54:31 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:9f92:0:0:0:0:0 with SMTP id a18csp1362835jam; Tue, 8 Feb 2022 11:06:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLH0D2JnWOfD7w6S8xoYrnF22HQdHqz2d9vfXjGnDp5p3P1zCI4aDQHqEkR3wms8IMvmqo X-Received: by 2002:a63:7d4:: with SMTP id 203mr3594600pgh.246.1644347201613; Tue, 08 Feb 2022 11:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644347201; cv=none; d=google.com; s=arc-20160816; b=z2zR8ws3dSBykDhVNgJlVALOGH7jepm4COQa1FJS76jHiXuKcHTKkFxjWK4yjqdeCO yyyRr4cb2smbqnu2dbqin7cmPqs3OgFyttV/rJ9CFkUWu2wEbJRrIc8ZRfJNGImKFKPK B9TuGX+onpF8U3q/tclGt5KWIb9yDdDKL2uQsntIOfFv4YsJ0QUaXy2LSO+D3AGmbt7Q rSJma/Q0+tuEpSiOAMf1KteSUMar4Ijf5SHG0JEBzbe0kmue/0xAT5oD/P77MOQvA2Og 02/hGDoTienXzezSBL4/cVk8XK2Nlw/J+Zc635FpjjERTnVtI+XfdNWAi2FIpGApYer7 wm4A== 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=VjyLRsATisKMfjqiT3pKbCmM2hXi2rvfQiTVWDRgKJY=; b=Fbowongb8E3dC3dRofFsSiaPz2VCMkDPmvSH9evXgsv6TTQNNWh36ZQspNJh4zLKTp u1FTIbp0VP2t782nHW6zMeMdUOJRFA/fUV0GGm2lM2XliFqVkx1vTlbw9X2h11RgCJgA qDhBprM+TC2PSgx8r9k10W9OFs/G/tvFRBrX0L752/aHiq2S9lbHUKvSnbWeni2gjDzS 8gsNS/G5r/1RWd1OxvE+lX9diDQBGX5mj9ctWD+4DyMsOC3xW028xBItKqlI72cns59c 0kD2weJ1tmVHuQxsHjmKmGTkN/AnbwDxqE1C+Xv0r0eKdQl7xnvKIwqSyB32jolCPJiV ZdpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cCklNAb1; spf=pass (google.com: domain of mptcp+bounces-3525-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3525-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 b4si13581540pgt.307.2022.02.08.11.06.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Feb 2022 11:06:41 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3525-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=cCklNAb1; spf=pass (google.com: domain of mptcp+bounces-3525-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3525-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 EF0B33E0F66 for ; Tue, 8 Feb 2022 19:06:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 326102CA4; Tue, 8 Feb 2022 19:06:39 +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 F05BA2C9C for ; Tue, 8 Feb 2022 19:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644347197; 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=VjyLRsATisKMfjqiT3pKbCmM2hXi2rvfQiTVWDRgKJY=; b=cCklNAb1FWOfQkxloZ6XP/QtISoZi+8U9TMDO5x746TgFAmb64Gj/cqoZBuSsA/Hin6uMr LREinI3xOhWwaLkabQeZeV/Bigm56CgejTRoPP+wikkjgZ7TT2b4S92prZ41zBnkS2Sevp r/Xr+TzV/0WHP3uiE3al7kHVOvHzx3Y= 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-81-KO2RnX64N16yvFL2ewiJtg-1; Tue, 08 Feb 2022 14:06:33 -0500 X-MC-Unique: KO2RnX64N16yvFL2ewiJtg-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 B3DBD1DDE9 for ; Tue, 8 Feb 2022 19:06:32 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23D9360BF4 for ; Tue, 8 Feb 2022 19:06:31 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v2 1/4] mptcp: fix race in overlapping signal events Date: Tue, 8 Feb 2022 20:06:15 +0100 Message-Id: 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 a88c9e496937 ("mptcp: do not block subflows creation on errors"), if a signal address races with a failing subflow creation, the subflow creation failure control path can trigger the selection of the next address to be announced while the current announced is still pending. The above will cause the unintended suppression of the ADD_ADDR announce. Fix the issue skipping the to-be-suppressed announce before it will mark an endpoint as already used. The relevant announce will be triggered again when the current one will complete. Fixes: a88c9e496937 ("mptcp: do not block subflows creation on errors") Signed-off-by: Paolo Abeni --- net/mptcp/pm_netlink.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 93800f32fcb6..fb8d4bfcfbd6 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -546,6 +546,16 @@ static void mptcp_pm_create_subflow_or_signal_addr(str= uct mptcp_sock *msk) if (msk->pm.add_addr_signaled < add_addr_signal_max) { local =3D select_signal_address(pernet, msk); =20 + /* due to racing events on both ends we can reach here while + * previous add address is still running: if we invoke now + * mptcp_pm_announce_addr(), that will fail and the + * corresponding id will be marked as used. + * Instead let the PM machinery reschedule us when the + * current address announce will be completed. + */ + if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL)) + return; + if (local) { if (mptcp_pm_alloc_anno_list(msk, local)) { __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); --=20 2.34.1 From nobody Sun Apr 28 00:54:31 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:9f92:0:0:0:0:0 with SMTP id a18csp1362903jam; Tue, 8 Feb 2022 11:06:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEWDatC6ciJxdXKAvw/sIulC3pSjCiTjAp/VjIyhWgK4CwIRjo/GnQtGdvOE9ejbKLImLE X-Received: by 2002:a05:6a00:1a4f:: with SMTP id h15mr5832923pfv.50.1644347205273; Tue, 08 Feb 2022 11:06:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644347205; cv=none; d=google.com; s=arc-20160816; b=d1R8QHUclrF+SEKCmrZb40ECYC3W6lQgHDo2jc+BbwDR7OWZQFpoizt0T0T/bmHO4k m1IcL3Rta4uDOog7owxBwgUIW60cyzT/x+1WV3WDiomlm5HxbDdtF3ltEOC4sUrDk1Ko bQB7g+haYO08+gtkAcvYxr9qV/gybRT1O+BCfCeG+Q9Vr8LyfVYOZUJUT7l6QtUgcyIw /y8z0o2MlrFoajhX2vh9svHZlb29m3lK+qmTX1sktFBZSFUKaeBmfkxE/aDCMfCSdqiL 67cGhGfq5zVtDblCcpTt03SVA3ajaLHI697ZNVnHqZZiQT3qPyBenFiw4nGogMlD9icm F8ww== 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=NYwqW+yN/sja4Ias0iLWRwk9JKIWwJVcdVXbuPq8dd4=; b=F2csz6QzGcS2TgahV4+Ph+dH62pv8DA1Mo8J7ImW98pdYCjkALVXME1DvHaw7EbCU3 5KHhgbkwxs+fCrFet0B1XZHcXRdQ3s1Nr67Ht/j0U0J4gLcOovxMdHxDXBRZln+/aRzv 86CGzcprzdDPgdUW8s/fhAGS+DVi9UD0X4yJV5GGEHlZqBBSWLH6HgKCJvBSYaJitO9F fqK/4EMXSXlMy+kZ4RubPQyzcDupVVxDio23Bv43mdlUHy5cC+ebu5IGyLoENf2A+Cac w64A+8EHEw8Asw6V7a4U1oDB3DREMiae1xtd6qvaMyxJmarZ686A4eOpb+bkV0+1gaOH 22hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iVYkprZ9; spf=pass (google.com: domain of mptcp+bounces-3528-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3528-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. [147.75.69.165]) by mx.google.com with ESMTPS id q7si13202405pgk.345.2022.02.08.11.06.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Feb 2022 11:06:45 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3528-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iVYkprZ9; spf=pass (google.com: domain of mptcp+bounces-3528-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3528-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 6276D3E100B for ; Tue, 8 Feb 2022 19:06:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82FE72CA2; Tue, 8 Feb 2022 19:06:40 +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 81CC62C9C for ; Tue, 8 Feb 2022 19:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644347198; 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=NYwqW+yN/sja4Ias0iLWRwk9JKIWwJVcdVXbuPq8dd4=; b=iVYkprZ9NSKyDNcFnPjqhQUM0QSWhgB1LB97PhGM627YTWPrE2hbZdKaA4zcvBqmOqpy6d yogYoE48XjcH+b0F/QDpsOsrymDySPORHhiN9Geetx9jO1Enh9haNqQjG9rnzZjh2lYFQH PN4m2MzUWBH5sUvlKxzuWBJ/y9PZqSc= 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-537-QCjTXgSROqO3MhlCyhbzVQ-1; Tue, 08 Feb 2022 14:06:35 -0500 X-MC-Unique: QCjTXgSROqO3MhlCyhbzVQ-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 4438E80292C for ; Tue, 8 Feb 2022 19:06:34 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id A669B60BF4 for ; Tue, 8 Feb 2022 19:06:32 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v2 2/4] mptcp: fix race in incoming ADD_ADDR option processing. Date: Tue, 8 Feb 2022 20:06:16 +0100 Message-Id: <9055dfabebe975c34e5f741885e1c70ecb49da36.1644346664.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" If an MPTCP endpoint received moltiple consecutive incoming ADD_ADDR options, mptcp_pm_add_addr_received() can overwrite the current remote address value after the PM lock is released in mptcp_pm_nl_add_addr_received() and before such address is echoed. Fix the issue caching the remote address value a little earlier and always using the cached value after releasing the PM lock. Fixes: f7efc7771eac ("mptcp: drop argument port from mptcp_pm_announce_addr= ") Signed-off-by: Paolo Abeni --- net/mptcp/pm_netlink.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index fb8d4bfcfbd6..4b6aa89d45a5 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -660,6 +660,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_= sock *msk) unsigned int add_addr_accept_max; struct mptcp_addr_info remote; unsigned int subflows_max; + bool reset_port; int i, nr; =20 add_addr_accept_max =3D mptcp_pm_get_add_addr_accept_max(msk); @@ -669,15 +670,19 @@ static void mptcp_pm_nl_add_addr_received(struct mptc= p_sock *msk) msk->pm.add_addr_accepted, add_addr_accept_max, msk->pm.remote.family); =20 - if (lookup_subflow_by_daddr(&msk->conn_list, &msk->pm.remote)) + remote =3D msk->pm.remote; + if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) goto add_addr_echo; =20 + /* pick id 0 port, if none is provided the remote address */ + if (!remote.port) { + reset_port =3D true; + remote.port =3D sk->sk_dport; + } + /* connect to the specified remote address, using whatever * local address the routing configuration will pick. */ - remote =3D msk->pm.remote; - if (!remote.port) - remote.port =3D sk->sk_dport; nr =3D fill_local_addresses_vec(msk, addrs); =20 msk->pm.add_addr_accepted++; @@ -690,8 +695,12 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp= _sock *msk) __mptcp_subflow_connect(sk, &addrs[i], &remote); spin_lock_bh(&msk->pm.lock); =20 + /* be sure to echo exactly the received address */ + if (reset_port) + remote.port =3D 0; + add_addr_echo: - mptcp_pm_announce_addr(msk, &msk->pm.remote, true); + mptcp_pm_announce_addr(msk, &remote, true); mptcp_pm_nl_addr_send_ack(msk); } =20 --=20 2.34.1 From nobody Sun Apr 28 00:54:31 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:9f92:0:0:0:0:0 with SMTP id a18csp1362853jam; Tue, 8 Feb 2022 11:06:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUV5NySzUrm9axJiLlLIO1DKgqrhHGd8Oif9LikGKCuZtv38xAJVw4z9NhnL6b+1p0ih6h X-Received: by 2002:ac8:4b48:: with SMTP id e8mr4059567qts.462.1644347202713; Tue, 08 Feb 2022 11:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644347202; cv=none; d=google.com; s=arc-20160816; b=BJPSf+35eM07rFmTF41CZu75aNixqG7p7IsQW+8KHl5yvEUg8hJ6Q2UPzoXGv7utud wRG2NiGQZHIrk9m9QwUCmt/r2fD7WQ1ZLngDS9fD/QmcW/1TV0HE7NLv9IXU2o4OP778 7Rii9FvQo2fekdUZ9OjFvXx5rt3s9fz0tK9K8M2fFGE5QkxnrFeRtls2ftmGuloBvTL+ WFnf47uM3UCcK8S4UMj1K1+bvOBr0GTF2RALudqOexPW9hIFUbJ0MkJ1tpdPriizF76p 6KR4mZLLkwRRmoEco+BtHOYzyxHMebUeGaJOZUd1tJWRBus2CPV7q85C4vWBxUboXCSy XpIA== 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=A3ARgymVTVtsiXYGKLmMNFhJnfkY/4+I36Zn1I2Cj0Q=; b=HTb4C5vgMHOIVs6DjVoVXoIAeev+Ocgsx+8D1y8ITQ7q2f7kDJi7VbzwYOkfr6BwNr QZHlGHProKDfu7pMHZsJ43sywx6NCs+XGG14iGIjsJC+gcNig7zZ88ZzuzabcLXmBHWZ z40/LIS2/rCxJ9KRWgxVFifS5yGFI+3Zk1Ric6tO/V/BH2WrjHLZWeeBdztz9+MAwWqM rrkc7RX2oP8uB2GVE954SmtXTB7xST0xlbIihe2cos0/dMgi34VSEy1+3WbFilolv6S1 /EkVRu7U6zow3oWgDkbw7W3owFTB/uHl1mugOXxowUlKjBW/a4Cuk9hDIPZo4rUlk0Kz znoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="PaeajB/K"; spf=pass (google.com: domain of mptcp+bounces-3526-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-3526-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. [147.75.197.195]) by mx.google.com with ESMTPS id r11si642575qkp.214.2022.02.08.11.06.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Feb 2022 11:06:42 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3526-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) client-ip=147.75.197.195; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="PaeajB/K"; spf=pass (google.com: domain of mptcp+bounces-3526-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-3526-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 611281C0BA2 for ; Tue, 8 Feb 2022 19:06:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDF972CA5; Tue, 8 Feb 2022 19:06:39 +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 81ADB2C9D for ; Tue, 8 Feb 2022 19:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644347197; 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=A3ARgymVTVtsiXYGKLmMNFhJnfkY/4+I36Zn1I2Cj0Q=; b=PaeajB/KjIuie/Mr+kJ95EMt/ECvNafTUSYjT9slvr3NseRLrDDCXzWAb2hAHmwWmkXx21 oJdFVm3gODZzuU6/0TkqoyjfPsCpGKnTleAeFpJRe9E3mdEL7NtyC38XpBgDB8Ip4FEpwJ Pq80TKmpms5mrSO0zHQAuTZuY7xG7Wg= 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-411-Y4NZW4IIMHWIsJRvX-TwhA-1; Tue, 08 Feb 2022 14:06:36 -0500 X-MC-Unique: Y4NZW4IIMHWIsJRvX-TwhA-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 4D70410247A8 for ; Tue, 8 Feb 2022 19:06:35 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E6A460BF4 for ; Tue, 8 Feb 2022 19:06:34 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v2 3/4] mptcp: add mibs counter for ignored incoming options Date: Tue, 8 Feb 2022 20:06:17 +0100 Message-Id: <47890ba6bf9dc9cb16aa93d9cdfe0b79c78c8f11.1644346664.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 in kernel path manager has some constraints on incoming addresses annunces processing, so that in edge scenarios it can end-up dropping (ignoring) some of such announces. The above is not very limiting in practice since such scenarios are very uncommon and MPTCP will recover due to ADD_ADDR retransmissions. This patch adds a few MIBs counter to account for such drop events to allow easier introspection of the critical scenarios. Signed-off-by: Paolo Abeni --- net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/pm.c | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index c12251cb0d44..d544b5304596 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -36,12 +36,14 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR), SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD), SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD), + SNMP_MIB_ITEM("AddAddrDropped", MPTCP_MIB_ADDADDRDROP), SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX), SNMP_MIB_ITEM("MPJoinPortSynAckRx", MPTCP_MIB_JOINPORTSYNACKRX), SNMP_MIB_ITEM("MPJoinPortAckRx", MPTCP_MIB_JOINPORTACKRX), SNMP_MIB_ITEM("MismatchPortSynRx", MPTCP_MIB_MISMATCHPORTSYNRX), SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX), SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR), + SNMP_MIB_ITEM("RmAddrDrop", MPTCP_MIB_RMADDRDROP), SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW), SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX), SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 7901f1338d15..785cf751e5c0 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -29,12 +29,14 @@ enum linux_mptcp_mib_field { MPTCP_MIB_ADDADDR, /* Received ADD_ADDR with echo-flag=3D0 */ MPTCP_MIB_ECHOADD, /* Received ADD_ADDR with echo-flag=3D1 */ MPTCP_MIB_PORTADD, /* Received ADD_ADDR with a port-number */ + MPTCP_MIB_ADDADDRDROP, /* Dropped incoming ADD_ADDR */ MPTCP_MIB_JOINPORTSYNRX, /* Received a SYN MP_JOIN with a different port-= number */ MPTCP_MIB_JOINPORTSYNACKRX, /* Received a SYNACK MP_JOIN with a different= port-number */ MPTCP_MIB_JOINPORTACKRX, /* Received an ACK MP_JOIN with a different port= -number */ MPTCP_MIB_MISMATCHPORTSYNRX, /* Received a SYN MP_JOIN with a mismatched = port-number */ MPTCP_MIB_MISMATCHPORTACKRX, /* Received an ACK MP_JOIN with a mismatched= port-number */ MPTCP_MIB_RMADDR, /* Received RM_ADDR */ + MPTCP_MIB_RMADDRDROP, /* Dropped incoming RM_ADDR */ MPTCP_MIB_RMSUBFLOW, /* Remove a subflow */ MPTCP_MIB_MPPRIOTX, /* Transmit a MP_PRIO */ MPTCP_MIB_MPPRIORX, /* Received a MP_PRIO */ diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 1f8878cc29e3..c28dd5c21cbe 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -213,6 +213,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk, mptcp_pm_add_addr_send_ack(msk); } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { pm->remote =3D *addr; + } else { + __MPTCP_INC_STATS(sock_net((struct sock*)msk), MPTCP_MIB_ADDADDRDROP); } =20 spin_unlock_bh(&pm->lock); @@ -253,8 +255,10 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, mptcp_event_addr_removed(msk, rm_list->ids[i]); =20 spin_lock_bh(&pm->lock); - mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED); - pm->rm_list_rx =3D *rm_list; + if (mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED)) + pm->rm_list_rx =3D *rm_list; + else + __MPTCP_INC_STATS(sock_net((struct sock*)msk), MPTCP_MIB_RMADDRDROP); spin_unlock_bh(&pm->lock); } =20 --=20 2.34.1 From nobody Sun Apr 28 00:54:31 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:9f92:0:0:0:0:0 with SMTP id a18csp1362875jam; Tue, 8 Feb 2022 11:06:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVHuZ8iN2Jj4uvlA22bKRdq+5PzSpYqBlIuC+SnmvWWlwccIYfo/ezxYIlRC1IacnQH7Ay X-Received: by 2002:ac8:4e8c:: with SMTP id 12mr4153865qtp.618.1644347203845; Tue, 08 Feb 2022 11:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644347203; cv=none; d=google.com; s=arc-20160816; b=oHRdvjzFiDw+3ridRsvtQqu+hrtCpQXJba7cyvE+wXZ/KZzvTHLuIb0kCvkZ7Z/fIi LaWMKawp7Y044Q59CReEOC1L/ELzAZ6/GjNrg7YwgMC3socfWz7Qd523JEsMGBXZFLfc T9jSqhRLv4oLAMgnDHEDvONTbhP0FLLBwOb8W47Kq0SP8T2BzGT5d8dShhAWmJ5azS6f tCdqX06L7bCWRod0DahHNFXE5YPGxKxRco2QvKJ2MhiPYm33d5ttE/GQglzxU1wiN7oX kjs3RlpX1JezBPyInXvWdCJEfXkhzIem02Rr+p03+/UBE+UxHsBu2r7y6HYNI6x2JisL LLrA== 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=rH5USFWdLZjhEFfoKpz9D+T6Eoe4ntVi1Mzlbs2xw60=; b=y5ejpcZZWOCxq0uvDxO0HIuQZyv6u7BUDSPByG/kXJn+oRC410rCPP0SoRBC69XqpC hH26+bXjtclbSqHh+qtbOqnM4PEPXjwzy5D2CfA8UH1xopycAohAFZJscDcX1t5Gzk3l bvDBr6jPXchxmG82zcZH+lp5j9YWQ/iyOwPzSemblufK7Ri+DzUsVgeRs87LpKM+2nLc 0Q7XDtTa0r9gGCBrnxuqAgH5lgtxWzwtgKjk4fgtBpyw7SGYzv35QWiVyAzsLdrWAB7V yIbv9N8Br9lGE0O4D3HBkmx0De5MRHTLpqP4XKiOBheTWBKVE58Cg0c0bNEkS+jKLqjm FUsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UIXvKKUw; spf=pass (google.com: domain of mptcp+bounces-3527-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3527-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 u18si3297993qtx.554.2022.02.08.11.06.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Feb 2022 11:06:43 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3527-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=UIXvKKUw; spf=pass (google.com: domain of mptcp+bounces-3527-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3527-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 A34EF1C0B5C for ; Tue, 8 Feb 2022 19:06:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3539F2C9D; Tue, 8 Feb 2022 19:06:40 +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 1D8512CA2 for ; Tue, 8 Feb 2022 19:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644347198; 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=rH5USFWdLZjhEFfoKpz9D+T6Eoe4ntVi1Mzlbs2xw60=; b=UIXvKKUwgCSKbR7AyQabPBSF7xPMO6PZv8uQa1gACxOJDkNsVGsJfy8q+iFU5xh1/UEfoc eTUj+0UCOl95/xf1y95CdSjVibufT5yfVHd5tbyt4rKepN1pAQTZF3+/ELWDuAX+29wtSc hAdgOs82ZaDAgRzdhDIiilX7oKt9A/Y= 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-465-hFfT8i5MPamM1bpbNmGJvQ-1; Tue, 08 Feb 2022 14:06:37 -0500 X-MC-Unique: hFfT8i5MPamM1bpbNmGJvQ-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 2D936802926 for ; Tue, 8 Feb 2022 19:06:36 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93B8A60BF4 for ; Tue, 8 Feb 2022 19:06:35 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v2 4/4] selftests: mptcp: more robust signal race test Date: Tue, 8 Feb 2022 20:06:18 +0100 Message-Id: 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 in kernel MPTCP PM implementation can process a single incoming add address option at any given time. In the mentioned test the server can surpas such limit. Let the setup cope with that allowing a faster add_addr retransmission. Signed-off-by: Paolo Abeni --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 90a6adc36490..66ac990415e6 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -915,11 +915,17 @@ chk_add_nr() local mis_ack_nr=3D${8:-0} local count local dump_stats + local timeout + + timeout=3D`ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout` =20 printf "%-${nr_blank}s %s" " " "add" - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{prin= t $2}'` + count=3D`ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAddA= ddr | awk '{print $2}'` [ -z "$count" ] && count=3D0 - if [ "$count" !=3D "$add_nr" ]; then + + # if the test configured a short timeout tolerate greater then expected + # add addrs options, due to retransmissions + if [ "$count" !=3D "$add_nr" ] && [ "$timeout" -gt 1 -o "$count" -lt "$ad= d_nr" ]; then echo "[fail] got $count ADD_ADDR[s] expected $add_nr" ret=3D1 dump_stats=3D1 @@ -1311,6 +1317,7 @@ signal_address_tests() =20 # signal addresses race test reset + pm_nl_set_limits $ns1 4 4 pm_nl_set_limits $ns2 4 4 pm_nl_add_endpoint $ns1 10.0.1.1 flags signal @@ -1321,7 +1328,10 @@ signal_address_tests() pm_nl_add_endpoint $ns2 10.0.2.2 flags signal pm_nl_add_endpoint $ns2 10.0.3.2 flags signal pm_nl_add_endpoint $ns2 10.0.4.2 flags signal - run_tests $ns1 $ns2 10.0.1.1 + + # the peer could possibly miss some addr notification, allow retransmissi= on + ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=3D1 + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow chk_join_nr "signal addresses race test" 3 3 3 =20 # the server will not signal the address terminating --=20 2.34.1