From nobody Mon Feb 9 02:24:36 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:35eb:0:0:0:0:0 with SMTP id w11csp412582uau; Fri, 24 Jun 2022 09:38:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5z7Hcv0Zd0DWESKK8m3CRCgRQ5E+9IiF3jHRIxWaEZ4e3R75nUjLY2xdu3VWHHC6M7hxV X-Received: by 2002:a05:6870:c105:b0:101:a1d6:fbb2 with SMTP id f5-20020a056870c10500b00101a1d6fbb2mr2666028oad.66.1656088731944; Fri, 24 Jun 2022 09:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656088731; cv=none; d=google.com; s=arc-20160816; b=J//RqHQGJmbCzPlDQys+j8BZiQ3gDfxf5tovnPmoxkXGeOtgFzwpVuIW6nCloEIZ2X jOS+CzFOo0HvAF/onAD0jrTDde/L7fBAxqaB10tXod23A1jTCyaBp6gTDawK4C4ZMAxT EBB5N337EHRdzmW07+eWHnklPbGJDZjSDfzj3iHURpcDoZ4nywFEOtvjA86kaTbXbs4m JuajALnZMpFJ+sXchiUIYjZPF6fVL5oaG9cNcbYlfog79Bjf4IwXcsvn++JMiFYsW02V wJvduAC1CkgkASSQsgLcTM0rBK73qGfJlt+6l6D92UCuatVzSSpL2+jZbTKyivRqD1eC vdDQ== 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=hby7L1tgly8ED5o+KmGz7tjD892ck5ORtnujVbBFiMg=; b=XY7QiDxojKw9WBnAgnYX7SnpOiw75fYFAiR8pYesAra29nVyKyDW32fs8lafzLizjK ouNglTS8kEZ+Y5ElBruKIF8N54KnBr0gJVxG3PhuzTqdc4TNr95ZHgMHvT7i18tDhSzM 5LFueMZqPDLXOKV9l9tiz2G+vIRwlh9TxLDBv3q0D7enQegACHU6WKTp8G1psFOcH2KF K9saqnb4rw4BZexmjZVy2xnRwwT4dMR3Fnunp9BfUBaH3LWGyyqCkO8XNlBy6D4bYRFI AEdYnwjn0IgnoF+D4nR+lyiPxSl6slN9lQQoCOFMV1wk2WK5/8O2u4kG5QdLRsd8iAb4 Lu7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KgOsat3F; spf=pass (google.com: domain of mptcp+bounces-5820-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5820-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 j7-20020a056830270700b0060c20cf594esi4044240otu.190.2022.06.24.09.38.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2022 09:38:51 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5820-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=KgOsat3F; spf=pass (google.com: domain of mptcp+bounces-5820-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5820-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 95B982E0C38 for ; Fri, 24 Jun 2022 16:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CD523D9D; Fri, 24 Jun 2022 16:38:23 +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 E8E837C for ; Fri, 24 Jun 2022 16:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656088700; 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=hby7L1tgly8ED5o+KmGz7tjD892ck5ORtnujVbBFiMg=; b=KgOsat3F/uVsBXjY/zURc9wakYQZnknr/S5XrakV5mpMbV7GkpIjC91YbI0CLQ6lbxIi59 j8hVgBuqhoQ35r3u57AUxn7tm/49Zpy/Au8U+4p4T7P/PHKZVumibOcenxZpse0IbHKSHR yhVcMnDKyVt6efIIYHrJBQ9vmKw4V4c= 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-209-poj616DZPsiuqiWYpVjB5A-1; Fri, 24 Jun 2022 12:38:19 -0400 X-MC-Unique: poj616DZPsiuqiWYpVjB5A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC3CB3C0D1A7 for ; Fri, 24 Jun 2022 16:38:18 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A4EE2026D64 for ; Fri, 24 Jun 2022 16:38:18 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH RFC 4/4] mptcp: more accurate MPC endpoint tracking Date: Fri, 24 Jun 2022 18:38:10 +0200 Message-Id: <25ad186319f6b464aee3286c0386f2851f9a1f8f.1656088406.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.4 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 a6eb501e5031..cd0093ff1103 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -540,6 +540,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(); @@ -752,6 +753,11 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_s= ock *msk, 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) @@ -775,6 +781,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) { @@ -782,15 +789,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 @@ -802,7 +808,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 a92b6276a03c..ec91776f9b18 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