From patchwork Wed Feb 23 06:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12756489 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5118DC433EF for ; Wed, 23 Feb 2022 06:50:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238377AbiBWGus (ORCPT ); Wed, 23 Feb 2022 01:50:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238300AbiBWGur (ORCPT ); Wed, 23 Feb 2022 01:50:47 -0500 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BABE46E286 for ; Tue, 22 Feb 2022 22:50:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1645599019; 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: in-reply-to:in-reply-to:references:references; bh=FOiz53udsAO5Ixsj+2pEay2qh39q2lWPP75LTQw+TEw=; b=j4MVShYLnkmjaaKAca26ZFDuqTHFh55C1Dm/64yD/jbo8qniKUmSd9QwX4gaSzz/qIylNB oyNu1BxSSTmedIgcJQEwJ0pa0KJTTemmTzjxLqyz59PAzeJrBbqMyiQMyMwTf64W1gAteW 18Md6zqn+lnJPgC8Hok/GOCE3GKth4I= Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2059.outbound.protection.outlook.com [104.47.14.59]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-20-kPRCISqIOj6sB5yuCwfznw-1; Wed, 23 Feb 2022 07:50:17 +0100 X-MC-Unique: kPRCISqIOj6sB5yuCwfznw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9g+TnbMOtvKwDzYSQ3QMvxpZxGAzN2uQfZjH9JuUaYbmDEiEDrqi2emIR7Sm4wbChWo2Fco/U7teMe9qTya2m3iFBkzdwYhE2UarrYqZwcSGzSufZW11cJpkIsbeJ9cSBYn2OLPciYKHWtg2u7VWKu5/gieSZsDg40jbhyzsScsDl8dqYYRBR6bYN3ZBKm4QpZ1gDAkXQaV1npvZxBH88jtJdAffa2o0B9XHdye9Dj9SsTdY60gwwgakyBbdoCWbSeyiIY/7LjQHt1X6GD3NeYBS8P45960pB8uuSDbbyOho6037rGiIOQTfiQ00TQuu8Eidh+LYp0qb7Dgv2AS3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=keAT9dbX5v6/e3rLu0ICirtktJA/LOZfZdPYTlhmmdk=; b=ENBeeR2ZajMhmdEEBaEhzAMcmFU4A7ZfF/9jcP/ZySsuJ+mDe7zErODGwRj101mZuJpzqqeMQ44zABaYoA6Y44z5JVcH4kj2YhiQTopIrMdNFy703M27pdOCHB+8oF1LGnLmFwYMARca3ephoU/QCc4f1hYC2AWMX+VQA71zWqp47Bw7Ct5sQKL+fRDOIeR7tNst4VSPRJRewEjJznTOfYvYndWkKSm2mST4oCKP4EBALAnli3vaDi6Wb4eX4K48grGcgAScK7WLcCCmLZFWWt0JSEnYNF0TrcqfS2VYWOczQmzYoMvC0oHNtNSu9E7OKg4OF980nJ0Q6SkSLakCdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by HE1PR04MB3290.eurprd04.prod.outlook.com (2603:10a6:7:20::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Wed, 23 Feb 2022 06:50:16 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::60de:f804:3830:f7c5]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::60de:f804:3830:f7c5%4]) with mapi id 15.20.4951.019; Wed, 23 Feb 2022 06:50:16 +0000 From: Geliang Tang To: Stephen Hemminger , David Ahern CC: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.linux.dev, Paolo Abeni , Mat Martineau Subject: [PATCH iproute2-next v3 2/3] mptcp: add fullmesh support for setting flags Date: Wed, 23 Feb 2022 14:50:38 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-ClientProxiedBy: HK2PR06CA0024.apcprd06.prod.outlook.com (2603:1096:202:2e::36) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53111552-94ff-4d6b-fbb4-08d9f698bfb9 X-MS-TrafficTypeDiagnostic: HE1PR04MB3290:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l+C8rKpupRlYGIqlyI8LLJKslFKj7F7Vx8mSgBynBeTACfbFYMAvdjZCLOxbxFkbhcOj+UqfCftZNAI4PYFewt3BZP7LNw2m9/bLXj4Q0Fz9CAtTiW728ZESqZ08bbBUerkj9BvStJZBlcBb6wWNqln3wbkoUq2VcQ+tLqPpiDuknfhq/UBD83ILafdI4927+eHh/pfM8WF0k45V66v9LjYUjOBgdFy8wMt7I495CpbXd63RIlRWqqdPTFL3BXF+ROgUklXq3ZNG+haXxjnY6xEf4hFTWiTqcXpXNln/GDfMXHYiHLxDWdKC7ExuapQCmYdxL/Gc30DGQfbJ3P0uiVuwRoSHHyoiLBwS42uXUP49mQ+8wAc1J/mhe+cttO+cURUDiFmBZ40ECcQHvEysdz4Xqf58l1jXHF4I9Sha6prWlJ5zweVmD0NAz3dnYr/Qkw+8eP9stWW9YUlZ/japisafdmiD+s6tWzA8ufGYhLIZWOCPOFXIh54QZYKjnZgUqptYMQbK0zDwTHiyAqPZtdcVWlN0lHXiP17ebaailmEQkfqwjghBi3CIjisSMeYiDGqanT74WNBKUWvNLc73iLtipUgStdPYRaxuRK+Gg+DprBa00VDONCyXDNoPlcpxmXWM91KviG5xMhiaLGWO4A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(8676002)(66556008)(44832011)(66476007)(66946007)(38100700002)(86362001)(4326008)(5660300002)(8936002)(2906002)(36756003)(6512007)(83380400001)(110136005)(186003)(26005)(2616005)(6486002)(508600001)(6506007)(54906003)(55236004)(6666004)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Bjn7oICOIX+k9h37QsaeGWYFMPt6wx3LFX0S6ZibcM+zmgOTwF3yM7o3fghPqH23oGDjLJg+8KEDNolZl3vXxy/xbFD8nYpah+M7OovUfHfwrahjRYu2CRn94jzIgig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ZQwUf1EakS1JeIWe1W4vRxonAgWCiF3LFcQQDZc8hoqEgvugbI5Gnqoyi1J1++x9apTHRoOjIbpwlXPUksIcVT0t9bGZjnLj7GxirLk0tff1Wkq7TndwWqTIU83xWBdHRfzceXaBUmYR3vWQxA6dAHfKUGniLlv5n9b9/HIz9u+nTUkoYOPyTpIBN1gRrATNidkhxPsHofEEvIShdAf3WgPlfvGu4eZsWPsUId9Ajq8SacANBFP0uYgIN2RN+W79kArb23vIcK1RGyGOIA6T+7yy4OxkfQIVMAeg5EqLwZjocfPJsr6GTHmHza+yBGz+wxTpDP+kvKDfr8+Ypa2gw6kn5tI9APizHDAR/gO1DtTyRxj6fFr0zeKBpMLgcEi/wYmuGsZ9f6hQ6F8Flt6dKMjRlhJ3ZA/g/ROC8UMtAAB3Mw= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53111552-94ff-4d6b-fbb4-08d9f698bfb9 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 06:50:16.4546 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GpzouTvi40f6coDdz5Nopolmk9J6AaTgoD4qX5GiVYZsqJdpJq4Dqb0ceZW7vl7Rq2TkZ2SNNVNaYXi+PWZtdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3290 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com A pair of new flags, fullmesh and nofullmesh, had been added in the setting flags of MPTCP PM netlink in kernel space recently by the commit 73c762c1f07d ("mptcp: set fullmesh flag in pm_netlink"). This patch added the corresponding logic to pass these two flags to the netlink in user space. These new flags can be used like this: ip mptcp endpoint change id 1 fullmesh ip mptcp endpoint change id 1 nofullmesh ip mptcp endpoint change id 1 backup fullmesh ip mptcp endpoint change id 1 nobackup nofullmesh Here's an example of setting fullmesh flags: > sudo ip mptcp endpoint add 10.0.2.1 subflow > sudo ip mptcp endpoint show 10.0.2.1 id 1 subflow > sudo ip mptcp endpoint change id 1 fullmesh > sudo ip mptcp endpoint show 10.0.2.1 id 1 subflow fullmesh > sudo ip mptcp endpoint change id 1 nofullmesh > sudo ip mptcp endpoint show 10.0.2.1 id 1 subflow It can be seen that 'ip mptcp endpoint show' already supports showing the fullmesh flag. Acked-by: Paolo Abeni Acked-by: Mat Martineau Signed-off-by: Geliang Tang --- ip/ipmptcp.c | 20 ++++++++++++-------- man/man8/ip-mptcp.8 | 8 ++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 5682c7df..c7b63761 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -25,14 +25,15 @@ static void usage(void) "Usage: ip mptcp endpoint add ADDRESS [ dev NAME ] [ id ID ]\n" " [ port NR ] [ FLAG-LIST ]\n" " ip mptcp endpoint delete id ID [ ADDRESS ]\n" - " ip mptcp endpoint change id ID [ backup | nobackup ]\n" + " ip mptcp endpoint change id ID CHANGE-OPT\n" " ip mptcp endpoint show [ id ID ]\n" " ip mptcp endpoint flush\n" " ip mptcp limits set [ subflows NR ] [ add_addr_accepted NR ]\n" " ip mptcp limits show\n" " ip mptcp monitor\n" "FLAG-LIST := [ FLAG-LIST ] FLAG\n" - "FLAG := [ signal | subflow | backup | fullmesh ]\n"); + "FLAG := [ signal | subflow | backup | fullmesh ]\n" + "CHANGE-OPT := [ backup | nobackup | fullmesh | nofullmesh ]\n"); exit(-1); } @@ -46,7 +47,7 @@ static int genl_family = -1; GENL_REQUEST(_req, MPTCP_BUFLEN, genl_family, 0, \ MPTCP_PM_VER, _cmd, _flags) -#define MPTCP_PM_ADDR_FLAG_NOBACKUP 0x0 +#define MPTCP_PM_ADDR_FLAG_NONE 0x0 /* Mapping from argument to address flag mask */ static const struct { @@ -57,7 +58,8 @@ static const struct { { "subflow", MPTCP_PM_ADDR_FLAG_SUBFLOW }, { "backup", MPTCP_PM_ADDR_FLAG_BACKUP }, { "fullmesh", MPTCP_PM_ADDR_FLAG_FULLMESH }, - { "nobackup", MPTCP_PM_ADDR_FLAG_NOBACKUP } + { "nobackup", MPTCP_PM_ADDR_FLAG_NONE }, + { "nofullmesh", MPTCP_PM_ADDR_FLAG_NONE } }; static void print_mptcp_addr_flags(unsigned int flags) @@ -102,6 +104,7 @@ static int get_flags(const char *arg, __u32 *flags) static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) { + bool setting = cmd == MPTCP_PM_CMD_SET_FLAGS; bool adding = cmd == MPTCP_PM_CMD_ADD_ADDR; bool deling = cmd == MPTCP_PM_CMD_DEL_ADDR; struct rtattr *attr_addr; @@ -121,10 +124,11 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) (flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) invarg("flags mustn't have both signal and fullmesh", *argv); - /* allow changing the 'backup' flag only */ - if (cmd == MPTCP_PM_CMD_SET_FLAGS && - (flags & ~MPTCP_PM_ADDR_FLAG_BACKUP)) - invarg("invalid flags\n", *argv); + /* allow changing the 'backup' and 'fullmesh' flags only */ + if (setting && + (flags & ~(MPTCP_PM_ADDR_FLAG_BACKUP | + MPTCP_PM_ADDR_FLAG_FULLMESH))) + invarg("invalid flags, backup and fullmesh only", *argv); } else if (matches(*argv, "id") == 0) { NEXT_ARG(); diff --git a/man/man8/ip-mptcp.8 b/man/man8/ip-mptcp.8 index 0e789225..bddbff3c 100644 --- a/man/man8/ip-mptcp.8 +++ b/man/man8/ip-mptcp.8 @@ -41,7 +41,7 @@ ip-mptcp \- MPTCP path manager configuration .BR "ip mptcp endpoint change id " .I ID .RB "[ " -.I BACKUP-OPT +.I CHANGE-OPT .RB "] " .ti -8 @@ -68,10 +68,14 @@ ip-mptcp \- MPTCP path manager configuration .RB "]" .ti -8 -.IR BACKUP-OPT " := [" +.IR CHANGE-OPT " := [" .B backup .RB "|" .B nobackup +.RB "|" +.B fullmesh +.RB "|" +.B nofullmesh .RB "]" .ti -8