Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp872969pxb; Tue, 1 Feb 2022 12:10:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx71t3CayyeGSTe9EnTFQROr2SK5aNfiaMDXaSE/4O8GlPeKvuJsfYrSer6kOZoU4UmiFXx X-Received: by 2002:a17:907:1c8a:: with SMTP id nb10mr22372198ejc.273.1643746220585; Tue, 01 Feb 2022 12:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643746220; cv=none; d=google.com; s=arc-20160816; b=KFE9WUFvDZlps91ZSOCR3SCH1yWyJ26QN9TjSi/nLOXAsUa/w14cFnycM9BQtPKZ/7 g5jggZSkGuIXEPZLYVR0uYA3Y194FcpTjx2jg5Gp4qaZ+HtIw9yKjDwwE2z7LKdS9NsM xy/52dpF5m4tTbSfQKr2jELTPwTaZOHj5prAxqmp4NOC2yT4O1umrq+7Lh46ICuq04Lv ntnlwAkBpaM7a9ZI1kVI0A8+aAV2FCWamFmzq1s10JKDjImfErsIVDl1gc6Bcq3JuTh4 0IWn268KHePUaulzYXBRZAGl3Hq1LGSs9wcRdNgctPY9HnicpR1pE1F2ALDhWNr4Zo8b aS/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UOCpa8Tacx3g4S28hPWvFSQqpQI9oHATLrTSYBPGd3c=; b=y/hRcAjQomUHQ/DU+mhg/+URempz2VlJ1ge3XlUzXBvFag+8Q7EjoryqbFvdUqj4+B 6nKAB8j/6ajkwqOP1a/whGayCoZE6pp8GFNR3JDh4FRAmArM4bD+/b1/sxuCTwmEs3YQ 2gISjInBxi01QvQDe4eSD8HrXbzM3g/yvR9VuX/QlRsSh/QpOFKIeWCpd8KuFSf7r4Np nxt8yE70ZBUp1r2No2rzXJ1JDAVP204ZZBsz++0YXNdbTEvl5bt3YYAkRRSYS/QvkLqF RBU544GR+Pt3wt88qt7a/cPph5BrUMvxFLlA3+x98jy25ExIXC9AzS3HSuArO5BcT0dV PfSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="brulv/rz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg41si10275998ejc.396.2022.02.01.12.09.53; Tue, 01 Feb 2022 12:10:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="brulv/rz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359476AbiAaLfv (ORCPT + 99 others); Mon, 31 Jan 2022 06:35:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:41794 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378339AbiAaLYC (ORCPT ); Mon, 31 Jan 2022 06:24:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A0BFB82A69; Mon, 31 Jan 2022 11:24:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67685C340EE; Mon, 31 Jan 2022 11:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643628240; bh=5KWzA4AfI8HVUxyFlZgUqfeJSf59g4119hh9HmUO5uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=brulv/rzTDO/UvAvDVB1IyeBq/QYsjZ7ePh6NdU8ppJ36G48biRehA+qRu0CBN+gp styOTxheshfHYyAH0BU+qXItnR5Cclt/AgyQ/oZ0JvKleBiOPY4ULBcWyA2KriRrHH Ab7r7WT0cUZaYkRp7BIft414MMuk3aWXDBe182/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davide Caratti , Mat Martineau , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 136/200] mptcp: allow changing the "backup" bit by endpoint id Date: Mon, 31 Jan 2022 11:56:39 +0100 Message-Id: <20220131105238.136417203@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105233.561926043@linuxfoundation.org> References: <20220131105233.561926043@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davide Caratti [ Upstream commit 602837e8479d20d49559b4b97b79d34c0efe7ecb ] a non-zero 'id' is sufficient to identify MPTCP endpoints: allow changing the value of 'backup' bit by simply specifying the endpoint id. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/158 Signed-off-by: Davide Caratti Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/mptcp/pm_netlink.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 65764c8171b37..d18b13e3e74c6 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1711,22 +1711,28 @@ next: static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) { + struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }, *entry; struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct pm_nl_pernet *pernet = genl_info_pm_nl(info); - struct mptcp_pm_addr_entry addr, *entry; struct net *net = sock_net(skb->sk); - u8 bkup = 0; + u8 bkup = 0, lookup_by_id = 0; int ret; - ret = mptcp_pm_parse_addr(attr, info, true, &addr); + ret = mptcp_pm_parse_addr(attr, info, false, &addr); if (ret < 0) return ret; if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP) bkup = 1; + if (addr.addr.family == AF_UNSPEC) { + lookup_by_id = 1; + if (!addr.addr.id) + return -EOPNOTSUPP; + } list_for_each_entry(entry, &pernet->local_addr_list, list) { - if (addresses_equal(&entry->addr, &addr.addr, true)) { + if ((!lookup_by_id && addresses_equal(&entry->addr, &addr.addr, true)) || + (lookup_by_id && entry->addr.id == addr.addr.id)) { mptcp_nl_addr_backup(net, &entry->addr, bkup); if (bkup) -- 2.34.1