From nobody Fri May 3 23:10:14 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2733143uad; Mon, 4 Jul 2022 02:15:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sXLmPJC1Z/q3QHmRHp95FXsGnB5vhQxW8yCcnnLIjNXpc4tMbsSfNEax30iaSHVXXz1RiY X-Received: by 2002:a05:6808:10cf:b0:32e:b60c:5db5 with SMTP id s15-20020a05680810cf00b0032eb60c5db5mr16503020ois.292.1656926127591; Mon, 04 Jul 2022 02:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926127; cv=none; d=google.com; s=arc-20160816; b=Gj/Z+ILu4k1Gt8MBFPedrzvIdrv2AO+jhDuMwmF7/Q9vg+OGdBW2f/tIVSmVh68UKj ys8Q1W5rGpJfkKpFcfsewlhwswZlhEvsXF35+9uxihCJo/olprrLIJ0Ipmcpca5VZGFm iASFwNnN5GpZRVzmunL+2xvKg27w807ifon1ssALuVdNQpqJUtfHEr2GrXegRZKLIB+H kkIpMazg8X2iEz2lxuKucx0IXyb0V9ISOwkMJ6GZ7SLMYAHopmqihQ1b5H3RAxVeLpfm i50PqRHpGpXUCmazaydXhzoIq3668/9QFtOmYvTn9HLTIs4AlKYVSiMv4wCgjhLxVgla Iv3Q== 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=2fmr9S/TXZd+UNcBpXAhz4nq+oRy871J9gnd859i7Nc=; b=BMZzWViVF/y9AWc6V3BtyhJvoZ5KypVpvZ58+/vsUfrnHLiw0Cb6sV9yrqNkwXot7P b2KvkA4bKX138axOW02buDl8UKMwGuIHlXjqZfEFGwL8DYZTCzaodxX+jtp8LZuyA58e uoZFC7yANtlOYzFjqmShuRvXZ92LsXQyQkxxJkB/5HEGjPV8L29uSgEYFmoJanU4YaY8 VDVbbSvqy4of4saJ51CDkEK/yncUrQqh4qVqGLmdXCGulPer2CMQrqlGt2jMS1b2+Tji tn088Fyr3EvAIiEvVCS0yMHU9C4lMhYvOPoJi1xz9j8o0DB++gGdb4JlGFTX+15igkkM dLBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cZxT2Fy3; spf=pass (google.com: domain of mptcp+bounces-5944-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5944-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 v16-20020a056808005000b0033593c25822si18673080oic.222.2022.07.04.02.15.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:15:27 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5944-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=cZxT2Fy3; spf=pass (google.com: domain of mptcp+bounces-5944-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5944-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 4357C2E0A15 for ; Mon, 4 Jul 2022 09:14:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1E3723B5; Mon, 4 Jul 2022 09:14:54 +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 3AB8923B6 for ; Mon, 4 Jul 2022 09:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656926092; 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=2fmr9S/TXZd+UNcBpXAhz4nq+oRy871J9gnd859i7Nc=; b=cZxT2Fy3Dx7WLDZyoabO8eQu7Cb3S+4tCokU0UuFonB5vrCcwJF25zbNAI+nmTd9kp4L7q eIAxLPF7KPLUmEiOC2VXzL0Drd1psUDrk9PgqItfApDFqqwXx3bV52SMZ7SlQrknOyPu6W KQbCPsn59rl7Vz4w1523rOiRN3Xdm08= 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-660-RKmMK0iUOsiWZ0SA2GaSSw-1; Mon, 04 Jul 2022 05:14:51 -0400 X-MC-Unique: RKmMK0iUOsiWZ0SA2GaSSw-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 C77A7380451B for ; Mon, 4 Jul 2022 09:14:50 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A6BE2166B29 for ; Mon, 4 Jul 2022 09:14:50 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 1/5] mptcp: introduce and use mptcp_pm_send_ack() Date: Mon, 4 Jul 2022 11:14:32 +0200 Message-Id: <48ba561bb3bc5ef6d55f15933ce9633e466a56b0.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" The in-kernel PM has a bit of duplicate code related to ack generation. Create a new helper factoring out the PM-specific needs and use it in a couple of places. As a bonus, mptcp_subflow_send_ack() is not used anymore outside its own compilation unit and can become static. Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 56 +++++++++++++++++++++++++----------------- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 1 - 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 5bdb559d5242..e85fbced2c07 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -463,6 +463,37 @@ static unsigned int fill_remote_addresses_vec(struct m= ptcp_sock *msk, bool fullm return i; } =20 +static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subfl= ow_context *subflow, + bool prio, bool backup) +{ + struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); + bool slow; + + pr_debug("send ack for %s", + prio ? "mp_prio" : (mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_= addr")); + + slow =3D lock_sock_fast(ssk); + if (prio) { + if (subflow->backup !=3D backup) + msk->last_snd =3D NULL; + + subflow->send_mp_prio =3D 1; + subflow->backup =3D backup; + subflow->request_bkup =3D backup; + } + + __mptcp_subflow_send_ack(ssk); + unlock_sock_fast(ssk, slow); +} + +static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow= _context *subflow, + bool prio, bool backup) +{ + spin_unlock_bh(&msk->pm.lock); + __mptcp_pm_send_ack(msk, subflow, prio, backup); + spin_lock_bh(&msk->pm.lock); +} + static struct mptcp_pm_addr_entry * __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) { @@ -705,16 +736,8 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) return; =20 subflow =3D list_first_entry_or_null(&msk->conn_list, typeof(*subflow), n= ode); - if (subflow) { - struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); - - spin_unlock_bh(&msk->pm.lock); - pr_debug("send ack for %s", - mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr"); - - mptcp_subflow_send_ack(ssk); - spin_lock_bh(&msk->pm.lock); - } + if (subflow) + mptcp_pm_send_ack(msk, subflow, false, false); } =20 int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, @@ -729,7 +752,6 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, mptcp_for_each_subflow(msk, subflow) { struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); struct mptcp_addr_info local, remote; - bool slow; =20 local_address((struct sock_common *)ssk, &local); if (!mptcp_addresses_equal(&local, addr, addr->port)) @@ -741,17 +763,7 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *ms= k, continue; } =20 - slow =3D lock_sock_fast(ssk); - if (subflow->backup !=3D bkup) - msk->last_snd =3D NULL; - subflow->backup =3D bkup; - subflow->send_mp_prio =3D 1; - subflow->request_bkup =3D bkup; - - pr_debug("send ack for mp_prio"); - __mptcp_subflow_send_ack(ssk); - unlock_sock_fast(ssk, slow); - + __mptcp_pm_send_ack(msk, subflow, true, bkup); return 0; } =20 diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 10bfa2b78206..874344f7e0fa 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -508,7 +508,7 @@ void __mptcp_subflow_send_ack(struct sock *ssk) tcp_send_ack(ssk); } =20 -void mptcp_subflow_send_ack(struct sock *ssk) +static void mptcp_subflow_send_ack(struct sock *ssk) { bool slow; =20 diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 5420b4eb7fbe..bc4dc81a4c3c 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -610,7 +610,6 @@ void mptcp_subflow_shutdown(struct sock *sk, struct soc= k *ssk, int how); void mptcp_close_ssk(struct sock *sk, struct sock *ssk, struct mptcp_subflow_context *subflow); void __mptcp_subflow_send_ack(struct sock *ssk); -void mptcp_subflow_send_ack(struct sock *ssk); void mptcp_subflow_reset(struct sock *ssk); void mptcp_subflow_queue_clean(struct sock *ssk); void mptcp_sock_graft(struct sock *sk, struct socket *parent); --=20 2.35.3 From nobody Fri May 3 23:10:14 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2732860uad; Mon, 4 Jul 2022 02:15:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbF77CVg+FF33A1YWxjdSfIWcI1QK91svLJLdf8meF3YEJW1BxRREi381ekNxWui7WqheD X-Received: by 2002:a17:90b:4f44:b0:1ed:64a1:9769 with SMTP id pj4-20020a17090b4f4400b001ed64a19769mr37147403pjb.136.1656926102298; Mon, 04 Jul 2022 02:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926102; cv=none; d=google.com; s=arc-20160816; b=k1jt/nmCNHvmTuRFx4C7y9fxeOTyagppUsYQGkoG4/jr92onbSXoGALAG7lfGT1rW1 1eyrNy/KPvDdban7bsq7hzC0bDx8SGFxM8rM9ijzRGRDUTNaiZ0U+gHc92QVhHrNzpJq yTC7Ag74075Lb05NDPwlLTgUhotqiQFQv8tXOmFb5VL5Ol6Meg0xeiZxoTMl0/uheC6L plUuq46ovKnk7qdgQYpHgI2fKXLwsPixoEXdDMaNa9eMp/9WXPuxK3FcOk0wOfsSDgQi Uuui8pQ6JlJ8rMUCeuCu/aUxbwCVRIXkG5qOtuXsDbeksomowv6eukOlpBOT9ThV/4Zg IJ0Q== 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=00hrlLwCfHmsGG0fifYpdJ6TA4nLO6kOJy830ifafLw=; b=BYbG6OTKx5dSPwQ1nHTsOIYuGW0nMSKkqZAhJF6iV4mG9HSLhlTA/T6bkd++w1LT/k MNgilSUIyutIobGGg/t+3ddpR4Jj4XcVFawdBIPKqIF+oVOj8Os3N7vTlrGv4SY5ILoq hkIG2je0kl/uMQMHGRXdOjNgJBCb/xYV9+pA2ESbQLMjNeNfG94jPkwq4Kmp/wrH8xVr aYpp7kD6J9iL5IvWFv5BJ/u4nNq2c59jnEMReIx7cyuqNi267zErEEz2nimmusxiwQ7T +4sUeb6AFigWOZuI5DPl6I88w+pZHs0JCbwIppS82GoyW8Xrms2jDvJvX6an8H00NJK4 VJqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pm+lOHor; spf=pass (google.com: domain of mptcp+bounces-5948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5948-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u1-20020a654c01000000b0040986ef2410si23667270pgq.493.2022.07.04.02.15.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pm+lOHor; spf=pass (google.com: domain of mptcp+bounces-5948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5948-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D76E1280C4B for ; Mon, 4 Jul 2022 09:15:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AF3B23B6; Mon, 4 Jul 2022 09:15:01 +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 BE25623C2 for ; Mon, 4 Jul 2022 09:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656926098; 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=00hrlLwCfHmsGG0fifYpdJ6TA4nLO6kOJy830ifafLw=; b=Pm+lOHorQJxSL+Oa5i1IOaJAWdPTkjy5sV9hQTSBUUDE2L1fBerffGi5QvC1b2C3v+J8Xi i/ioO326KsweV4rpTyz/QwCJqymMWKPd0DfTVMs2vdGrvR7MenSLToYctaGE4L7YvWYGsS b3wP6MLMXzGIV1yaKa6gzgu/xplPWsM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-467-7xfhgXZTPiWbdraQANedwg-1; Mon, 04 Jul 2022 05:14:51 -0400 X-MC-Unique: 7xfhgXZTPiWbdraQANedwg-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 8592A802D1C for ; Mon, 4 Jul 2022 09:14:51 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 171332166B26 for ; Mon, 4 Jul 2022 09:14:50 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 2/5] mptcp: address lookup improvements Date: Mon, 4 Jul 2022 11:14:33 +0200 Message-Id: <9aca8356861affca14c6e4732943f9b76c3923a1.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" When looking-up a socket address in the endpoint list, we must prefer port-based matches over address only match. Ensure that port-based endpoints are listed first, using head insertion for them. Additionally be sure that only port-based endpoints carry a non zero port number. Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e85fbced2c07..c0a4c947347b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -413,7 +413,7 @@ static bool lookup_address_in_vec(const struct mptcp_ad= dr_info *addrs, unsigned int i; =20 for (i =3D 0; i < nr; i++) { - if (mptcp_addresses_equal(&addrs[i], addr, addr->port)) + if (addrs[i].id =3D=3D addr->id) return true; } =20 @@ -449,7 +449,8 @@ static unsigned int fill_remote_addresses_vec(struct mp= tcp_sock *msk, bool fullm mptcp_for_each_subflow(msk, subflow) { ssk =3D mptcp_subflow_tcp_sock(subflow); remote_address((struct sock_common *)ssk, &addrs[i]); - if (deny_id0 && mptcp_addresses_equal(&addrs[i], &remote, false)) + addrs[i].id =3D subflow->remote_id; + if (deny_id0 && !addrs[i].id) continue; =20 if (!lookup_address_in_vec(addrs, i, &addrs[i]) && @@ -919,10 +920,11 @@ static int mptcp_pm_nl_append_new_local_addr(struct p= m_nl_pernet *pernet, /* do not insert duplicate address, differentiate on port only * singled addresses */ + if (!address_use_port(entry)) + entry->addr.port =3D 0; list_for_each_entry(cur, &pernet->local_addr_list, list) { if (mptcp_addresses_equal(&cur->addr, &entry->addr, - address_use_port(entry) && - address_use_port(cur))) { + cur->addr.port || entry->addr.port)) { /* allow replacing the exiting endpoint only if such * endpoint is an implicit one and the user-space * did not provide an endpoint id @@ -968,7 +970,10 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm= _nl_pernet *pernet, } =20 pernet->addrs++; - list_add_tail_rcu(&entry->list, &pernet->local_addr_list); + if (!entry->addr.port) + list_add_tail_rcu(&entry->list, &pernet->local_addr_list); + else + list_add_rcu(&entry->list, &pernet->local_addr_list); ret =3D entry->addr.id; =20 out: --=20 2.35.3 From nobody Fri May 3 23:10:14 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2732835uad; Mon, 4 Jul 2022 02:15:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLyHcJnmq/ZAaWgsz5ZWDS548itPTP4Ms6xtFXual1P0pmeqGmXv2S5uXnqRln/7L3h2Lv X-Received: by 2002:a63:6bc4:0:b0:40d:fd98:bb21 with SMTP id g187-20020a636bc4000000b0040dfd98bb21mr23859274pgc.249.1656926099911; Mon, 04 Jul 2022 02:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926099; cv=none; d=google.com; s=arc-20160816; b=WtKwQQVjBu9Gpaoz4DJ/QMPVd/8G6Gv+Lyg0yBF0S37bS2s4X1eU6iZESMn1Wy3lD6 QFgToqS08TNgS1z68VBAElTM1Ww72bnmYTSNplrOjTMwivf0Nu68mH0RY4wcwcq+i3tt 4AAUY9+HHdivdc9lRLA9fHsQ4Z/cte/ISrfL7ldejmL/vLyfGQF2amSivaX8PTZznhVe ous5EmXvdQFYYVeoe4i/lg7R25eytiaAeXRx/eYd6PDsrLhiMIwqTJkEjXPnHBI4Zpgk v8xUr3Ls22XSZh+z1ZWQE9dF5gWUJ6aJDV9TSXpdFs7TB+LyFED0aqhkqHJ6mgXtPFIv gy3w== 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=TjR7Ms2pLLD69b5s2wUt45RzlgR9Ju8nK34ei07XjSY=; b=EGTB0W6yAmwRTr5CPuEALogFVF1CWL44ArzGV8+USXQhx2MMfXvJ4yO2DtpXzncfb1 +/S3jPmdNCFC+5lkjVqIKmMQG7UMa8rq13sGGp2mWmNGIh9bGX4DnVFXoptG6Nxo7MQ0 BLCcHYZ3Mf0yRdlH8yGayg+P2arvgfDSYIeVJKe2hS1ZAoWkcH0okJ1Xt1R0kzPiYTMO zwOohIdqNwgdCEIrxQwiwUOUFJ62bkN1S1Zk1CkLl98T7Z1l48Joqsttnmbki+k7FvOQ SISNh7fG4iRCTcESDOF/KodY73zkFbZz67AH4fjtidJt2RZfIfxEgxEU5U/6/ZnePeAW kN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cMtDNhwk; spf=pass (google.com: domain of mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x69-20020a638648000000b00408a7a11803si19840218pgd.720.2022.07.04.02.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cMtDNhwk; spf=pass (google.com: domain of mptcp+bounces-5946-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5946-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 58A0B280ABA for ; Mon, 4 Jul 2022 09:14:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DE3A23B6; 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 AE1AB23C8 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=TjR7Ms2pLLD69b5s2wUt45RzlgR9Ju8nK34ei07XjSY=; b=cMtDNhwkm/HjiuV/Uex7RaCJD3aawY8n3bzaP2989uRnSUzCC+alrnYW7Bwirwj4cX7Avz mSJfewe62dYbiSVLLuIS3qcEatnyO0PMxihQQFr57sOT0f51hOtYAmuIPyobSCx5Rt/Vxg PHRksKMQQYerpw39zTExYNL4pciX574= 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-494-TbA90xKxPtm2-SuAv_9gbQ-1; Mon, 04 Jul 2022 05:14:52 -0400 X-MC-Unique: TbA90xKxPtm2-SuAv_9gbQ-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 43FC43C01D99 for ; Mon, 4 Jul 2022 09:14:52 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB0D82166B26 for ; Mon, 4 Jul 2022 09:14:51 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 3/5] mptcp: allow the in kernel PM to set MPC subflow priority Date: Mon, 4 Jul 2022 11:14:34 +0200 Message-Id: <414465fb0c27e24f5616bc7660e018a6474ba672.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" Any local endpoints configured on the address matching the MPC subflow are currently ignored. Specifically, setting a backup flag on them has no effect on the first subflow, as the MPC handshake can't carry such info. This change refactors the MPC endpoint id accounting to additionally fetch the priority info from the relevant endpoint and eventually trigger the MP_PRIO handshake as needed. As a result, the MPC subflow now switches to backup priority after that the MPTCP socket is fully established, according to the local endpoint configuration. Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- net/mptcp/pm_netlink.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index c0a4c947347b..d846ceeceb9a 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -514,30 +514,14 @@ __lookup_addr(struct pm_nl_pernet *pernet, const stru= ct mptcp_addr_info *info, struct mptcp_pm_addr_entry *entry; =20 list_for_each_entry(entry, &pernet->local_addr_list, list) { - if ((!lookup_by_id && mptcp_addresses_equal(&entry->addr, info, true)) || + if ((!lookup_by_id && + mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) || (lookup_by_id && entry->addr.id =3D=3D info->id)) return entry; } return NULL; } =20 -static int -lookup_id_by_addr(const struct pm_nl_pernet *pernet, const struct mptcp_ad= dr_info *addr) -{ - const struct mptcp_pm_addr_entry *entry; - int ret =3D -1; - - rcu_read_lock(); - list_for_each_entry(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, addr, entry->addr.port)) { - ret =3D entry->addr.id; - break; - } - } - rcu_read_unlock(); - return ret; -} - static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) { struct sock *sk =3D (struct sock *)msk; @@ -555,13 +539,22 @@ static void mptcp_pm_create_subflow_or_signal_addr(st= ruct mptcp_sock *msk) =20 /* do lazy endpoint usage accounting for the MPC subflows */ if (unlikely(!(msk->pm.status & BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED))) &&= msk->first) { + struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(msk->first); + struct mptcp_pm_addr_entry *entry; struct mptcp_addr_info mpc_addr; - int mpc_id; + bool backup =3D false; =20 local_address((struct sock_common *)msk->first, &mpc_addr); - mpc_id =3D lookup_id_by_addr(pernet, &mpc_addr); - if (mpc_id >=3D 0) - __clear_bit(mpc_id, msk->pm.id_avail_bitmap); + rcu_read_lock(); + entry =3D __lookup_addr(pernet, &mpc_addr, false); + if (entry) { + __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); + backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + } + rcu_read_unlock(); + + if (backup) + mptcp_pm_send_ack(msk, subflow, true, backup); =20 msk->pm.status |=3D BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED); } --=20 2.35.3 From nobody Fri May 3 23:10:14 2024 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 Reviewed-by: Mat Martineau --- 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 From nobody Fri May 3 23:10:14 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:590e:0:0:0:0:0 with SMTP id n14csp2732849uad; Mon, 4 Jul 2022 02:15:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+Kq6yjWzBeHFPd7QVF/njGaZhXcIxMnIeJ5nD0DlWQrWlOQqQkiO841wbXuqzA3Z1Q9Tc X-Received: by 2002:a63:3c14:0:b0:40c:a228:c3c3 with SMTP id j20-20020a633c14000000b0040ca228c3c3mr24803684pga.256.1656926101153; Mon, 04 Jul 2022 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656926101; cv=none; d=google.com; s=arc-20160816; b=BY0VcKWB2yFIxIAhTXgeChiDrmt7hb7IV7gulvRv7h4ovHkmQGVsFEgaVdEm7Pu9K/ m+VPNRm0aNt9sxGpMNc40XiCHQ1NWRxsOd50FJ3Nt88aw2UmyXrFTyEFGPgxFPsxdpqd ukBjbrb8u5fA4qXGXXYs4qNFpVD7QVynOQRAOYOMgxOPc+KGFpcdaVZVXB0h3nn1ceq7 dEl8Ncrx2R16D5W4Z/+LCmTLGauMktjkfWCXrJnEB5BbKUtry8M+LGMz8CvX5q4n4JG4 5Su1vjajCJZEWPwfTf5HV6AxrhB/DxScQEmTnhamhQTrS/UTwdweth5Cmde14Fb7EJNi ImOA== 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=+DFKaN8QVS/mKAoW3OQy6u47fqbLFxD26tTV/pZD5xY=; b=hCj3Wrp0FQwbX49a9cup1W9tAZgQsQ1i9Bu2Q4U37yu3GTr9s83Uzrii6sBtQjybDe XJ30+rkaCgAPGxrX5G3G5hl5QTrNyH4MN5LsQg/fHK0HQPZ7ZnFQs5ApFD0JgGHzFr2T vlSXEVjnEaQieUAu30zmELIR4vOwTIlk6TUv1elNnrQM3ZmDU3+unPaaZoiAUUdD+KHi 47GjsgGi4nNNyK01kEdCVNOMaRg6DwnlAWbwL0vPZ2wxj7pPLCT4tb++S2dDCl0isP4N sQlVk26X6U2X8m55CF4kfCAugEs2WHeltYe+QVIoBmujGKIAIuUncvWEmd36Bcgbebfl VoJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CGfrcEoi; spf=pass (google.com: domain of mptcp+bounces-5947-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5947-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u1-20020a654c01000000b0040986ef2410si23667270pgq.493.2022.07.04.02.15.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2022 02:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5947-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CGfrcEoi; spf=pass (google.com: domain of mptcp+bounces-5947-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5947-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8D5B4280C3F for ; Mon, 4 Jul 2022 09:15:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4974123B5; Mon, 4 Jul 2022 09:14:58 +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 2301523CE for ; Mon, 4 Jul 2022 09:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656926095; 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=+DFKaN8QVS/mKAoW3OQy6u47fqbLFxD26tTV/pZD5xY=; b=CGfrcEoiDoW/s/Ep+n/mAbwjuhmzRNvPnwCLTJJoIWRVx2cAny1J31DFlDJ7Rz1kvooI6/ xKVRAaRjAOxi4I/5CZwpfAls1uPYy6L97IdFME3jeyU5q5y0a6l6Bg2yruVBuju6YkRVWo paMrAgCPJn8nntPpXWgXFPAG0q9poAA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-218-orDEeygqPv6Tc-72U5dTXA-1; Mon, 04 Jul 2022 05:14:53 -0400 X-MC-Unique: orDEeygqPv6Tc-72U5dTXA-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 AFDFB1019DE1 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 4503B2166B26 for ; Mon, 4 Jul 2022 09:14:53 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next 5/5] selftests: mptcp: add MPC backup tests Date: Mon, 4 Jul 2022 11:14:36 +0200 Message-Id: <5d99d7ec0eb00d7fb2d5841586ff5825b36fca53.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" Add a couple of test-cases covering the newly introduced features - priority update for the MPC subflow. Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 55efe2aafb84..ff83ef426df5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2428,6 +2428,36 @@ backup_tests() chk_add_nr 1 1 chk_prio_nr 1 1 fi + + if reset "mpc backup"; then + pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr 0 0 0 + chk_prio_nr 0 1 + fi + + if reset "mpc backup both sides"; then + pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup + pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr 0 0 0 + chk_prio_nr 1 1 + fi + + if reset "mpc switch to backup"; then + pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup + chk_join_nr 0 0 0 + chk_prio_nr 0 1 + fi + + if reset "mpc switch to backup both sides"; then + pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow + pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup + chk_join_nr 0 0 0 + chk_prio_nr 1 1 + fi } =20 add_addr_ports_tests() --=20 2.35.3