From nobody Fri Apr 26 02:46:38 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:cbb9:0:0:0:0:0 with SMTP id v25csp406173jap; Thu, 11 Nov 2021 03:09:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpmW6IV6T85CPq55+OOR1Uuq/bSbWnNkIXE5xb3hxhNfV45SSPMsWU8JIBe0M3RtrcUQ/2 X-Received: by 2002:a05:6830:3152:: with SMTP id c18mr1255225ots.82.1636628970897; Thu, 11 Nov 2021 03:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636628970; cv=none; d=google.com; s=arc-20160816; b=EPdw0UHto6xrTzi006GISvrI/nCVqdLDE9YFwuvwclLVqNoY1k9IUgEjjIYp7kgs4K yMyFvhm8FG0ybfDuOgKO9nFKRNO0V0El0SesUejrsGw9oM9ojzp4SS1hEQGr5Mm8u0M4 VfOxiYPlA6CNKG3YK4XPQm2av36lzraFjt4/tIek54ZcN/lzmjHX5K795Td9PUH2MoHs GX7FzFg3n//qIpAAD2noTKi6X6hNzfyv8DfSUS1Wz/U3WO3J1xE3Vc1xLUXgoVfa33cN ELt3ft9cX/JPdIC/SxnHagc5rWOoaawosCsvRXaWqsKmm9A6zvSo3fREbCa35gRxXvrb lZQQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=QA76H3/UR+er/Sas/IM41yDEj3bkLqK6/lL9hGnFK+c=; b=zVBJ2DsvsJaxV03bDnX1miMnd67YGDORCiZj9+X4y1K8VlTDsMv0Nj5E5urw0eAQAQ 5Ese+UTET4mohASB+hWpOJ5z6XlZbT4YvQpjGXLEDqcU9iBGwQNS/b8bWn9lc6YY6tnR 5nzri59P20uD6PKInYViNQRjVV/6R4Vb9ugpSaCJo3TpOpoQZ+vQyQxQdQ6gsjtihGce wfZN/XKOX/tfZi8Vt6YlM2wDk1+0/lVV5o7yxYRlaoP77EHopnFzua4DHoXAEYI5ojNH sLRYXfm56rFe0lxCgtgDkpNOjyvqqpaGgBzA41UxJeIC0eUoPbUuTJvsPO5+AgOs31Fs SYyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aK5Q1pTQ; spf=pass (google.com: domain of mptcp+bounces-2414-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2414-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id w65si3740742oib.291.2021.11.11.03.09.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Nov 2021 03:09:30 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2414-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aK5Q1pTQ; spf=pass (google.com: domain of mptcp+bounces-2414-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2414-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 0610B3E0F70 for ; Thu, 11 Nov 2021 11:09:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11D6F2C82; Thu, 11 Nov 2021 11:09:29 +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 ECC2868 for ; Thu, 11 Nov 2021 11:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636628966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QA76H3/UR+er/Sas/IM41yDEj3bkLqK6/lL9hGnFK+c=; b=aK5Q1pTQ+kj5l0AIg5quJgw1LBMCSoofYnucjwqPwdJDGi4A6ibchSrdF2ZIwx3ylyOjuV c+EibXENBATN//eIJZHwh9J6ILqc5SQwyhW9Ikj45bReqj3HwRuh6vwCwKyV+jF116fq9Q SAHvpJX9gqwh3POpL1pK/TbFIOAjDwg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-C5AsJDUfNGGLx8v_MDBcuQ-1; Thu, 11 Nov 2021 06:09:19 -0500 X-MC-Unique: C5AsJDUfNGGLx8v_MDBcuQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A196B801B0F; Thu, 11 Nov 2021 11:09:17 +0000 (UTC) Received: from dcaratti.users.ipa.redhat.com (unknown [10.40.195.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 677195DA61; Thu, 11 Nov 2021 11:09:16 +0000 (UTC) From: Davide Caratti To: Mat Martineau , Matthieu Baerts Cc: mptcp@lists.linux.dev Subject: [PATCH mptcp-next] mptcp: allow changing the "backup" bit by endpoint id Date: Thu, 11 Nov 2021 12:09:00 +0100 Message-Id: <434d58757c972252e5af7ac2574c3791a9778441.1636628783.git.dcaratti@redhat.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dcaratti@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- net/mptcp/pm_netlink.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 7b96be1e9f14..b4c647e67930 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1700,24 +1700,35 @@ static int mptcp_nl_addr_backup(struct net *net, return ret; } =20 +static int mptcp_nl_set_flags_idzero(u8 flags) +{ + return -EOPNOTSUPP; +} + static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *i= nfo) { + struct mptcp_pm_addr_entry addr =3D { .addr =3D { .family =3D AF_UNSPEC }= , }, *entry; struct nlattr *attr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; struct pm_nl_pernet *pernet =3D genl_info_pm_nl(info); - struct mptcp_pm_addr_entry addr, *entry; struct net *net =3D sock_net(skb->sk); - u8 bkup =3D 0; + u8 bkup =3D 0, lookup_by_id =3D 0; int ret; =20 - ret =3D mptcp_pm_parse_addr(attr, info, true, &addr); + ret =3D mptcp_pm_parse_addr(attr, info, false, &addr); if (ret < 0) return ret; =20 if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP) bkup =3D 1; + if (addr.addr.family =3D=3D AF_UNSPEC) { + lookup_by_id =3D 1; + if (!addr.addr.id) + return mptcp_nl_set_flags_idzero(addr.flags); + } =20 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 =3D=3D addr.addr.id)) { mptcp_nl_addr_backup(net, &entry->addr, bkup); =20 if (bkup) --=20 2.31.1