From nobody Mon Feb 9 01:12:03 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2732825uad; Mon, 4 Jul 2022 02:14:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uPx/SYClrVegNvlzlxqqhly16u5o77LYEA3Rsc8Z6gZSHCqcn5MbL295uRaCrxFN1fzGDH X-Received: by 2002:aca:f00a:0:b0:335:2675:aa14 with SMTP id o10-20020acaf00a000000b003352675aa14mr15781768oih.206.1656926098664; Mon, 04 Jul 2022 02:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926098; cv=none; d=google.com; s=arc-20160816; b=bVuJoRXI9OO+uXxbP9mFEEUkkxmSGXg6QGqTT8NBZgkqnDazot5WcbRzT7BDF3TLCu 1JC4wUrNKSrewwUcmN10doTP94g3/YqUpyXqjzkmAKUKz1D7RopScoQxKiRV1YmPtKmA QocqBvEuAgZBp0WozzIeMCDg227NGykR2WYojgDAg0JQdX+FrYLoLLsVAQ/Vn0ME564Z +20ycWxUiYwuLc0xpyji1er7jZitZy8D/cRTSGUB+mgM7XYPUamX4Kt1spGxdofVjHtF Lmnomlae+GUkU4QIgI4+NEWjS4q9REO+ykS+n+znYPBMufqYJQa2Gn/FLqLAJYEq6SWF PVYg== 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=yx8gscXQLt+O9V4Yg2p11V0oOyQxujGlWPURGa3OHDI=; b=xqwpUcDSJcIIJBBHsKw2kmyvBkmmzT881UgpFYsIfjkT+iLj2TLz8j8e0JInSPO9VD EwCtVh1H+XrxU/fAMbEpZ8OSebUlSHfSs04iFtOL8WiyaNzrbgNKwm+Zdonv4epFAUvD ZHM+SiKxXZcAjg/OK7htOPdPz+jLAEErPG8yuFVE5tWUy2DF9FCUZ/5+kUKX7eDG71GF S0lJ3dZheAdCdEHM9D8ElrKJ49Ts3M6dLxTtdXZaIM1o9Tv4eQRHGgc7381r+Fk2Kna7 9EelfGyr0OWuKMyRLX80b2i2PbdNLcYU6r5wz8gtE5mJ5CPyd3/PjU52i+fxkHwIQ9Mk 7tGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LKmVS3oP; spf=pass (google.com: domain of mptcp+bounces-5945-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5945-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from da.mirrors.kernel.org (da.mirrors.kernel.org. [139.178.84.19]) by mx.google.com with ESMTPS id s23-20020a056830149700b0061129550cb0si24574964otq.73.2022.07.04.02.14.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5945-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) client-ip=139.178.84.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LKmVS3oP; spf=pass (google.com: domain of mptcp+bounces-5945-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5945-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 da.mirrors.kernel.org (Postfix) with ESMTPS id 7D6FC2E09E8 for ; Mon, 4 Jul 2022 09:14:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0475123C2; Mon, 4 Jul 2022 09:14:57 +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 7D79923B6 for ; Mon, 4 Jul 2022 09:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656926094; 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=yx8gscXQLt+O9V4Yg2p11V0oOyQxujGlWPURGa3OHDI=; b=LKmVS3oPV/CgW/6XLNY1cf5fvKBxqrlXkVqi5W9csMvkV0CeDa5YGp4dJ7eY61e3sgXkRG Iv1eM+4x3uDsK27Ogg7r4dDF4N9GaR3FeSHhsq6p+yiOWvDMjXC8aUBPDJsa7bMJhU1unC recKokXGuCw3dvmTKoSqmf6YdolmKQ0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-216-o6eO7OK-Mo2Bd71XCTl5kw-1; Mon, 04 Jul 2022 05:14:53 -0400 X-MC-Unique: o6eO7OK-Mo2Bd71XCTl5kw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01A881C05EB7 for ; Mon, 4 Jul 2022 09:14:53 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 882742166B26 for ; Mon, 4 Jul 2022 09:14:52 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 4/5] mptcp: more accurate MPC endpoint tracking Date: Mon, 4 Jul 2022 11:14:35 +0200 Message-Id: <0ac098842905cdf73e2066296eba0a9f4168c25e.1656925387.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.78 on 10.11.54.6 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"; x-default="true" Currently the id accounting for the ID 0 subflow is not correct: at creation time we mark (correctly) as unavailable the endpoint id corresponding the MPC subflow source address, while at subflow removal time set as available the id 0. With this change we track explicitly the endpoint id corresponding to the MPC subflow so that we can mark it as available at removal time. Additionally this allow deleting the initial subflow via the NL PM specifying the corresponding endpoint id. Signed-off-by: Paolo Abeni --- net/mptcp/pm_netlink.c | 20 +++++++++++++------- net/mptcp/protocol.h | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d846ceeceb9a..60aada85b476 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -549,6 +549,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(stru= ct mptcp_sock *msk) entry =3D __lookup_addr(pernet, &mpc_addr, false); if (entry) { __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); + msk->mpc_endpoint_id =3D entry->addr.id; backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); } rcu_read_unlock(); @@ -764,6 +765,11 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *ms= k, return -EINVAL; } =20 +static bool mptcp_local_id_match(const struct mptcp_sock *msk, u8 local_id= , u8 id) +{ + return local_id =3D=3D id || (!local_id && msk->mpc_endpoint_id =3D=3D id= ); +} + static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list, enum linux_mptcp_mib_field rm_type) @@ -787,6 +793,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, return; =20 for (i =3D 0; i < rm_list->nr; i++) { + u8 rm_id =3D rm_list->ids[i]; bool removed =3D false; =20 list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { @@ -794,15 +801,14 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mpt= cp_sock *msk, int how =3D RCV_SHUTDOWN | SEND_SHUTDOWN; u8 id =3D subflow->local_id; =20 - if (rm_type =3D=3D MPTCP_MIB_RMADDR) - id =3D subflow->remote_id; - - if (rm_list->ids[i] !=3D id) + if (rm_type =3D=3D MPTCP_MIB_RMADDR && subflow->remote_id !=3D rm_id) + continue; + if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match(msk, id= , rm_id)) continue; =20 - pr_debug(" -> %s rm_list_ids[%d]=3D%u local_id=3D%u remote_id=3D%u", + pr_debug(" -> %s rm_list_ids[%d]=3D%u local_id=3D%u remote_id=3D%u mpc_= id=3D%u", rm_type =3D=3D MPTCP_MIB_RMADDR ? "address" : "subflow", - i, rm_list->ids[i], subflow->local_id, subflow->remote_id); + i, rm_id, subflow->local_id, subflow->remote_id, msk->mpc_endpoint_id= ); spin_unlock_bh(&msk->pm.lock); mptcp_subflow_shutdown(sk, ssk, how); =20 @@ -814,7 +820,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, __MPTCP_INC_STATS(sock_net(sk), rm_type); } if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW) - __set_bit(rm_list->ids[i], msk->pm.id_avail_bitmap); + __set_bit(rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap= ); if (!removed) continue; =20 diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index bc4dc81a4c3c..b9333e7f380a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -282,6 +282,7 @@ struct mptcp_sock { bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; bool allow_infinite_fallback; + u8 mpc_endpoint_id; u8 recvmsg_inq:1, cork:1, nodelay:1; --=20 2.35.3