From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 146FC1AE029 for ; Fri, 2 Aug 2024 18:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622671; cv=none; b=QuRsOcoCnPJlr96lweO8s/EEbku/Bo2OLRQoKWBsFsNlIEZDhNL5u/2FWxe96fC2elT3XfuCDdBPifTdZxsRIegNH3yHHdECDIQlaTbUQN/T3y+/2rF7w6SUp/b8rI6Rv3xncWKkzxj0MfSc5bDLOjOHlCO32m9psrRFRJYoA/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622671; c=relaxed/simple; bh=uM4Gq9zI9UOP2ANRhGukPPi6D3oGnF4sUdpTutMU+ms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M17VNvVn2Ao13fpbUcRtAJdnetarJ/fSkvMyydzu+pucDHwKqxPzts1otmGWP1F4lVAAa0/5vRv3VIb3V5H7AcDV6DgY6TDzOKqDL2HU2IIYgQQkB3jIbPPH4huHhsDIeU5qQ19tILUg28feHpDOx3ELuwvPVyjUJCxU7dMiRO8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GoQChIci; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GoQChIci" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFB45C4AF0C; Fri, 2 Aug 2024 18:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622670; bh=uM4Gq9zI9UOP2ANRhGukPPi6D3oGnF4sUdpTutMU+ms=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GoQChIciaZ6XWPmVFLYr7ZtmmQ2LCCPXdZ86p4/waSwmzjTHUdiqyQtfSq82xBsSu J5/02eqXf0FoVjGNasyn/TaTm0zfUKxoDsLTnprMP/LwXZvG7VzEv0Ud583howc34L w1DT8pWuhFyyJbahQrDUbeKgJKjt4vdCAXRHrqahFhWa7Fa69DaM7Mpcewf8DZfZrk HDYDEoJOX0NsYQ4eR2mAVP558CUD0+DsqiC8emYp7XgNK+NaMj2HRhcx/u6c2vN66d fP1QnRcI/OhwUlKSpSQ9B+JnBpI91TtcUUJSJHvXKj3/E8jRJPFeD28jy5I0ndpZp+ elSKaECJ5gSKg== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:38 +0200 Subject: [PATCH mptcp-net v6 01/11] Squash to "mptcp: pm: re-using ID of unused removed ADD_ADDR" Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-1-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1446; i=matttbe@kernel.org; h=from:subject:message-id; bh=uM4Gq9zI9UOP2ANRhGukPPi6D3oGnF4sUdpTutMU+ms=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLK38+WAYimf/JdVss+4mN5A4vMfl6t6oXgm 7gkXy6/PaqJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iygAKCRD2t4JPQmmg c/5oD/4+gxIaa4+WhOm/ndUFtqj7pv9+Pq3PBPwu/k5GYF4NYM7vqIpp0NMzIU8tSThKZyAuRNW PHyiMUF/RaxBP05dcoDyufJ+Pqg0098FY0D3Fd5Jt5e7+UfNdeSAktU6y81Uorc37Uh107yVd9G dZ4tzcgOOPbzxba6C6NjLsVBj/HGtONQxlRps4VHKyYJPuJj6VzgRKsSnW5gGrEIHZb5xvfQhQw Mf92NTJkSw1GJE+F3O9JdAf3SVRX2l7Y3D2iRE85yoF4DKK7pBbWH7BXP7kPvF2ECHfCJOF3Rl0 5X0W/8KIaknfGWlush33jHPdxO1dQO2D9KATWAXuBpxE3vZ+81Mk6qW+EVaOGSJ2WGGO5fyqNRk K5rSxHAZx5TfhhifmV6mfoZTIbpGVsqTNnlyZl7r+IQJfr7GL++IINHQYV9SUjqpTv0mr4vSbq+ CZcN2n5EVH/dRaH9uoCe/bVzfuxOdz0rJIDXD2QVGzfXWhpROwiuDGcOIClU+KTdfnbsAEEpWeI QOKx5y1rZLUp2evfp1aLo+nEwoNy4/SbA8lWcZwQnujJuVZIukKjxaqa7IatQPBEneLvIi8gRYM VEuLMNXPlq3AXC5AYtUeqtJX3Y8O7dBAJ6z5n3P5vbPVYHRxBTCeoH0QorJcY/tEcrBJX898lDg P6QHohtteje837w== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It looks better to mark the addr ID as available in mptcp_pm_remove_anno_addr(), where we decrement pm.add_addr_signaled: this helper is only used by the in-kernel PM (compared to the previous one), and the mark was only done if an entry was found, which will not be the case if the entry of the initial subflow is removed while now, it will be done because 'force' will be set. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 469a16326b3f..3e552b4f1a21 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1423,11 +1423,6 @@ static bool remove_anno_list_by_saddr(struct mptcp_s= ock *msk, =20 entry =3D mptcp_pm_del_add_timer(msk, addr, false); if (entry) { - spin_lock_bh(&msk->pm.lock); - __set_bit(entry->addr.id ? : msk->mpc_endpoint_id, - msk->pm.id_avail_bitmap); - spin_unlock_bh(&msk->pm.lock); - list_del(&entry->list); kfree(entry); return true; @@ -1448,6 +1443,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_so= ck *msk, ret =3D remove_anno_list_by_saddr(msk, addr); if (ret || force) { spin_lock_bh(&msk->pm.lock); + __set_bit(addr->id, msk->pm.id_avail_bitmap); msk->pm.add_addr_signaled -=3D ret; mptcp_pm_remove_addr(msk, &list); spin_unlock_bh(&msk->pm.lock); --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 44EC41AE029 for ; Fri, 2 Aug 2024 18:17:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622672; cv=none; b=LKZDXzLGk6WP009K4rTMOXaxRT1zyhcvr6eWJH/SKSdFAC0HX91246AkanYTmqLjnfnziRKKoJfW/PNPRvUVAo6VG/W8X/kGIuG7lKiMn9Y9wQKGTcBFIozplRdqTi51Lc89UyzcoOch+XkKNPHoIejChAlcjlDYXDrWi2Ae1Ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622672; c=relaxed/simple; bh=jzCnTdKEaBj2I6Ig7Wb5w18r5QTMqq2lxNKRica19fo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pvHI6C34EgYLzYwsH19m/Q9GBh9supAX9qVW7aAoFrk2vgMdKbsi0zxC25LhGfzD3RTFuiTA9eXOHqBaa2ko43+B/YMnEOpnx0KUVGhz0KHiyWlyIPVHGFlFFXmcNBn3mFC+WU+l9vxoNE0AIWSHXA1L1coskW2mS/0R5zLgHGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dYDeNR6z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dYDeNR6z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 196CFC4AF09; Fri, 2 Aug 2024 18:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622671; bh=jzCnTdKEaBj2I6Ig7Wb5w18r5QTMqq2lxNKRica19fo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dYDeNR6zlfGcodJfrg7AqGRq82Xtg8Zc+kuxSbzM3uQRLSFTkUL5XPcpiTTgRnkF0 YvseCEmPOyEWyf76E3E6JrpVZwMKCcRq5qZLxfSStChV0HdPuh8YhY/BnyNvlQLXfi a8epL4NGSEg1ZnlSNVIfGtnkIXHlhtSFM04rLBaOJ7D/dT+ZjUy0oM5BCpD6yXYmo+ PVJF0PvmARimMO8MlbnYDegFF3CW0GkwUAZU/dz/zYodGETCFSaOWVvLCXjymMV7YZ C2X1hY/iPb/DDBaaN41WLPF6gUrGmVY+GJURPIuo9kxGmi8Wad9KlakGYYM1eYw6ax aDUvE/gPvBC7g== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:39 +0200 Subject: [PATCH mptcp-net v6 02/11] Squash to "mptcp: pm: fullmesh: select the right ID later" Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-2-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1321; i=matttbe@kernel.org; h=from:subject:message-id; bh=jzCnTdKEaBj2I6Ig7Wb5w18r5QTMqq2lxNKRica19fo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLKEwdkKDyvXNgL512S/SCDLP5ME7QgMsRoD 59zSk8/Q3mJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iygAKCRD2t4JPQmmg c58PD/9f6Ae1z0oK0hijlOe45OUiHRLPRedUg6SMOqQP46/gNbSRf68NywsX3TFJUDTvNUme6EC IUUhNwN/+JiwucQSHY7oAHneAmnJKbXihfqNerUjstJCxHuXcolIqQuk2q3VktJPA7KeVs0TMj3 JonHBnkBb6/8Ym/FXM6NMFV5CHEGynB28FQmJ9ga15xy4Lm3lahMKEjC4sCT6ZC4nuhaAzkqk3D BfqstoDjJg4GaXcW7IhMeJqbbbHWISky3iV4uJNKjv9gO+wIQXQZdED/NN/FAb1Cz1JH2sCkq3V O6i7/fH579EGPM55NBX7g+MVZSnHcKgOswtu6knZZrZrlHJgXejqb9P9s/ZcXc7glJCZI9WzAMo 25tMPjUcBNk+TINrgCTM4yHdjHBdStPBh5qenWP9bl1cJThlGB8mjYlnm4O8hpuM+DAAqoRpfJh wDTliP0H5Yx4FgTtHkfj+FeILV7Gbw/elpaaxxUm0QCeoOReVHaqeqazkXOelILdcflKJ1Yrxuy 9x3mIBwcALIuIMhNiCb3kX8B6/GnWc77MqZ+78NzI8EV9Wjj5qOwHZoIjuMLKl+sWRsnWS1ZnUg L8IpTF20QOcXui0PS3boc74OJ58DZYuhZAKxHUJV9SQkcQavboK0N0nIC2fvAmM3n24qD1XnhXd HgiDKKulyxtZ8WA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 We don't need to depend on msk->first to get the source address of the initial subflow: it can be retrieved from the msk itself. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 3e552b4f1a21..605cfd7bc004 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -661,8 +661,7 @@ static unsigned int fill_local_addresses_vec(struct mpt= cp_sock *msk, pernet =3D pm_nl_get_pernet_from_msk(msk); subflows_max =3D mptcp_pm_get_subflows_max(msk); =20 - if (msk->first) - mptcp_local_address((struct sock_common *)msk->first, &mpc_addr); + mptcp_local_address((struct sock_common *)msk, &mpc_addr); =20 rcu_read_lock(); list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { @@ -678,8 +677,7 @@ static unsigned int fill_local_addresses_vec(struct mpt= cp_sock *msk, locals[i].ifindex =3D entry->ifindex; =20 /* Special case for ID0: set the correct ID */ - if (msk->first && - mptcp_addresses_equal(&locals[i].addr, &mpc_addr, locals[i].addr.po= rt)) + if (mptcp_addresses_equal(&locals[i].addr, &mpc_addr, locals[i].addr.po= rt)) locals[i].addr.id =3D 0; =20 msk->pm.subflows++; --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 78D8D1AE029 for ; Fri, 2 Aug 2024 18:17:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622673; cv=none; b=p2v794EOi9kaQwl2MeN9gHoXyonCgrp2UXfJKVkKhJzADRvJjsrXWDrI6Esc9pXlZ1Iy54Vf2MFJifUspmxz1H9GSBXq3pDmyLw9ZV/U6CjQSgM+ajIBjAjP5kwDoXyAKu3bzD3PoaKr2tSs+hzRmNbgOPlXFwl8VTV3UaI0FJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622673; c=relaxed/simple; bh=UbXCCFkTuOpDNHIkLtS260QO4lsFcdAGt77nB6VMSgQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CCr8q03sPy4dVe7XSzjXE6P3huJRBtlbDK9j8hJLP+eKIoukBD57rr/gfaAjrdXAvKTHWGfutv3CGaSs7kUrRSkKYXX7KlOw5rkuclk08OgVtFBE7IM4egdmizio3OZWLI8LQ+JYT34BbZ67eltletxMMVzYSkOXAez0zFkKoko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HJYBOKPu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HJYBOKPu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4801CC4AF0C; Fri, 2 Aug 2024 18:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622673; bh=UbXCCFkTuOpDNHIkLtS260QO4lsFcdAGt77nB6VMSgQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HJYBOKPugSIbtNV79t1MsLKoSHv0nZ2WN62McfoXI0LXi1v//zrWwwns/YVk+rBwg /mPHl+k8J9cpjwEkBPN1d4i+vyvvhHX/CiE4weqzVEAQSXFukUmWQSZnIID+uRGowf QBNCTrhJVH6lt9m9yAQV9EKu2/dtmF9SSHjjzBof+znoh7+SWtxGWJ6rEHjLwPEuf6 Y76/ZM6K58Arg4BuMeN70V2UAGH4+1pH6MaCdF3ZmtaLhYJi61acqdOCB3hAqPyuKb ngqrvPv/bLXGavVlaWwbNkf4fPLSlg8epxcNTpwlkzA2nhkDyqnUO8CS3T2/VGpIFw YYDvbUBTkZdDQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:40 +0200 Subject: [PATCH mptcp-net v6 03/11] mptcp: pm: fix RM_ADDR ID for the initial subflow Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-3-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4941; i=matttbe@kernel.org; h=from:subject:message-id; bh=UbXCCFkTuOpDNHIkLtS260QO4lsFcdAGt77nB6VMSgQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLKgJhQtbwDk+mSOiC792WDSzKcYVlPtA86S V6akb4zcrOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iygAKCRD2t4JPQmmg c2o0D/9peyyp76CuG2MmU96foadhAPqK5aSZPxzUvsDcan5XlazjsnRGCGxa1D8HWXmYNrBFTWs tbQ6DmdJW+VkIPJBROrW3NTliss2lMAWsqdVC8WAgGmOcLavv8cAHvLXz0FeUDbDJQE5IISQhNn /Pw6ydzLjVfJXIEN2c//otA3rX5uSBGoXtG4uWBfyrJ1WWMujy5TksCGdptNdmHYPJvzUemDpKa KX9vpFKlWbyE7xVjkg2atWr2FEoRxJDeYUBfphrkeQMAJZ3HRpHr6MbOk1WMNYQ4JiNJ7p71yXx wy02DKYyQC3dKSOe+MFMlLezJ+bQthjLu+ssOrYUEjajU+tAX6vVH6IBynxgwScIE2kbfuupiQw 0B2lTIOXgasvpLQJNtldRFdEpqMVinoGl8G1XIJYvMUMFnf+98LUM//Z4yia0aUyyFKd7mEqXEU 1j54VkpuDmnG438FJsxig1yTA73MUSBMqBbVjtbgH7jpLAF7WrT7LJFbR7sEtvlkUxhe5Ip5B5r 3jX/xsaWmSITXAUq3SY6y247PqUxfVoSVZFRrrzLa2boUb+l4538a1EFMmR04DpMxi7GSmEeIIF HtUxO0sBGxK4IHQxigElrN/pSC1Zgess1ejhCFiLF5EWo8Du6es4qOlWRBCVHZZ2mhnPxppInDf xE2qCw17JkN14JQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. When an endpoint is being deleted, it is then important to check if its address is not linked to the initial subflow to send the right ID. If there was an endpoint linked to the initial subflow, msk's mpc_endpoint_id field will be set. We can then use this info when an endpoint is being removed to see if it is linked to the initial subflow. So now, the correct IDs are passed to mptcp_pm_nl_rm_addr_or_subflow(), it is no longer needed to use mptcp_local_id_match(). Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 605cfd7bc004..4000de54c99c 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -803,11 +803,6 @@ 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) @@ -842,7 +837,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, =20 if (rm_type =3D=3D MPTCP_MIB_RMADDR && remote_id !=3D rm_id) continue; - if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match(msk, id= , rm_id)) + if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW && id !=3D rm_id) continue; =20 pr_debug(" -> %s rm_list_ids[%d]=3D%u local_id=3D%u remote_id=3D%u mpc_= id=3D%u", @@ -1429,6 +1424,12 @@ static bool remove_anno_list_by_saddr(struct mptcp_s= ock *msk, return false; } =20 +static u8 mptcp_endp_get_local_id(struct mptcp_sock *msk, + const struct mptcp_addr_info *addr) +{ + return msk->mpc_endpoint_id =3D=3D addr->id ? 0 : addr->id; +} + static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool force) @@ -1436,7 +1437,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_so= ck *msk, struct mptcp_rm_list list =3D { .nr =3D 0 }; bool ret; =20 - list.ids[list.nr++] =3D addr->id; + list.ids[list.nr++] =3D mptcp_endp_get_local_id(msk, addr); =20 ret =3D remove_anno_list_by_saddr(msk, addr); if (ret || force) { @@ -1461,14 +1462,12 @@ static int mptcp_nl_remove_subflow_and_signal_addr(= struct net *net, const struct mptcp_pm_addr_entry *entry) { const struct mptcp_addr_info *addr =3D &entry->addr; - struct mptcp_rm_list list =3D { .nr =3D 0 }; + struct mptcp_rm_list list =3D { .nr =3D 1 }; long s_slot =3D 0, s_num =3D 0; struct mptcp_sock *msk; =20 pr_debug("remove_id=3D%d", addr->id); =20 - list.ids[list.nr++] =3D addr->id; - while ((msk =3D mptcp_token_iter_next(net, &s_slot, &s_num)) !=3D NULL) { struct sock *sk =3D (struct sock *)msk; bool remove_subflow; @@ -1487,6 +1486,8 @@ static int mptcp_nl_remove_subflow_and_signal_addr(st= ruct net *net, !(entry->flags & MPTCP_PM_ADDR_FLAG_IMPLICIT)); =20 if (remove_subflow) { + list.ids[0] =3D mptcp_endp_get_local_id(msk, addr); + spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); spin_unlock_bh(&msk->pm.lock); @@ -1592,6 +1593,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, st= ruct genl_info *info) return ret; } =20 +/* Called from the userspace PM only */ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_li= st) { struct mptcp_rm_list alist =3D { .nr =3D 0 }; @@ -1620,6 +1622,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, st= ruct list_head *rm_list) } } =20 +/* Called from the in-kernel PM only */ static void mptcp_pm_flush_addrs_and_subflows(struct mptcp_sock *msk, struct list_head *rm_list) { @@ -1629,11 +1632,11 @@ static void mptcp_pm_flush_addrs_and_subflows(struc= t mptcp_sock *msk, list_for_each_entry(entry, rm_list, list) { if (slist.nr < MPTCP_RM_IDS_MAX && lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) - slist.ids[slist.nr++] =3D entry->addr.id; + slist.ids[slist.nr++] =3D mptcp_endp_get_local_id(msk, &entry->addr); =20 if (alist.nr < MPTCP_RM_IDS_MAX && remove_anno_list_by_saddr(msk, &entry->addr)) - alist.ids[alist.nr++] =3D entry->addr.id; + alist.ids[alist.nr++] =3D mptcp_endp_get_local_id(msk, &entry->addr); } =20 spin_lock_bh(&msk->pm.lock); @@ -1930,7 +1933,7 @@ static void mptcp_pm_nl_fullmesh(struct mptcp_sock *m= sk, { struct mptcp_rm_list list =3D { .nr =3D 0 }; =20 - list.ids[list.nr++] =3D addr->id; + list.ids[list.nr++] =3D mptcp_endp_get_local_id(msk, addr); =20 spin_lock_bh(&msk->pm.lock); mptcp_pm_nl_rm_subflow_received(msk, &list); --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 55CDE1AE029 for ; Fri, 2 Aug 2024 18:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622674; cv=none; b=jHjiWtfYbdry90iTn+IidX2hFy6/MKLIIuwDrm4b0ILCGbCVIxDUaWDdY9irJqDb/eCmBEfoDEuo6Z0cuiXiLla68RQqAMVHRuC4VK5dwDSelEf+NLM076nbXJudK1ka9lZfvuWfpyXHlzQ6ki1su2Mrsa2ymzkLnND9KuaBvRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622674; c=relaxed/simple; bh=p+Iln57asuVn1sxGEGudit793w254/OS5jvagw/jvwA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dswMX6b/Q223apgjaXit8kTh6oWqORUCG6+vygjRRh3ktDkeXTav3j3629jkhwU1XCi1YEP00I+CuhCQWXB7MgaVNBcPiJmPZeDlWWQU1OGqNolGhdU6GyuDP4pP9d8kyQPIoseKQvBS/CosZhlzcw5BXdYqrbd+HRyO6AIolfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WN5GgbeV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WN5GgbeV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7807EC32782; Fri, 2 Aug 2024 18:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622674; bh=p+Iln57asuVn1sxGEGudit793w254/OS5jvagw/jvwA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WN5GgbeVQ/VSNVcBCodArosSRMrQkDe9oljtTK54Tv6/uUCPLIY5U/JrVVaEUc8g0 ihB0zG6xwKMYr4+L3DqBnJT2eQ2MNiks3t9qy+FaR5uz2sJyHIPzVfyObulBVfB0BJ TI4WQqAMHjiW92qLU3o+LHeXy0G3zRRbtNNu28lBy0Oud6GQoQR7sSN7L7mm1JfXFK s3ZsJyKcQV3GVkA6MsDvqjURcCCORqnSgv0h56fL07jvWNcxpXfZB6k8VQOc81yhLB KXlS/Y4+NqS3W5ePl0P5pV6LZ4W26JSedrhPHInEZ94+Za9cKsoRDc2eJ8gGw19FOt 4oSczszz0grwA== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:41 +0200 Subject: [PATCH mptcp-net v6 04/11] selftests: mptcp: join: check removing ID 0 endpoint Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-4-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2915; i=matttbe@kernel.org; h=from:subject:message-id; bh=p+Iln57asuVn1sxGEGudit793w254/OS5jvagw/jvwA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLL/7ejsF7vWxGYkFqf/TPqEdffHegRikW5C IrVptlJ0iGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg c/84D/9TY1mK6EE88dqOc+ujEJabmJ0NumbMrCKXOCjkg3LvcbNYUUmZFhGExagrwfQQjb8RbN1 LIgm+Zn7nVAtNO+hFLWmyCTli413TwfuVmHFNlj7Z//PQfnXlpXkQhAjaKgTPUmMUnJ0mD7kv0X xBucH2F4kkKYHoCyaIHhfjBA0Ta8kliv+5olwTm4jMXqkEKkE+NN66Ivc9QLZ93dp4SjkSvdFhK nqJ+Xe+NBXrabhSmFclGXRc29AKJC5wG1NYoIDx/rdT1IlM0sDJEkLIRuwoVmY9DQFxg9OqmcaQ BVMYHcEngFgM7d5ygnyXEg4o5mHKOg6R3lik8TaxrmVXfDGM3Dg3f1WDrbVjx95UZPo9NC/53jh dN0wa9F8VgRHGfpM/WbPLcQfBH7gONrF7RFJ8GLbqvUeRmwhFvd7QFXZc9nlS6AZxcCFQqnSczH V5+46la92b5C6Y1o7w4QoIYj8CkwNvLBqBFah0pJJyWz/rbu5WTrfYyI1bnOL612D6rkenh62jU Wk7n12KIjqpzjQqru8HGgwIuxitJ3NQctGZfmMDN1Pc7/HHL4PpkBLhVDIE94TjFOzo2bhyt/Zx RtHiFoZw9q29EdhbmrETymBjjSgdYWUkq95kU/R5c5JWTcCOEdFXspLFQcodkhZSu9jdSMzB1p8 kh1Z18wriG03qBA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Removing the endpoint linked to the initial subflow should trigger a RM_ADDR for the right ID, and the removal of the subflow. That's what is now being verified in the "delete and re-add" test. Note that removing the initial subflow will not decrement the 'subflows' counters, which corresponds to the *additional* subflows. On the other hand, when the same endpoint is re-added, it will increment this counter, as it will be seen as an additional subflow this time. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 01c1e0871aca..03d92852de8c 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3554,8 +3554,9 @@ endpoint_tests() =20 if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT && mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then - pm_nl_set_limits $ns1 0 2 - pm_nl_set_limits $ns2 0 2 + pm_nl_set_limits $ns1 0 3 + pm_nl_set_limits $ns2 0 3 + pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow test_linkfail=3D4 speed=3D20 \ run_tests $ns1 $ns2 10.0.1.1 & @@ -3567,27 +3568,27 @@ endpoint_tests() chk_subflow_nr "before delete" 2 chk_mptcp_info subflows 1 subflows 1 =20 - pm_nl_del_endpoint $ns2 2 10.0.2.2 + pm_nl_del_endpoint $ns2 1 10.0.1.2 sleep 0.5 chk_subflow_nr "after delete" 1 - chk_mptcp_info subflows 0 subflows 0 + chk_mptcp_info subflows 1 subflows 1 =20 - pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow + pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow wait_mpj $ns2 chk_subflow_nr "after re-add" 2 - chk_mptcp_info subflows 1 subflows 1 + chk_mptcp_info subflows 2 subflows 2 =20 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow wait_attempt_fail $ns2 chk_subflow_nr "after new reject" 2 - chk_mptcp_info subflows 1 subflows 1 + chk_mptcp_info subflows 2 subflows 2 =20 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJ= ECT pm_nl_del_endpoint $ns2 3 10.0.3.2 pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow wait_mpj $ns2 chk_subflow_nr "after no reject" 3 - chk_mptcp_info subflows 2 subflows 2 + chk_mptcp_info subflows 3 subflows 3 =20 mptcp_lib_kill_wait $tests_pid =20 --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 998D91AE029 for ; Fri, 2 Aug 2024 18:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622675; cv=none; b=TYWJTN6898jE2w1waA/003B54WyUXP23Pd385qR1/VhRu0SnGK1O2/rsTx6+4jHgXZcrnAuiDC4jZR+gTTUbNS9AoS4gjrASb63v8iIk3hJ4nOgaczdwP7tWlvCgV93ikcunB1sM7AUQsF1swY6vNdkWiCTrwFtj5H3xEHsgfKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622675; c=relaxed/simple; bh=p+sXssKBRXuyrzTaYzPkdWCwoZsrUTtNBWkEogLEWD8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NGeCeq6uMqYps+gpN1PCVeU7A8xDtvM1c/yBWb6bhQrInErndc5yqi9iqzJJYI5ZY12Modp+h+UUmHZdQ0XH/tvbyRdREhx/vTc/pAeCcW2KntKY0aA2uU8EDzOz8dezHhz1SRAS1NhCPbeRVzb6DyhETruwz+7P00Dxfgkxhi0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZnWJmDak; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZnWJmDak" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5E32C4AF0A; Fri, 2 Aug 2024 18:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622675; bh=p+sXssKBRXuyrzTaYzPkdWCwoZsrUTtNBWkEogLEWD8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZnWJmDakmYJczPTgxi5qavfHjuQsh5g+AUSibPLJ5hwX3dQ5HSrNEwvxi8HfwL6/k DQd1Or9ChgzV/LzcJLnrwevSboQMkAgcAKiL8q0soegsvyjy5WpR+yEkoW68hMWCHI HXjvD1dtcvCVmpTFNfQE3gXfXE/L1o5KZE1Q1Pxx8SZEyFAVKzCbpww46vH7DMfYKC yGuvrANPvis9APPmhirLZbM6uMeSs0FgeMnbyfHbss+S9LBw1rAYzerCVkWr33H9f4 OYCJ2Y0UTnu5V9fM75ZPLwdqbvyXh1Kw8JgSyHg3meFpsNmn3n9/MPvO70qdsBrici iK1YCCV2W4qoQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:42 +0200 Subject: [PATCH mptcp-net v6 05/11] mptcp: pm: send ACK on an active subflow Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-5-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1191; i=matttbe@kernel.org; h=from:subject:message-id; bh=p+sXssKBRXuyrzTaYzPkdWCwoZsrUTtNBWkEogLEWD8=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLL/0wqM++GZ36mKcdZT9ITSHDT7Q3zdZXzp LGRQtJTQBaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg cz30D/97tFh266UPuc8n0HekeOzS7SyqPvJb3OR6fGVNsA6vLpOB8KrkB9i0RZPK1y1byRl3WRp I+QP0Smp2no/8eOS5urf7j6ScmUvPouYsHA5CDf1Ia7ntpGxQSPYmmUgd7xcEsD32MVSHs4P6oB nszrN7HY619y2esbMsBap6QXHXWJRJKLelbeBUySVlFOXtzDcGf/RUhtlVvR+UPDnWsgFBK7l/g NBmsArjpHCxKGoP1/NsSE4zV/CRWS2qo6ynCepdFKSF0irO2/hrDKgioSCvkzeVBQTwQ4yeHMLc EQnQfYNhuE7Lc+vI/03+TgtLfZVG4ntdZSz6TmwUNpSFoyCEs+jIgpvKJCVlORoBsQEaivhvaSA O3AHFnUzJ3TgQoEH7/uUgtLlW5JyjAvchkJulWR/aHFBUqghuk0SBI0gpbmW+vncupARdIYj57Z sb+E1iGGPXsXKw6avRH0PfYDIpjRQRvYMoCdHRkY/jmCaL4o5g5uUwS9sXWjjORz2wffDK5/hpL UW19q24wIRytXuAjhdu3a+68MANwquchIVegY1ESpGK4hkLS0WrFNJUEBJhBzSLT6UoIy2b8qDZ rUm/LHmK/3TgSwLtQA+LmsQFFYen13XHY8OyTd2O8L7BKXp4QjQ5+rwihI/gGw4o+D36tbhpK0F aP9cIiMvisF9WNA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Taking the first one on the list doesn't work in some cases, e.g. if the initial subflow is being removed. Pick another one instead of not sending anything. Fixes: 84dfe3677a6f ("mptcp: send out dedicated ADD_ADDR packet") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- Notes: - We could also check if the subflow is not "staled", but probably best to do that for net-next only. --- net/mptcp/pm_netlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 4000de54c99c..e25cda3909fa 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -768,9 +768,12 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) !mptcp_pm_should_rm_signal(msk)) return; =20 - subflow =3D list_first_entry_or_null(&msk->conn_list, typeof(*subflow), n= ode); - if (subflow) - mptcp_pm_send_ack(msk, subflow, false, false); + mptcp_for_each_subflow(msk, subflow) { + if (__mptcp_subflow_active(subflow)) { + mptcp_pm_send_ack(msk, subflow, false, false); + break; + } + } } =20 int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BD4931AE029 for ; Fri, 2 Aug 2024 18:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622676; cv=none; b=IpfF/pkglQehGovmL0Jfb82cQ4WFgxPNgQlJbC9bSpF0dMH9jrXGzXTSCqdCyuj7y2FNJCHx6NYtNTsUweYJei6iLn0uIk4t3eP0yyTP91g3AKMXobwC4jSz3CSEkTJE7bGw0lsnzooXkhSu83E3r05+2vkrwEUkHlWg1mr82Dg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622676; c=relaxed/simple; bh=N/NPnhcQPnAPZfoOqFH6c6mKbbgnh+lc7bsdqmg8gZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NhiYOeiAS9S5p8MDkNJgjPWpR0DoF1veGHT2vJiC+pSnxYTp2gNRIWQ8t5W21Pfb1ABzdX16OujlWuEvZC3QWw30cvO0FyoD1Jj7w56f/a6bIz7FK1vPzgrh9Qllyz1n639CeEiCORSraS6wzLL9GG5fHCrIg0CH7q011LiglyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MNkm8Ap8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MNkm8Ap8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4AC2C4AF09; Fri, 2 Aug 2024 18:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622676; bh=N/NPnhcQPnAPZfoOqFH6c6mKbbgnh+lc7bsdqmg8gZ0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MNkm8Ap8GWjTpj6fh7EStVfL3nBJfmF52AFM312JBFNUicxxSSwZf2B9BhLZ27mAN 7b+8V5K6jQv7L/HXeStZVa36woa7DnigBjtD5NVJTbs9NxVI3dmE1sRyHb+tmnt8jK W5EfpzYBWGsMwKh3V3Mnhruo3kMyWv7lZjwod6q6D6vnOGQqmHrouDt2NWaQZ4qiag p74ATzk7qXw6w6lQcRGRw2vkKpBB8kiFDwbtPhaga4HSn6GZFwGrY8QNOuIdc4juJR 71NI5Pp6S++O6gFvISqM+dCMPsEGjRj44ntAb259hLpZ3SCDXwS2BfmGs8amNCOOx1 lX2XAjRnNL4RQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:43 +0200 Subject: [PATCH mptcp-net v6 06/11] mptcp: pm: skip connecting to already established sf Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-6-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1709; i=matttbe@kernel.org; h=from:subject:message-id; bh=N/NPnhcQPnAPZfoOqFH6c6mKbbgnh+lc7bsdqmg8gZ0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLyU5r6LBzNUjVelJFxVsKyRjvj+6cFIyO1 kqXJ1jJuF6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg c0yPD/9HI6nTkZmMuF0MXrJCQzQBYC1F8+Zl4R3h1xqY0OJv5QPOi0AadsA3A7f4C650jgLrtEc Wy959a9M+yDtLdOzQbXVkDUZBS+E/OPpgc20wYyj5rKs1veRTiK5uuNm81mezHPaUR4CvbFvk25 zmoT/fZUUqjvrLmJibPk6cGYcKUsVsmRs4d93w6X++A0eJgdyRPzUIsw1YyeUXTsypG5PvwVcGu L43oKaVr6Bs9fHJ/tYU4vaiSBOkaGzQ6yk3d37StOOjLY81xPGgDG05xtbvVFfqFngNvsT2mgVX rEAdv85XZ3j+8qV3tV3xT5BNh6twIaQeyxs9hr8CCvhESXM+eBc35UhWXUyb4/fa8JgOcSJfTLz QOFhnEJF6t15cM6iIgfOO3JW9yi1xohujieWT/j4HohB3eTq3kFC3bTEAImh17Hc4McBl+10LDt r/TXZWdGqxt7XwlpGMn4wNfBb/OL3C9GqqWrOvFRDeq9StBmM/u9Q+RG1+c+FDYfVUEtxGUyQ/B xAkfTb9ib7hebp13LgMPThaCLBXouj4HbDy5ySemrpAF0Duqt5MMSADpb1bChFSC80V/bIohLn/ km/mWWfqwfoQc6jmRJvcscpNOCimtBJxNgHnL/+0H99y5GcYjzEIzognaJzVTzKwM2qrt7AUFl+ 41EGPV7LGhO3FfQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The lookup_subflow_by_daddr() helper checks if there is already a subflow connected to this address. But there could be a subflow that is closing, but taking time due to some reasons: latency, losses, data to process, etc. If an ADD_ADDR is received while the endpoint is being closed, it is better to try connecting to it, instead of rejecting it: the peer which has sent the ADD_ADDR will not be notified that the ADD_ADDR has been rejected for this reason, and the expected subflow will not be created at the end. This helper should then only look for subflows that are established, or going to be, but not the ones being closed. Fixes: d84ad04941c3 ("mptcp: skip connecting the connected address") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e25cda3909fa..5d66f6b1d58c 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -130,12 +130,15 @@ static bool lookup_subflow_by_daddr(const struct list= _head *list, { struct mptcp_subflow_context *subflow; struct mptcp_addr_info cur; - struct sock_common *skc; =20 list_for_each_entry(subflow, list, node) { - skc =3D (struct sock_common *)mptcp_subflow_tcp_sock(subflow); + struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); =20 - remote_address(skc, &cur); + if (!((1 << inet_sk_state_load(ssk)) & + (TCPF_ESTABLISHED | TCPF_SYN_SENT | TCPF_SYN_RECV))) + continue; + + remote_address((struct sock_common *)ssk, &cur); if (mptcp_addresses_equal(&cur, daddr, daddr->port)) return true; } --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 159961AE029 for ; Fri, 2 Aug 2024 18:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622678; cv=none; b=MdktprVHZ+QpM+hFZC/oDmx7BiXzhPR6P3bDIxF6tzod4uDPKX2dwTV5rgRbwYC1+QSTKbZRK1BbLsLtuu8QcqM7vSK0iEwwB5Oz2N7vzxEjdo/4RCx7geg10/gaCgyS+iAwNk3AYcytsqkckZK5q3esIAcS9fv4cpvHmhTj3WU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622678; c=relaxed/simple; bh=83Yc98aUb4dJcBaxvFPw/vmbUFQ1FzmjsqRrIZAKJLs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cu5/EK6ihZXVvCZsOJ6I57l5285hxkIIeIXva/RMH2izvwN/HnGx1eK6P+enoAyKr9GxJSSpve2qsNH8iuM7LjaCLPIplQ6Y67Uq+vPtWG9pCYW6zAc5p6K7/5VMmWVLmddDJ6s1lR1BlTTf2K6eI+L3nI5cmXtLCREwy8NH87Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qPLeuqFE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qPLeuqFE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D7CBC4AF09; Fri, 2 Aug 2024 18:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622677; bh=83Yc98aUb4dJcBaxvFPw/vmbUFQ1FzmjsqRrIZAKJLs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qPLeuqFElK1Xi+kIieCPpfqaIBZ5zOdAElIzuKIPqc71d972WdRKP9vWuq+w+10c+ P2gHcL+R6NMConAGSv5Gch1+HJIBp1PBxZt0q1wirHnwbyZoFXvb129tqHOYIdq0Ao V/yvC+qf1yO1Nv/KUcXyenC1Mz9EjRawPsbRc9MSpBHmJVXOjcDN3WwBezdqhMlWFs lJffjgUySVS/ukuXMr5SBgc9NOQqkWexKCPMUP9zb3qEl/86/T2ZuO4ADt+mE6NKL3 ktZ6vWjqrXiGNl6+tInC2RU6LWxreG+FN0Axqv3gX92jV5+ErXmuhqCXxDnutqWfak NDkLfOSwLeMew== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:44 +0200 Subject: [PATCH mptcp-net v6 07/11] mptcp: pm: reset MPC endp ID when re-added Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-7-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2668; i=matttbe@kernel.org; h=from:subject:message-id; bh=83Yc98aUb4dJcBaxvFPw/vmbUFQ1FzmjsqRrIZAKJLs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLCpO7h+qwcm73EHmpJgGIhsRjWkC1MaAOH Pybz/jW/SeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg cx6lD/4zlw9++OcWOLrkbr0XAIek7T1nar5UXuTeyTI/aVPEoO2gDwkw4vXobpb503M8y5xPe8c 5/JyL6xfTqI/JtYdGbD8lm/eelEiPucDEFVcno9N1GwD/fjaVdel1LSlP1QUYGXrGp11I3f0X6p 0Lm9MvuHWFDYwBerNENwLwS7vs1M0boXIKy5lkWCD0py7MUeyIa871NxXXLYO4vRoD/WvFal3Tw Cyss7/Sy+FWyd9HSu6Db+5syfw8qDlDnCf/YYUm36ljY+mDafVr1kNSVTz2Y1pa0jY64fFvdD4Y 3WLJhONLh0Lku0tncNBxOzxSVqxG2TYNo2sXTq6lQ7nSKkUyj9lidCmbn8RjBX7t1HagIRWlyId cJwanBB5gsXe+uVvx33PGavnEI/lSWXhcdcwhk1c6qg4/TgxS6Ay0rLGDs7tVVYWogK49E0Vxgw 3r1gsMSmsVnUZKQtx+2e2/HpFKdr2LCnba1JqqzLLo7MQ5cXWrTT3HPgok1siMtSwsIZTVjdVTV rDDLE2fvgArKhGMw3kFoQ0MZB0MOrYu/Cj4V4mYb8Ya7mSx05uKFrZq7G/dmDBLIDogHn73SM8O h0x8DWghH8AKw4Q9a6u636fvbQdFrmLwuePC3EFlxoboZnwVGE1WZGzFVRuy997G4vObDO1PC2C dBvkkN1cX90Fz3Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. It is specific per connection. When a global endpoint is deleted and re-added later, it can have a different ID -- most services managing the endpoints automatically don't force the ID to be the same as before. It is then important to track these modifications to be consistent with the ID being used for the address used by the initial subflow, not to confuse the other peer or to send the ID 0 for the wrong address. Now when removing an endpoint, msk->mpc_endpoint_id is reset if it corresponds to this endpoint. When adding a new endpoint, the same variable is updated if the address match the one of the initial subflow. Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 5d66f6b1d58c..d3b1b459e6f3 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1321,20 +1321,27 @@ static struct pm_nl_pernet *genl_info_pm_nl(struct = genl_info *info) return pm_nl_get_pernet(genl_info_net(info)); } =20 -static int mptcp_nl_add_subflow_or_signal_addr(struct net *net) +static int mptcp_nl_add_subflow_or_signal_addr(struct net *net, + struct mptcp_addr_info *addr) { struct mptcp_sock *msk; long s_slot =3D 0, s_num =3D 0; =20 while ((msk =3D mptcp_token_iter_next(net, &s_slot, &s_num)) !=3D NULL) { struct sock *sk =3D (struct sock *)msk; + struct mptcp_addr_info mpc_addr; =20 if (!READ_ONCE(msk->fully_established) || mptcp_pm_is_userspace(msk)) goto next; =20 + /* if the endp linked to the init sf is re-added with a !=3D ID */ + mptcp_local_address((struct sock_common *)msk, &mpc_addr); + lock_sock(sk); spin_lock_bh(&msk->pm.lock); + if (mptcp_addresses_equal(addr, &mpc_addr, addr->port)) + msk->mpc_endpoint_id =3D addr->id; mptcp_pm_create_subflow_or_signal_addr(msk); spin_unlock_bh(&msk->pm.lock); release_sock(sk); @@ -1407,7 +1414,7 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, st= ruct genl_info *info) goto out_free; } =20 - mptcp_nl_add_subflow_or_signal_addr(sock_net(skb->sk)); + mptcp_nl_add_subflow_or_signal_addr(sock_net(skb->sk), &entry->addr); return 0; =20 out_free: @@ -1505,6 +1512,8 @@ static int mptcp_nl_remove_subflow_and_signal_addr(st= ruct net *net, spin_unlock_bh(&msk->pm.lock); } =20 + if (msk->mpc_endpoint_id =3D=3D entry->addr.id) + msk->mpc_endpoint_id =3D 0; release_sock(sk); =20 next: --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 190351AE029 for ; Fri, 2 Aug 2024 18:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622679; cv=none; b=RGcsW/DPJxchBgGIXdjohOo8oJ9p0DhXzcn8rapS/q5OffOop7+ypmKjCePOcprRfxdXbgkkOgTNbVJcJPCRrT2S0J4gRdStDrUz/+CxHRhkt/VK3yC9QqKakSwseiJ82qlvLY9BShPVPNYbfOMlT22b7HbDZtAZxelCiLPAAf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622679; c=relaxed/simple; bh=tf/wGOPhQYLV/T6rpzCr5ZuOds7ZUF/LJXfJO8rTvMY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mxS3irqfGTbHQQmwUV8z8rrcnNjbRg3sXcR1KuEIO6L1LrduCmgCuzGzLYa4noCGkAO3rh1b4Q/pyDKAsXgfQtDM2pW6AzQdB84AV4JpR0r3y7zJEHdEMKO+CZlH97YrS4FM7w7f4ZtNH9j9l5JsxDMrEu8iK6PVPU6+Gpvy5qg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E5FNJAyY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E5FNJAyY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ADBCC4AF09; Fri, 2 Aug 2024 18:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622679; bh=tf/wGOPhQYLV/T6rpzCr5ZuOds7ZUF/LJXfJO8rTvMY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E5FNJAyYoA6TUoBpxErtk/fvyXoJ6AM0EuOI38VkCZniOUbyT5TATGfgzSHlg9Xjn FFu1p29Kvi/pQgaSXQywWn8OZ4S9RXh17Om34yRI1oDL4Tn+f9sV1nML7E4WV1ASgN EA2QNCjPNR5tLOS6YQonx1+iPvHhFcHuV+aAS1/PaqiMVj0fqUMhX3rBREPULPJlCg HIy8I+4yxKOgMDj5fydlwPyZnuWtAI1Zx+9LsUWR6UUixRx7Yfvmxhma8fOAoKGOdJ WDdTO56AxMdDQwsoDkqJaebjD7oJE8S4wiowH8GTTn5FfrSl3rnCg1I9Tl4bf0T0jp OY58fdchXUoBA== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:45 +0200 Subject: [PATCH mptcp-net v6 08/11] selftests: mptcp: join: check re-adding init endp with != id Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-8-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2666; i=matttbe@kernel.org; h=from:subject:message-id; bh=tf/wGOPhQYLV/T6rpzCr5ZuOds7ZUF/LJXfJO8rTvMY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLV4TPmUKAVIvLt4fw96WIi8sWP60NEXMBH ZzfZG0r04SJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg c6+kEADcEcXmGUVg3BNeI/x1Fe+CxutLqQ9VMDJvX9WNhO54YplJX/7HyKHiLlQo32vuy+1cK/g +VMfWdNb+rGkHifANM8AUE2VRrRByeHkTs886MEDzaC3MJ38LKeVIvJwDk09Z/B4sB782Cww3gu 7KTcdooh0nBIbHx+W1gLa3lGSGOCV5PaCzIWedctE7L4NB64YeezwABxohm/88/1F5rtTJknif4 VMY8XI1DVD4ttSrBY8XnOqJmJWukccSEKpd8SJ+59I7p2egNL/Ssntd3dWRkHkkoL5foEPC4KID SKMYfFQ9bWYhZEZOVKzjldVW8Z4NCBGQ8O0rPBBU3s8dDDEC6Lb8JC8N7xQ/EzO4qWBIjUlHDRq SIyQv9G8hEB8zY0YqmHBKM8rh+gTJ2LzM6Xo5xoEQDlE269BwwpotWEcFx1xv8VJyivazPKYctr fcuopu+GTM+GZIjqlckUpUZ8xLUUBjhoa3J7a8QrSUCPXGUheYr8wBmKSmWl3SNL6CyrHaZJzmf syph/oA3gxHpNkIms43SiYF/uMI+OL1nHFe1q4rAuDDBKWl+A8FOvO4pWn1ayp02/9W/GQnlR6x Jmo8UX+E+fzMVDRjiFHHV9hQQB1nTf+fezq0qeifAnD6gGlfaZRWZOliiF/363q7/FKdJdPcMCF n/OR9YI6aA/8aTg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The initial subflow has a special local ID: 0. It is specific per connection. When a global endpoint is deleted and re-added later, it can have a different ID, but the kernel should still use the ID 0 if it corresponds to the initial address. This test validates this behaviour: the endpoint linked to the initial subflow is removed, and re-added with a different ID. Note that removing the initial subflow will not decrement the 'subflows' counters, which corresponds to the *additional* subflows. On the other hand, when the same endpoint is re-added, it will increment this counter, as it will be seen as an additional subflow this time. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 03d92852de8c..ea954ba85969 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3599,11 +3599,12 @@ endpoint_tests() # remove and re-add if reset "delete re-add signal" && mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then - pm_nl_set_limits $ns1 0 2 - pm_nl_set_limits $ns2 2 2 + pm_nl_set_limits $ns1 0 3 + pm_nl_set_limits $ns2 3 3 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal # broadcast IP: no packet for this address will be received on ns1 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal + pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal test_linkfail=3D4 speed=3D20 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! @@ -3625,11 +3626,21 @@ endpoint_tests() wait_mpj $ns2 chk_subflow_nr "after re-add" 3 chk_mptcp_info subflows 2 subflows 2 + + pm_nl_del_endpoint $ns1 42 10.0.1.1 + sleep 0.5 + chk_subflow_nr "after delete ID 0" 2 + chk_mptcp_info subflows 2 subflows 2 + + pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal + wait_mpj $ns2 + chk_subflow_nr "after re-add" 3 + chk_mptcp_info subflows 3 subflows 3 mptcp_lib_kill_wait $tests_pid =20 - chk_join_nr 3 3 3 - chk_add_nr 4 4 - chk_rm_nr 2 1 invert + chk_join_nr 4 4 4 + chk_add_nr 5 5 + chk_rm_nr 3 2 invert fi =20 # flush and re-add --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 45B4C1AE029 for ; Fri, 2 Aug 2024 18:18:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622680; cv=none; b=pgDhw1J2ESl4GucZvaGJYpFfte5PL/5PHk2xbCC5Q9ezSEuGgwZBvHSW+4YpkbAd22Hkc3PG6KrxDH0K3fF1eokHnwdl7MbNX+gaO1bqhIfRJThMwaCqMiy9W7xOXDO9zO7Qe+tXh21SOU4VYmSRUvCsaMIe82jqSz4xe4gcs3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622680; c=relaxed/simple; bh=KFd87TzFgoUXwm2i13o+sx1nEl0pAg0CTX7sVeZay3A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c8e/uCa76P4zpCE6rDZ3AsBcobtchBwLDDQtQzARVmqjU5L9N0Yn55nx9qYl9CdD5gV1SlIafFdfYKgv/xP18yyvtqYD/Ks+e6ZGOTyTZLjNOc4aB4GQopc5Zl9duNV7X04fK/5ajPKfvkOOoZMCMRceEtqzCl7mDIphbdxxRaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hYsLYCKk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hYsLYCKk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A509C4AF09; Fri, 2 Aug 2024 18:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622680; bh=KFd87TzFgoUXwm2i13o+sx1nEl0pAg0CTX7sVeZay3A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hYsLYCKkAMoGfyX6qqxAj4CWWWxe/881+aZCJMGdpu90gTcPSUizFjd6goP8vJWJp IDXsC/3LuPEtQO8+fCGT2N5sI/ZdYH6OAD5UKqkR4z7i/gtAqNwCD4ZxS5PHeADo/5 2qpatg0uM6rJZGZfKuKwm6KcLzB3D0tL8OUOcZ9TgIxxPlRezdBUOaAcFs+ockoxvn rmmiqiBnbrqp5y5YfNPlqtxDY4s6W8aCnmTnk3fArLufrLt4bsv8OKmVLr5yfxXg7H Sy0pbX0EcCJ/n2WtvEggRwUVzjEt/V7J1qKQZairYg8mP4qd6CxzL3BCydnjgP2arI VQkzvS4ZBAprQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:46 +0200 Subject: [PATCH mptcp-net v6 09/11] mptcp: close subflow when receiving TCP+FIN Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-9-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3163; i=matttbe@kernel.org; h=from:subject:message-id; bh=KFd87TzFgoUXwm2i13o+sx1nEl0pAg0CTX7sVeZay3A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLbpYjThkcbZ88osKQAh1OWfvqQGMBSEUsj PRVRGz+PbSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg c1fHD/44+lg51db9MycsPRSFj7PnPdhrtRgLe0vipZje/cmu0bq4eXW0sOJLMxBPj9vH75eK/im OvUfaMVsh3WoZ3fMdJJ7FCluCe2nNkh8BwiAVm0OrhQ9WgZPNFqYoXXmF77brobvmBuUzGdIYFp i6uIfqug6yHSaViWYsq/ZSX/guzwAdpDX1oSzEZlrp3GCWg9ijD84yXh91+KhC/QtM+tsUCM5D6 vgWkGFEcYgPRG6cQNzgUartgnUU/6upqyOs02tdRle3oqi1hCJulVFr6cqsnTJ8YxcOIP3gaceu IlSfWD9aLeGoGsuFZOeOItl+isbLBAedCe50MBH7x9h/B2IPCb3ryd2U0np+JibV1ZoD+4YW34h 29RJRvf9o/ZjvBzmyc8Shm66VRQy3Itn+WkYLr6LwOugCy06F3cQb/llWmybEIHHyQdbETbiouZ 2kHlp5knAZSxKlY6sor+PA6oB3a3exRsZ2zsN+koe+w02qUOdvCOTJwsy4TFYycVuSUu9npbUZf eV1aAyNRtjUudIh2iuh7hsqU3XnDG6CU/GHf1Mjr7Fv77YmA/GSQcahWhwCeJLqR/CVfPcfBNA8 T5etE7YpDkOCTcYjQnFuooZcmbNrUj2Y9doIaMRnF0BoMm8k0WyTkxZVy4Nt25NbXQRhz0zq3g2 /tnSG7qx/XkVu7A== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When a peer decides to close one subflow in the middle of a connection having multiple subflows, the receiver of the first FIN should accept that, and close the subflow on its side as well. If not, the subflow will stay half closed, and would even continue to be used until the end of the MPTCP connection or a reset from the network. The issue has not been seen before, probably because the in-kernel path-manager always sends a RM_ADDR before closing the subflow. Upon the reception of this RM_ADDR, the other peer will initiate the closure on its side as well. On the other hand, if the RM_ADDR is lost, or if the path-manager of the other peer only closes the subflow without sending a RM_ADDR, the subflow would switch to TCP_CLOSE_WAIT, but that's it, leaving the subflow half-closed. So now, when the subflow switches to the TCP_CLOSE_WAIT state, and if the MPTCP connection has not been closed before with a DATA_FIN, the kernel owning the subflow schedules its worker to initiate the closure on its side as well. This issue can be easily reproduced with packetdrill, as visible in [1], by creating an additional subflow, injecting a FIN+ACK before sending the DATA_FIN, and expecting a FIN+ACK in return. Fixes: 40947e13997a ("mptcp: schedule worker when subflow is closed") Link: https://github.com/multipath-tcp/packetdrill/pull/154 [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- net/mptcp/protocol.c | 5 ++++- net/mptcp/subflow.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 13777c35496c..609d684135dc 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2533,8 +2533,11 @@ static void __mptcp_close_subflow(struct sock *sk) =20 mptcp_for_each_subflow_safe(msk, subflow, tmp) { struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); + int ssk_state =3D inet_sk_state_load(ssk); =20 - if (inet_sk_state_load(ssk) !=3D TCP_CLOSE) + if (ssk_state !=3D TCP_CLOSE && + (ssk->sk_state !=3D TCP_CLOSE_WAIT || + inet_sk_state_load(sk) !=3D TCP_ESTABLISHED)) continue; =20 /* 'subflow_data_ready' will re-sched once rx queue is empty */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a7fb4d46e024..723cd3fbba32 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1255,12 +1255,16 @@ static void mptcp_subflow_discard_data(struct sock = *ssk, struct sk_buff *skb, /* sched mptcp worker to remove the subflow if no more data is pending */ static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct so= ck *ssk) { - if (likely(ssk->sk_state !=3D TCP_CLOSE)) + struct sock *sk =3D (struct sock *)msk; + + if (likely(ssk->sk_state !=3D TCP_CLOSE && + (ssk->sk_state !=3D TCP_CLOSE_WAIT || + inet_sk_state_load(sk) !=3D TCP_ESTABLISHED))) return; =20 if (skb_queue_empty(&ssk->sk_receive_queue) && !test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - mptcp_schedule_work((struct sock *)msk); + mptcp_schedule_work(sk); } =20 static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 742BB1AE029 for ; Fri, 2 Aug 2024 18:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622681; cv=none; b=gJwuIhaQBcEHOvP5vDs4BGOfNQKtR1W+CSFyuPJIqVdFXJ2JjG4BRd69aflNbBqtGBnxBsy05S1k2LBRAkD5pSD95MB1vhuLlOHSRglxgUTWu2hvrfu+QEhpqXZFDtcu7KuKtKgwAbOjSrunWGCio3hZGVUeBvEJmJQ3IbJSHf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622681; c=relaxed/simple; bh=uqVY8DJxuKMUGQ8qwOhYGldndoYxnBe7QFO3AYQEHtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DyHZhm1D1x6HylTkmg56GaAWnx1vaP9Tgstj3YXB9dIITD/tIua3sYyZfFxhIMjmWi6lyPKHB6hRrmog002h3xLiew9/Ijpl8Cjx3mO/eTHg9pZvT+vLJNtwQZ8GmHCk830qcdvXVs4y+pc2IRehYCmByBOWy1gZDcP6C+NKS38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IBzaWzUP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IBzaWzUP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 984E1C4AF09; Fri, 2 Aug 2024 18:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622681; bh=uqVY8DJxuKMUGQ8qwOhYGldndoYxnBe7QFO3AYQEHtM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IBzaWzUPzP63uaqNh4E45+MY2G6BScCOMfyg5/j6d/LjNEVgVMXXm5PERu4oMG0vQ QKAJSYL4IIoIYcCDjaeI4r3ISj+wMRZwwnPGWwPS7QWkeepDDV2vXB0PYBsCObfITb a1AfGTgqr36ecZYO1wX237sz9qexV3PaivAWwKTzI0dJ9O1SW4aJA57gsTxXS1KbcN NrFhKEgTDzk1oANJmvhqrV2/H4biQ1xAJQBkT0AfisNRZDOLD78JRAKI6svsWnHhJQ 5Xn66gaP9BDpTyk6E4GBu+NINYs55nNsShx7q0x1nmj6nCnZcrp8CmKo31HE9FFqbY 5oy3w7kh7E2Ug== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:47 +0200 Subject: [PATCH mptcp-net v6 10/11] selftests: mptcp: join: cannot rm sf if closed Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-10-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2976; i=matttbe@kernel.org; h=from:subject:message-id; bh=uqVY8DJxuKMUGQ8qwOhYGldndoYxnBe7QFO3AYQEHtM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLw7qFeLyun9p0oFHuvYQSuE2yCk8UTjB7u 0TAbsNufiyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg cx82D/oCmYXHkorbPDfuwxajmGU9OC6bMjtCLhD1oVshCOhxJFVJHpGuQDDQorgNsB9zKnpxrpt pe5ZUjiyAr90o/+tciidAqsVxA8ZJNdqGggbDWa8A8FV0M+TMjdtz9t/cECeEcdsfqHVbHnAzRc yh9MdTMtRpYUgGk1JuZ4kiswTz1mqJhTqjOSGF1oVktTqN8Z2udh2pb0lJNBCvUx8vhkba3PXXa HwT2E4AWUQUylKARdmwV7JIldXx0C0QXNIFzflKMA6S2/4n4WC3fwA9+5sGzy+qiEWO/DLMDP5U TqapA8HTCSRLHt4Dq+MQOCowYD38sOGcowW7cxFGp4ztZOd+oLcIhppJznDTs46G48C1H2oBT1f Uk53Jj7zQ14tL6RjK4CdCUhMW2+3TAWrszD33L2ein/w7JNHajZ0BJ+SsshEIAtFYymuBh5k8nb Cc4yoQ88BVRz0JhaLTt/BLghsWrJwqD+646+jw3lESjmMbz0S6lJHizg3WxAUYJptGYN8iXDPzm zSMuL2QaxLn7tWxLnLni70hT8sGKlP6fNnT8BVo86BNldZLZi8xMz/Vy5g1x7eBkglUQSEvhGQW /WleFAy6DKhRoCTx+zFpCGsMONWKyd0qy/yfo/hblh0QAUWcP7U1f/xj33uZF0cmD2ePzaTOaGN kRE6RHFSSE95pJQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Thanks to the previous commit, the MPTCP subflows are now closed on both directions even when only the MPTCP path-manager of one peer asks for their closure. In the two tests modified here -- "userspace pm add & remove address" and "userspace pm create destroy subflow" -- one peer is controlled by the userspace PM, and the other one by in-kernel PM. When the userspace PM sends a RM_ADDR notification, the in-kernel PM will automatically react by closing all subflows using this address. Now that the subflows are properly closed on both direction, the userspace PM can no longer closes the same subflows if they are already closed. In this case, an error will be returned to the userspace. So no need to run this command, which mean that the linked counters will then not be incremented. These tests are then no longer sending both a RM_ADDR, then closing the linked subflow just after. The test with the userspace PM on the server side is now removing one subflow linked to one address, then sending a RM_ADDR for another address. The test with the userspace PM on the client side is now only removing the subflow that was previously created. Fixes: 4369c198e599 ("selftests: mptcp: test userspace pm out of transfer") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index ea954ba85969..4129952fd9ec 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3408,14 +3408,12 @@ userspace_tests() "signal" userspace_pm_chk_get_addr "${ns1}" "10" "id 10 flags signal 10.0.2.1" userspace_pm_chk_get_addr "${ns1}" "20" "id 20 flags signal 10.0.3.1" - userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $MPTCP_LIB_EVENT_SUB_ESTABLISH= ED userspace_pm_chk_dump_addr "${ns1}" \ - "id 20 flags signal 10.0.3.1" "after rm_addr 10" + "id 20 flags signal 10.0.3.1" "after rm_sf 10" userspace_pm_rm_addr $ns1 20 - userspace_pm_rm_sf $ns1 10.0.3.1 $MPTCP_LIB_EVENT_SUB_ESTABLISHED userspace_pm_chk_dump_addr "${ns1}" "" "after rm_addr 20" - chk_rm_nr 2 2 invert + chk_rm_nr 1 1 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 kill_events_pids @@ -3439,12 +3437,11 @@ userspace_tests() "id 20 flags subflow 10.0.3.2" \ "subflow" userspace_pm_chk_get_addr "${ns2}" "20" "id 20 flags subflow 10.0.3.2" - userspace_pm_rm_addr $ns2 20 userspace_pm_rm_sf $ns2 10.0.3.2 $MPTCP_LIB_EVENT_SUB_ESTABLISHED userspace_pm_chk_dump_addr "${ns2}" \ "" \ - "after rm_addr 20" - chk_rm_nr 1 1 + "after rm_sf 20" + chk_rm_nr 0 1 chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 kill_events_pids --=20 2.45.2 From nobody Wed Dec 4 19:13:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2A071AE029 for ; Fri, 2 Aug 2024 18:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622682; cv=none; b=GtKRnD4iB9cgyFh8ALJVP6wLRgrI+L+WwqKNcZxlSSzQPRj1ZreBFaNBgYlYZD7e+R4dT/AGJLt8b9Hy0zPEVt2kjV4Ri/v8gCYIU7xksedgqqqF8dYepxi731t+sE1GhlByKJRnewyOROeLA4N04MvJdqzadjkpXZYtGtwvxTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622682; c=relaxed/simple; bh=scOGkgJGBTFh7fVjXdqeNLUnqIdqxrEK67EcsA7/1Wk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DdCFicLTusM2eWImPH3Xe8usOFSh9kF7eK+VkMwiIC97Q7kKSUDY42RllKXQeJmpCPeJeRf0Mqr0/agMgBJfADhbfTB1awzRnIonj31GrY455D3635f+TTNpD7h3zL20ZL7HvoomRv6SskrP59RyL13BzRjo9tJdLqL+r7XxQ4M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zr5YRniC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zr5YRniC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6282C4AF0A; Fri, 2 Aug 2024 18:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722622682; bh=scOGkgJGBTFh7fVjXdqeNLUnqIdqxrEK67EcsA7/1Wk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Zr5YRniCVRQYJhgoosBJB+XVamdUVCko19IslhMghigrofck6wczNxxI8ak+52B19 kbA7sVX2nZ4Eey6DawbzdUkiaNhl0EpHMhIrRDmLPORydJ6J52CBLh6FDTTZ0r+2EF N27dg4Uzv03Qqoalx1l8mOJIf7sLnUNQ13j9uB9EmoeVJjfs6AXSoPV/X3y8rC+FYj ULX+MgdOhHfy4oe7EACOvxMP/VdMrfT/RMDE1+Nd3rc1APISG3szQcvweDgYVCmbNx /zZzFnBWvSbcWUkpywTXfrrzepSv2xKbc+pzhjIwio0jaDhqhjqo+Nhy5esgxUSGfn q23EhTPSuWoig== From: "Matthieu Baerts (NGI0)" Date: Fri, 02 Aug 2024 20:17:48 +0200 Subject: [PATCH mptcp-net v6 11/11] mptcp: pm: send ACK on non stale subflows Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240802-mptcp-pm-avail-v6-11-964ba9ce279f@kernel.org> References: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> In-Reply-To: <20240802-mptcp-pm-avail-v6-0-964ba9ce279f@kernel.org> To: mptcp@lists.linux.dev Cc: Mat Martineau , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1144; i=matttbe@kernel.org; h=from:subject:message-id; bh=scOGkgJGBTFh7fVjXdqeNLUnqIdqxrEK67EcsA7/1Wk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmrSLLZx+BSexKEZCOtYF7Ryp92EKWk/JeZAk8E G2F6a1llSSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZq0iywAKCRD2t4JPQmmg c3pvEAC7+kXYnxWKU86hHb1BRl1wtI0Ueh9+lewn0qG/BWRgQwNwj5JI55i1BCRUTysYe56oION TeER8CRXcOZyz+opsaAKeiCOCwxVR1cO4zYbyh4r/609DidrhJBZBcime4E0d60xfn17i/dGcOR aSN+DfrrJf32jBC3p9z/b401uZqwXbM7AzdadCbew5Qj7la5hI0QkvcFtL5l9wi+hwNWLBksUO7 5Z8wlBXGy3xLZYHSnQae8gAsmhMShB+VdSfQXS1+hoQvDmkAo+gZs9+gpSvWrPY4l+qrl4cihjk aSW0mhOOSNyWxM+a6q/idVmQkP3nNgrCZUU0L//cJ1d3jf+F96YdRuytMJJDvAux/pYo2j6SKwW YRmjdlC6t7jW9wuk2S4zI04s/kB7WABtGJJVmf+GPo/OIHS1DUroHLianIXI2nhnXW5QuZavy2L uHkTqEP4MhvZxA1H92mbV7RLrvTrtD7DvA+iE3uk56iF6cN/mWU6NyKCgOYFq5HGvlVB9+UNfRY P3LhSsXFOv/F7e4TvGmeYhJn9pN8RdYa6yvlgI82mTtas0sWIBCK7Ka9lmA/P91ZJBsNzinJg+G 3KgWKP22KqDGuK9kAPO4jROa/dRIWCoBAc+FkPrQxxlOWQfJZv5lDxtr3bTnd125tDZPmCe7yg4 79ep0doGMe175cg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 If the subflow is considered as "staled", it is better to avoid it to send an ACK carrying an ADD_ADDR or RM_ADDR. Another subflow, if any, will then be selected. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- Notes: - It sounds safer to do this modification in -next. I also wonder if we should not add more check, e.g. not on backup flow except if there are no other non-backup ones, or still pick a staled one if there are no others, etc. But maybe we don't need to care for an ACK? And we can always improve that later! --- net/mptcp/pm_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d3b1b459e6f3..cb8f7de7ed6c 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -772,7 +772,7 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) return; =20 mptcp_for_each_subflow(msk, subflow) { - if (__mptcp_subflow_active(subflow)) { + if (!subflow->stale && __mptcp_subflow_active(subflow)) { mptcp_pm_send_ack(msk, subflow, false, false); break; } --=20 2.45.2