From patchwork Mon Dec 11 14:07:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487290 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="GTV6GZQd" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2040.outbound.protection.outlook.com [40.107.101.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9041BCA for ; Mon, 11 Dec 2023 06:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UWAh3HTu1wQwC/rvq/6BDwU6Trc1L2QH4ehaC3etwySH5RfR24QRQV8AmOmxyd1RshcFam+gMQfaJMi3+2jvlOIa1lcTs4u3FGiZVuiNf6jf3GaHisrgI1tDgsb4gol0NXUhh8QJieZRGxLUnkQSDe6W/1vMNFWYW0UfxNubBIGWpM3xNG/KcERhFsWwTJ/vgHu6Qfmb544d8yT4wzyhNQ/08PtlF92sHnnseKfHxOlQaBjkspVrjowq8oKpCgNCmaAmZDyN/AxdZrf0dsOAgxp7YD/bHaBa2f8hD3UppVvBUrXoR6bkfRRqE1BPqCzrEQE48RQ15F3f6qnLYzaGvQ== 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=UEwRKsN8EMPkjqPsv+9VR5Q6j8mT9OXVY+QH/OTEIOM=; b=dGcCSSNtzK9xIG6iNsVRdQNcBtHQyjaIZIEAe/J9kyF7n1W8lgJKLDSdipRkrmrZa1ROYvSXq2cl9VjoM8XCHGhGmpZJosnSXziHeGFv02uyDw/R+fTPXXlFVGM+kdfRgUEF0Y9ok7JoMP4YSqYoKCqx32icAkAGCs7PCLGq2vADp0Te1g1Xvpq+RSyI0fUx8oo8fy5pArMXRHD7spqIs5gPELGOmSj0FkqHnaCZBmrour9nRg5b2WJLh6GNZJglzcwDJ81cBUDP05PJsuYqupZxZ0YplZEYyEVixATPYIUNg1+L3Ybdo1f/mqhHYdu+pMuMs6+JhzDK+FvZIrlMPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UEwRKsN8EMPkjqPsv+9VR5Q6j8mT9OXVY+QH/OTEIOM=; b=GTV6GZQd/fLXxkmBW2mUKrXZNoXGwOCVEd7fAzMky3MwBBlLxEwjs58VIAcx3HPLIh09ILRYt1JaiSyibZe9HgXfiVvh0B/Elu8GH26ebetTBwGWxMj5KqQh7LQHwiHTI9BbCGLblGiuBRFie/K3j5kmxa3LeaoOGCckfCsNaUy8cEKrCPElJOl8Vtaz8SS0FfeMqI1oDhEKTGKJjccB718WXNVUVokR9NyA3NDK4QVsJV4o76UTH+bJS0WOyHee5EH8SVh5oGyEX1h+Ga9bHr9neQ8VXU/QdDd0nQkLEyrEnSgsrY9IKt9yMZ7RPEa6+9wW195cUWFeCVQBBhSLaw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:51 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:51 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 01/20] bridge: vni: Accept 'del' command Date: Mon, 11 Dec 2023 09:07:13 -0500 Message-ID: <20231211140732.11475-2-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0321.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:6c::9) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 278f7bbc-a912-442b-35a3-08dbfa528fec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ROFfiTgSw/yqM/wSw/jyhuuDUS/SrjuJeSDgbVt3VFjW8nJEF6jHKXKMxD6Cb4fUGOzKFmmavzkvhlJouXcUFejquIcAv/uNp2nNNTNZBe9wD7kceonNMeN+SXo9clMhfotGm2QMJ06q33GbKR7YS3WZcMx+nB4TvZDVoTJ0m81pNbFmnP0Q+OBWOjimqP1o0v1WSWaM0O0YzkD04XsobW2ndKOnjZDqjfnCH9I1rXVbXRoYX0OU56TOgWpLT2FdOSeVJPPIWOH3S6kWII5TQtRsrETBBdk25mkw0Ofgz770RtqEjdrNRvjMmj6DqxIAtSbJoIl0Az0cXczzc7kRj3uI1OjIiYGRFhX5tGb1PNgk8c1pI7UA4tNDDZcrE3fe9eQkVBir0F2ebXEpU8HC/0/pT5NThBZt4tmZxTjWx+6OMjliZpdzPwubDVlPSuN+GumusBYHNgL4dvPnkOQ7a25YoUlcsCoxZEg8NTELur/hNfv22guhuSd1UILWuVve5p8o9GCtQ2nsukee3v4/3/KR/SI77fF2KuxTinQ8IjVhi7KefVt88xeCyRD1lwai X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DgYDhR1mLPttuHD1kOckLLFv210i7AKibs2NOe5fais1aRHtUIUL3lbpzQQ67fzwl6BjRDkLTTwi1DUOdWGOimxIFiGC9fZ21/SWe/i5XqDCOi8LSItDvV17wwQ2Nz2qcxLBh/iKpYEEh/Adgn0vscbHohFMSHoVFXJG6yjgIL4FmPPNn4b2+v1zOQ8Wqd1Vrk/N0LpEzxjDTL2xN2t9+x4S//f/i6Rz6RKOCskcUtmyoMfDhn7KKNlm4s2JYbirfXm4TPoS2L0HgbvvpJqZGk2TY3MW1nQgSwlbFqygQYkh2h/roDoFarMMpXLlJWj23LMlv3onK/MjXxlOrjFw6UWSrLLTYCNyivL9dBoMQvJY8FsBzDOlrskNE/RXrJAtAa0rEZ1BkZ1mSrPgmugxSkAu2P1LdfHuIAbj5YPrkPUttv8K6WpO5HqDsIp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dyeSSPVvH7C7BzlwBFimxS63FoTkG4w8cgqfqFeE/lH3Eke/Zy4IdrjfdusQ1zsueB6ROEvlnNAG/qOD X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 278f7bbc-a912-442b-35a3-08dbfa528fec X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:51.3374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5ou0BzTeyLrGckE1VSczNHK1DLvp9rUpursQdU6qWdtP8w20RPBc7zE0ve7j+508AZXLWyVU2HHRimhJm6YaJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com `bridge vni help` shows "bridge vni { add | del } ..." but currently `bridge vni del ...` errors out unexpectedly: # bridge vni del Command "del" is unknown, try "bridge vni help". Recognize 'del' as a synonym of the original 'delete' command. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bridge/vni.c b/bridge/vni.c index e804cb3f..6c0e35cd 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -419,7 +419,8 @@ int do_vni(int argc, char **argv) if (argc > 0) { if (strcmp(*argv, "add") == 0) return vni_modify(RTM_NEWTUNNEL, argc-1, argv+1); - if (strcmp(*argv, "delete") == 0) + if (strcmp(*argv, "delete") == 0 || + strcmp(*argv, "del") == 0) return vni_modify(RTM_DELTUNNEL, argc-1, argv+1); if (strcmp(*argv, "show") == 0 || strcmp(*argv, "lst") == 0 || From patchwork Mon Dec 11 14:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487289 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Pb+i7Uva" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D83B51FE7 for ; Mon, 11 Dec 2023 06:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gULcy0nnajBodBVq3aedpcWFce6SAXbO6wYV56ET68Y16znRpGouLI7uvySU3wE1iCc72EuLl3CW6LTt8EsAH0E1aFxdhTi5iiKQemlbVif2AqelWn8Bl3UwXHkTuZYMwCAt96ignFJGjPx2tyQsortyFEizasvNfEj3T3XDKvbzBIxEDDwQ0Tt35C5I1EzWLz9duusKcZKg79HKCJvrx6/nbVFkdxMzjQ1cIhK68oxGgGKzgoKsrPVffp5msUfROKLCyV+/FS3RFrAs+ScUOUb2CZutmQvEcoKWL1n1FmYrpqO9Ab5zC5ArfNZDyQ6D27SLmNdnEzDgM8yNdwYobw== 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=9YkmK2skxvSunadKnqDMwdQqx+jkTJF00s5q4EPTmmk=; b=K8f/Z/3ctHpgBlgR38/gAaMZmIC/cEvz7rR8a+facohgeopV4QhQYVuUyDMjAogY51QgoZp8YQ/3fc5YlgI/AlrDvRIL0KWRwEWSw00qSlXatmS2hV6DQO/QT8QUeeoxgJbhLuz1o7rzrpMAJprHEW7wLtwjTunwf5NzIH9qoEsF/Dg+g8gHEwHzlHlC3HYvOmF5B6p0AxkyPmCY0pLIG6OPdv8bhaPLkBp3E9hAttGBL58pJLcXZFug4iihz+feR/scF7T++5OGdbpACFTOlAeGyC0aBVRjv42Nzhj9mSLvDWYSmD7M/zz3Rm5vVsxb1OfyabUcy+47UQWhqHYYsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9YkmK2skxvSunadKnqDMwdQqx+jkTJF00s5q4EPTmmk=; b=Pb+i7UvauxjLdqEu5+mfyZGLRKBggdzCrzu7D2mnVKV1IWh7T6nL6Lv84zZkYnN+9UTSjhj7sqFbPQ29dpkzzAO08NDcDBIyIhYwKRHuo4Vc2ZLv5Fyjnp4xzNupyG4GmZFxaoQjDVaP8YocXvxXgmk3hJToX9iWkjkinE1ziIRcYxBRYUWbEZeihuoMIjWKmn0oKohlF3mxv8s8TlVYNHM0vKddz5VOMWFBL/UopaORgmDCUbxfx0yxqR9wuNw1K4/RvimSdGDAwz7spRY22g+nI0mer+Kk5Lncmbeoy1Lo4/v/LP4XtJhXNqX+d+KgLbq7eICChYGkpLou0trvUw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:52 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:52 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 02/20] bridge: vni: Remove dead code in group argument parsing Date: Mon, 11 Dec 2023 09:07:14 -0500 Message-ID: <20231211140732.11475-3-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0051.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:2::23) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 478f50a7-a4a1-4f00-e0ad-08dbfa5290d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +jdgrRHvG8qa7LbMXFKiQvXyq5rg3i3har9L/b60PHa5foJ8AXbt+varolxcOSl1pF0hkvoJpOiFCtUWaajkC7W00HPp1g4ksA0px5/G7/WdyE3Cg276f+h7UDymWuSkmG1NTRvf2pQo7+qwIUrMZSd7Ak9a+toh8Q+HLKuCtkX+GOaJhQUVRtuwNmTELzcTLHWHXzkxDztm6V6W5oD9o76hMEMBdKTlRPHRG9D0BbnxrLiU1ANR43GBSnSnj41Z5Cb0CdnLRKs43tFrTjQ01+Jzly0IHMfKsgnKywiCphrFabUlU11rxM+XLO1dKxH/YlBElh5DULPN/2OUszHHxBSDTCLZ82TMuuReDdFOXRgSgKXSPKwjrBUeLpeKWu6kZCmBuy51u3tHqFk3vRDII12jgHhetlBVnnsGZPODZTHgwUaqP6QwS/lICzkkGK9M0ZLQgZ/Ha+UO8eAkZHZ90GIDsJoC5J4A8SSrVLShDIoGLXyxUOaEkq54hG7NhzEZrzHDjwxznD0upPb8W5E4tuzpMtZF9IHXCiAmIDaHQDSn8OdOcK0OSpwXCrTYTEip X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tgiE+iSBlIsxgCebb3bhdgNEXzlqgg9QBT5aTCjp/sm0ug17nO+La9jPBJQJfZaXGL40wmwXxX5e1WE4OuQIe0NjwYEzD/THDMJGGGcNIaXz6EdkcMwsPrN9wR5xCXXpqubMJHRxoyM6GL6zd3AAaPZWzlTvk1X3DEnIvBddrEjvRMckCkuMTX0pUi7Zizy8Mqo1uJU6+tJ8DOt39Cz6MF7se4y24pGOV32gSeKJc/Kpfa00gMhcszskL3L8h2lFwUsM4S7z0uaNDmJSz51ot5Fmwj4SkvN1Aia8nDBfJyj3JErV66l3zOkSwOs92WE6yDJvjBV4+M7NidWZDin9j7HtwqpHQW/dbBPlIENH5bHRYBO64TS5vTMQAYr4bLPUKtsd8d/78z7zo1Eqppi+9/c+5eNMTfAhBNoSMrLXTbBLXA0rH0SW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NXEjfeYWkOCgUiQOcowFRxQ2i1oao25v9AH47sPuz7k/xu9XOdk5XwYWUvaSaTnD4ayRJ6LQTHRZpbIn2CuPiQ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 478f50a7-a4a1-4f00-e0ad-08dbfa5290d5 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:52.8552 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0MN1dsqN163zNQyH7kI0eKE8ajBDa78fG7N0Z6vDdXQnmfkp4JoUiGYqtNdLpU7U6x3jNQ9Db5YiZyZrTEH6QQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com is_addrtype_inet_not_multi(&daddr) may read an uninitialized "daddr". Even if that is fixed, the error message that follows cannot be reached because the situation would be caught by the previous test (group_present). Therefore, remove this test on daddr. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Reviewed-by: Stephen Hemminger --- bridge/vni.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 6c0e35cd..33e50d18 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -109,11 +109,6 @@ static int vni_modify(int cmd, int argc, char **argv) } else if (strcmp(*argv, "group") == 0) { if (group_present) invarg("duplicate group", *argv); - if (is_addrtype_inet_not_multi(&daddr)) { - fprintf(stderr, "vxlan: both group and remote"); - fprintf(stderr, " cannot be specified\n"); - return -1; - } NEXT_ARG(); get_addr(&daddr, *argv, AF_UNSPEC); if (!is_addrtype_inet_multi(&daddr)) From patchwork Mon Dec 11 14:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487291 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="f4OU8TbS" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B803C33 for ; Mon, 11 Dec 2023 06:08:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjDeJ17lIV8ej2D9hSlu8EoBEDSkuhdiyAIs7R7I9GbBqwAQwqHGy3r4iZFDqjZIz01NRbIk/29SQKNOiHeD6u7jRx+TUgDiwBEnQqd+FQDwAdf/W88yTvUSQzKJiHFWoZ8iGu+ArRdTvxp2ufm+EEHfEraYBON08SqkdJDeTQ7EOo2s9BIM3YkybxKzSiWdwIlbpyhOHV5rfxC9BXHWVzGYFXsFqPUxilAVZU08ZrCtIsG0Nclo9lYyq1yOZINDFiigcsSwII68lBcc2CbSBohyAk1ZHaLTOOZO/nEsMIBdudH0Ay4S3tyAb6dXD1G2rer+XRUHk7LrbykbeBSjcg== 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=Bj2hadTYtWINkR+AsDGSoZ0RNbRtYHHCKLO6YrOkUfI=; b=Qu0a3iias9nF1OZqXn2Nin7kGVxrCi1Hg4yKiUABbOtrNwvKRJW6SPGKwJXPx4LnFYcNoyJpsvriNewGkaojTWMcDpBJ9qB/VqM4VvIpjh7WfoHwHe9aCyVHeCNhOaVQRVMQRzvHr+8axmn1zfowlhcT3mc1B8Oy2Qf8rczoUS7OKw26l1AP3EpWtdg9tBKHmvLkF3pB3dE5JGrdKx/nxlMotzXDA916nMuYVcCiCoZUPHuvn8TPfEgbgOeItZ21JbaWwPSo0ZlU8gEErSYukS0mecORFhZO3T0owyYba+D1qh994zlQvnqnCcZ6a8UKhLIKjIJMHN/sqtfPlsVySQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bj2hadTYtWINkR+AsDGSoZ0RNbRtYHHCKLO6YrOkUfI=; b=f4OU8TbStef03i4qOsR2U8QoeEgk9ok9U9yUKuNpGVZV+Gv2aoOq/qCTJKGcezwx1xlPYEpOOedMuqqhOLTB1tsTH/Vm/eHnzcrf6P/X+I7foBFbJf7y6DYs8UmzMRZmmOgF41BmL/vu+dukAWoC5PRU6MOEhka+po4gNKqXnek3Et+WumRliG/PUUoE8kHUhQ53Z0n/pSTUJBVrRc6sGqRY3Ef1nRhQNkY4B/6pmu4pd+Hs2c7horh68nM1BOEBumg/MXeUBDt6pyO0zNhTUB3mc1I01S++PxXc1vHDA+Mho/xiE0I8h3YnhIPEHTe7kNHYTWPApyDzmtI4uBuNOw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:54 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:54 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 03/20] bridge: vni: Fix duplicate group and remote error messages Date: Mon, 11 Dec 2023 09:07:15 -0500 Message-ID: <20231211140732.11475-4-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0049.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:2::21) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 07d0f304-e90b-47f8-6346-08dbfa5291f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qs+msj9au6r4RWwymMicH728qeySKj4Ln0CUadMVbF6HTQA9ZS732B6Fcw80bMn4H7pv2nYm+nD++ZghxtsGWBxzX8ngISwF1LaN0AMW/1WQ+7Wks3qB2R8WrqkG29J+TrCWWLn1+5WR5+yBuAy/gK7i7spPf78pi+RC1MOJZCeUNONz+QHq8SmSMPBgy2a3L97ZlxBfXhFuly0MhfVyRwPpqayHQO/kv78njlz5MoW8dmGOox61lTQJYIu3lsgu3eVel91eBCxCgFwCRpdDHG+6gH+EoCoa3jOIZqAFAqOIeTX56mjMoF6RtOjcX+qjoeqcKXOkBoYZ3dbDHSE8ogVQCPNHeJx0r/59eH0h5bHHTT7s5H8oJXgfzhAapv4O8cQoMHcsq7GlH7QSakklBXWN7wOiHepCMTsHcG71hwaNmzjyYhkL7l05+vSVYcBmj6kvBAQmogX70TdyJ6yk/8aOFSij5rf7N7dGsK2HqtxBb+lKZ3Igk04CKuMJtl+1Pahcghpn/uwNSL3KpC2hdnjpHtYVWoctJSTZ6MkuGtTbPSYdpTAodyF/ZfQgyPFv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(15650500001)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aQznP7Omv8Em2yNo+O/2WYa7u5qYUK6kl9Uz/EVpR01TnKdeiu+Gz4rwnNLD/+1f+dPTeZoVN0McZq4MrJL81W1b+kHtoVd04k7rGgq1lUD1sfOsBun57MqlEBuEp8wDwdrh+YZB+h88MPbZZYIpxo8vPaEwCtxBi1uxBn5ic56v2zVlCPNnYDoBKr5w1cBQqE+9DI+z5cJkGRlD8D/g4KIzROrAlrrMGBIev1enINYS1cZT4fgGWd0l1ftefsqiyuXRVKf2JTDPy/0nIkOIW224i4bLCcIQLd3cFRkWQ83ZNk4CBRB/R8oj8yHvJlF98gmi+hiD5NAKn/OU/Tik6hAEsK1ag9LY3xa+6VenDJ+F2ZAAzdN/axMp3ALVru3muQ+I3PbWJ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Pe/5r8U9lw6tm+tKGiMyCxQCdFzcsrNAq3cf3oK/TUI8quqNZM+0pW+dKDVPh+rCx+edRDzodWMCWp3XTFfHFYgI1EzxiMN2H5x6N6VjYfMsLqIBWtIStQkv6dL4 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07d0f304-e90b-47f8-6346-08dbfa5291f6 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:54.7611 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y/w1rCI+GqvhsR/gAm5hVvfIoX8jHFLaVvAumf3z/kQ/uZodPh117qsKcKeTHq77eT3xxfFs1Qdca2QEeMkv6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Consider the following command with a duplicated "remote" argument: $ bridge vni add vni 150 remote 10.0.0.1 remote 10.0.0.2 dev vxlan2 Error: argument "remote" is wrong: duplicate group The error message is misleading because there is no "group" argument. Both of the "group" and "remote" options specify a destination address and are mutually exclusive so change the variable name and error messages accordingly. The result is: $ ./bridge/bridge vni add vni 150 remote 10.0.0.1 remote 10.0.0.2 dev vxlan2 Error: duplicate "destination": "10.0.0.2" is the second value. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/vni.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 33e50d18..56def2f7 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -92,7 +92,7 @@ static int vni_modify(int cmd, int argc, char **argv) .n.nlmsg_type = cmd, .tmsg.family = PF_BRIDGE, }; - bool group_present = false; + bool daddr_present = false; inet_prefix daddr; char *vni = NULL; char *d = NULL; @@ -107,19 +107,19 @@ static int vni_modify(int cmd, int argc, char **argv) invarg("duplicate vni", *argv); vni = *argv; } else if (strcmp(*argv, "group") == 0) { - if (group_present) - invarg("duplicate group", *argv); NEXT_ARG(); + if (daddr_present) + duparg("destination", *argv); get_addr(&daddr, *argv, AF_UNSPEC); if (!is_addrtype_inet_multi(&daddr)) invarg("invalid group address", *argv); - group_present = true; + daddr_present = true; } else if (strcmp(*argv, "remote") == 0) { - if (group_present) - invarg("duplicate group", *argv); NEXT_ARG(); + if (daddr_present) + duparg("destination", *argv); get_addr(&daddr, *argv, AF_UNSPEC); - group_present = true; + daddr_present = true; } else { if (strcmp(*argv, "help") == 0) usage(); @@ -133,7 +133,7 @@ static int vni_modify(int cmd, int argc, char **argv) } parse_vni_filter(vni, &req.n, sizeof(req), - (group_present ? &daddr : NULL)); + (daddr_present ? &daddr : NULL)); req.tmsg.ifindex = ll_name_to_index(d); if (req.tmsg.ifindex == 0) { From patchwork Mon Dec 11 14:07:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487292 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dq4IW8l6" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8414EA271 for ; Mon, 11 Dec 2023 06:08:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Umv1nmPhnCVmeS2ZZLXzQk4dz8sRpS1/gtN3sDNmKP+iOgOc5QzoBP7QPcCxWole1zqDYPqCzNMXvVfCAaIZTga7RXMovDbEEE00xaxo7dZNkV+znYt4fDPVRguA5vbDDNw1oxWeMOYHf4AZr4rwCcEvre8ouco6OAg1xdMX2/Fix2SDCQLH5ScTOcgDnrjPiN/l4fpeFMDUIp2ow1iktN55ARJevHlzgEsCiyn/zlEES7/1+6WbYIwmjwuFXsY2H1E0bK/AGE7mRvQXBWXFJNycInliOoOF6LHEsmVTdGXjsPeMj6vePQ6idGgH8haJCy2m9RUMzsiok9lq0fKShw== 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=I8R1UQsiA6dDOkuokHfnYZDxZ0EZG/j2KbSFQ1QdATY=; b=ZJ0tckOLIH/q/CBCF5PpPUDkTRRvkHpiGRsL0+cephoGtBoNNTJMP2cvtpog8icEFzVhECC5MlkcJbF3hNeQN8QUZTXxfcI7ihcAf0Nap3AeurLpD1G9VXDnd5AlDzFUpdT5R++PHSDY7QAj1kH0KN6Zz+//OjboTzJ4l1VHjauVvdedZsu04zHFfhyWkmxyYuvIT40nAFPdguXRTFBbrKBtRUj0Tqs60HSDVxqECF3ny7DNQUJZNnBfdphtUt2r4/V3OqStqIiSO3OlxsfoA8Uj0Iqwr57k20v7WqACV8JHrkIrQg6FZFYqgIFI0FNiEK/8qCtJRikBl4uSdvskbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I8R1UQsiA6dDOkuokHfnYZDxZ0EZG/j2KbSFQ1QdATY=; b=dq4IW8l63I0AE/ZdDSFNdGXwIpKHN45P3RN79DAqZ3R1pbyexowQx+pDDA4ULe3dLNF+rllhyX5OqWMRiZONIyBE4g53mfh5IS+S94+eYJKBMkHxj/6SZYkygrVtC0vaXOQM3OvFSZgQWPR30gEM4zyjBPpgRnJGTNZ8bSp7r/UYUYVbYc6zuFicFekswjI67eiENQqcuinmXDNz4tAa6JAguesWRskosJ8rzaS6T2XdMhzZuF26GKpESbyNTdXXtiuQFXd3NqSc4/SvnlEh9NtWDflUgsDnX88Y++ilTXnirxXnuCS7ku/HYAqSZa76tlQA1EUn2AqRclnb0nadHg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:56 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:56 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 04/20] bridge: vni: Report duplicate vni argument using duparg() Date: Mon, 11 Dec 2023 09:07:16 -0500 Message-ID: <20231211140732.11475-5-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0124.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::24) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 756999a5-06ef-4ba5-97fc-08dbfa5292e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 05sQqyS7dLAbj6gpdiD5vDZncjqHE3HtXc2rs1ZZTsDAvthFcUyoIvxZaHBA6b11uR5rI4oTvtxF4DUz+mKEcM5JTqtA9izRrg/MNBzTxi81N7krCUJ8Ay5QW9t2Bw7rPjGgK9of6m9WtN1fGre3afW1cKJI80lWPhIdVOOtDxFOd7bSpZbB8MY/e1Z8laL/taMf4zOFEB+Wezb/k4qpVEBJ7lvMg0lselDwKBmifJDb+lK8jb2tugsw2QyuX5f4fFypqYN6O6TZjpG9rkCc9U2vpCNQxxfz4gI9xilW8RZXKQqsn0Rz22XjFZVA0SKU//aHc9Dfrx86GJ333JB/L+k9E5Tx5wB5Y42jhz1NB51GZQSyBUkhg4rRVXE8wiwskWeR/zfgCoLD9nPgWtCSyHLCJuOpOV6Y+Kqt/AfGdFKUae5lcju/biSHuenhIzjmpyT/ryKmqYa1paAHp+aFtzdXxjn7OeDDyXzVUJc79CdYrG5UPXRjB8ksYHwvSHMFSWgoFNkTxraFHPWuk6dq46KT2wfbTMCnPrsCJ+z6HWoXfsWmf7ZehXVfNGjrHQSN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(4744005)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pqVzXjegoOvLijk2nTGvI08EiX7T5lHfMLed1ZLYCtl+DX9RuT1tfTCu6R6+YmX9Ojs8u01GcZFESjy496ACzFyKQ2Dh73ENsdrCtWqPEzFsEK58pLFPtWqXBPPRbKyWYHVSg/eeoYNZbGTyylz7nqFJkoYeQ/oBdAcXQsUxDpGk0U1LDDYyhhSrzsg34jqidL8xBxXQ/e8MhkAvjD31/QPazdneFdayHDIsLFG+hj87oNWtWSZnq/TPRYoRHSlTq/WdZfqqAyt9DZIf7QrkfjiSJBOyhkVpZbN+kYNZOBn2U9El/LW86c4mOIQCZFY1+3ESZy+5+bgjVX41aXpTMOPvem1EZWPLH5hPRB5mOBJ0GWgYbVcKRhQqyK5HGPJPpqGyxxnGy4IvAqMArde2lyK/M1GjWxYPgW2ljweRDWLBtGArDy6VjnXjsXGEvbFgMF3getYtNq3nGY+qRPtHGBGbw+JigB4Q+iaaQ7FT60dcK2d6Yoht53HHCoKWRWkWkuzpBMdcSc0iRqXxqZ55DZU/POHfroWh0pqpMKPXUEDygEzs4L4mmVExxHMhA2ixQaMQYOUSiPaoLRbvQK1azCTGjF3vXdXDQonBkbxrkM7yRNdDgKVPv8oNw1LMwFbJDIb1LNy19wepUahGW3Pc7UOunwC2RGfwlxHsK2A7gsSIbVXj15W4TkH42DdTAliWFXTOVtOSHzLCT2VAa9CsD1bwoM7P7IEPPq9Qv5VwJRxVD//XDmD6W6NzBDnPkiCM56FykkyiAmgHwCO7V9wZtMFeHVTAZGA9W36JeVX075SsAVV9Hr8olAyfKC+GflAuw62KOjcGUiM6DsFwggUBYBWKF+UZpZStyV6NBymCyIWJ2cI2qIP0HPyFNqIg+UajA2aKaA3R75SA+H+rL72TO+m6YKJebTQ45SIjluQRMQaYEKoVrI9B0GEypPUf1R1llTuyPJ1WsBrkXW2meLkcmIg1edSomIBWK5FYg7AFs4EIpUeC+mcVJRQ+ahriGVb9iAy1qYePI7I/Sj3samHFKZwKrvoRjitnR2QK90GNvGlJcMXNCyzHsUK5kEcW/yIO4wAh1uUew15tyVsxs/5oFFYu0oA97PT4lViJw21lbaOUzjTafpiQdo5ty9TcWvYOyKGXROtlGR5OpkxY91LXXIBQzMCi+BVcASiCiNMO36+I2yI+C/5oifcBnkPHeCQZIDuTOPcKfgLg5rXM9NCbufFb5/DLhuTLceHu785RxHX+8Q70rYNpECPJJPlSvTigb0sDrrPRf5tSbhwDsEqFtjAGo007h+yFOF79r9P1qAF7kPhB7MoDmbAxdjVenJeh5Oh2UbAGEvmbz2SMSt0xwj9TUNMlfM0MK/s8xoLjQmSeMzC9PtwjxZ9QFeJC0Q2LIz21Ap3soFYWPStCw1VW3/5uxEOYeLTd9AZZladfGgdY6AFiu0ozigcP3zgUWiCHfxoz6q7Mqq+v8JnkAhfkZoJOyjweP7If+5fUJ8VW+vjR5pqONF374xf7DWOzVDHNYrDsF8OiWAFAQMuiq4JVZm7996txN9U5iIO6oeT9IZ0M4GLwvFZKyRiY7h6l1Fku X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 756999a5-06ef-4ba5-97fc-08dbfa5292e9 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:56.3245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +h7MYV2byyT1BSCfRVpTvblUu6P9K0Y9FSou9aIHwNRNCYsWe3w0JNVl4SqB8txAdDDPRyz5y9tnwZOsg/XN5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com When there is a duplicate 'vni' option, report the error using duparg() instead of the generic invarg(). Before: $ bridge vni add vni 100 vni 101 dev vxlan2 Error: argument "101" is wrong: duplicate vni After: $ ./bridge/bridge vni add vni 100 vni 101 dev vxlan2 Error: duplicate "vni": "101" is the second value. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/vni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/vni.c b/bridge/vni.c index 56def2f7..ecd4c2b5 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -104,7 +104,7 @@ static int vni_modify(int cmd, int argc, char **argv) } else if (strcmp(*argv, "vni") == 0) { NEXT_ARG(); if (vni) - invarg("duplicate vni", *argv); + duparg("vni", *argv); vni = *argv; } else if (strcmp(*argv, "group") == 0) { NEXT_ARG(); From patchwork Mon Dec 11 14:07:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487293 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="a2dZcJWl" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2040.outbound.protection.outlook.com [40.107.101.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C932119 for ; Mon, 11 Dec 2023 06:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cVFPrlPyANLI+TCmAFqBye9y9xVOql3YZkF8lvuPEofBQwBSEOrYyFB8zqLIb2/LwY5AO7VXTR5B/PbxfsL1gKK0LDakUX/qY0FVx5DZ52b240/QWoj2nC0VLvE6gasUGxwXcPmXdUTfuTPStl/CYIBNNMBoZAUrjkdO3lCQRdF9+V45b8Spxi8YUnUJN1KW+bPEqibNvVVlcY285NZmNPItvL/HQ/8WBdkzpfy7i8h+RRGeRVKDzBgU2a3MWca1/qt3ynQ0OKq3kT4cXMYpdOw+5eiCPlNZxWsgbcqA3Tol0jQAsKJwFtDZcRoBrySDK/5z0EcvI8qWsKB70BSqCA== 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=Q6+vWAV9iAlICSncOKp6CFqGrcM+t7zv0Sovk6bsLh8=; b=Rm4xE5Y8XKO2+8dAeGXdd8jyzmX8OenIJft5Q14Bu4q6IPh+rAESd4Etz5fK/R4MfSIMiw3MmS48pPWHSqviQEFGEqmfYZBRP0XSKHdbu6/JqX9z+V1RBQYENf0aN5SCX+7RQil0gGE0oL/6LMJbybOFxPW7VuSd0w3OcPOPWBQOlRrn/S6bPVmbDqXuYdpq8SKcppVnwqhvLC6lEByc47Q51SpiPPD/DnmNMVHpEEXuUlVypZBwiJ2nL+R9xhNWUgUspSehKO70odLSygsdVel34/c85XdC01ZWKqetonLZ4/GjmTvg4HGL17U1wTv5buIGd9e6nheVUt0WYJgzLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q6+vWAV9iAlICSncOKp6CFqGrcM+t7zv0Sovk6bsLh8=; b=a2dZcJWlG2BbpHL+jSNnxlxVmb61N979DXVfefcFv9WoAfr2okPfohMBBaL6dTy60dNNVeIUReJBf/mwyJE9Xeh4K1PxxASSslOw8NzgWRiVdpRealcp/lOzsngGC1tnBeRzGzHojB8mVjLwHYNV0bWEzhqRks+pe+hCNG1PfsZ7uL+QEpZ3b4FsDccN3i8JmT4lw9VYUNrumQyteTUzOJDZK+aO9WVqut/xoT+Xa9/rcEOtTzCBIsEq1HWkuVhVHpYkBV+ac90utXlq3m9JaXYqwGeS3/aZ5+mN2trYpD8QG9eK0c/WKcYEF9gnNJnAoWI45WgmV2zbEWPkHljW0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:57 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:57 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 05/20] bridge: vni: Fix vni filter help strings Date: Mon, 11 Dec 2023 09:07:17 -0500 Message-ID: <20231211140732.11475-6-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0160.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:7e::29) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 59d45f57-a660-4223-e059-08dbfa5293d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wlIx9OtDeHixvS8klrxOOi/1UhZoMxSZLgKtSXtOSN1do8lQPzVvfbKwbI7eKvgNVwhwBMlsxnY8q8uLUlA48osYBdBkgCIwWdl+/EM4YYz9whsVkPSvTbJzpRLnFahNJlFPOLoWM2uUKEptXDeQ/sN+PiqifHIzKoJ6orKAtDxU6zM2pAC8qwmJTL3hEf2NkFcy2x2qpWN17aco9qGkK+0g+9cE+6EKoYzvkJuBePd9VEmyD7aCoVH3SQlu2i/wCdkuHJtv/Qjb1OsHOb2leIQZFOS3GxLx4Tnrho7/thNJdUxZHSBZQ8INFXqydwSHqdhlRFhc6zVbMfPSCNWvXW8IxCsqlqa+XP7+k4B9BrhXXwYT/RRUebSfIDoxePvHB8idWojdKkvaMamv3esCjKbPweqOf1HDBO2G5XK3RA8omKHQ58AvxPJFkhZiujxw+H46ECL7QVEMUnWsjhoE45QJEen7ATT7LbtZ9TJt6UdNMo+hFSMFNCzmRcAn76qrZiF0A4L8yhRf7vcnyfT9dGZGYp7QUxGNjTKfEECKSJ4eurVw54xPkJgZXUeZEzMF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j/VlegC075iv37GTibKPhMnWPCNBHJADRbH6l+g1COnRDqCroKkg3WdRXMyl9ZKTkF4sGV0tWgyJ/GygkqlOiqv98sdQSI88NzjukfnEzvh5XRCUEFD8C55YOrZOlg8fBftuMexB3yWXV52+9hn9ASm0blWmi+7Xsq5wQLVl1gve1+GLnDtedanG51RUYPGfsh1BAAZa9UHxOB4vZZ03a+PBk5egN0K653QgLDsla4Mye0qQ7Uyw90Nr9SpaziSXDOa+VbJCnx0IGFLC3y30qKWvKcSTDTnrfSJNyzVHdZK+gAL2TYhsVFX1c55XxPZn0JacV9PfDLB9WAfHaW2oUuE5uasWlXCx4HQbxA266m1ItAEZ6HHGThPn4UHZ0MdtcfNropVVLC1tVj59B8/tFdprWjF1TBggM5Dqqc52YKKNw50WAqHq/edmm4HwtfiXooGjrrEuno3hKEG4CpJ/SIco9Vlc0Jwz8qT4cqcGkSgBGXr1n8vwXinkB7FE+NtctAEj+kRWiIFXD5DaqViAvieqKkIv+Z/hGuRvwqb3c6teXeSaGi6D+pK2jpRPS2oemgP/F7CiPZCJ6kn5SNlQ3b/z1CvUfJwTvVoXmYOV0MDEf95VAoGpTsxbL1js9A5UfHC1KdVWmu4VUknGpamqwPKy0Lh9YvxPvffqDoImGhu16t32UquZc5OrA/oJ6FdaBBEh5L14wmCxyTzaIjymD2FhdhO/hUwCWsK/dkuuNM3aKsMwtfxnyum+tE/tD4TdUGQXVVPHSftiH4IQjjWP3/zg549+sfC07+BpqVTmJCsgN2BVQ/MlWnwN2xjH5YUBrB5E3fNUBAAVJX3CucReq6o2fO4rSpQd8puhGK0yEgiSaJcTJGUWj1raWbIzQbxk6r+ggugn8ekFLHeOrLu/2GqqkWn++j0hhUvHQ3TyA6yiVEcqiDbtsfePFcHFQ28dza5oTDfni/g5iv/I/6x+gOAQ5+iJN+wqosKjQ+Pn1wGXTk01R/PiDq82DcoE7zfCVc4CGSSWqGuUL/SHWss+MyeQeuHBrVUdWswaKKJowP3/YAxntdJ79ydLPzKs7YDSivpDMrflNCGQbjIyN+/ldB/4355G5wpYecre0ksh9WYGTwmt+U7SlPD0wglWmJ5Sikx3alnm+z1JyFEk1mUCRPrB0dDwnELYBaFY2pX7jknO3Nr2GHXHgIQ3/ndBKmmcrG6nFGy3KkkhN1pKvGysNSz9DsZeCqweV8igFQVQ/byDwCiuRXncvYCoEeQgFv4tLjdqBF7WcIgmaUwjRjcZc04wTw8UjtF5a7XTRBuraIIpujrxyedAEkgbno1bWdWGYWF4vuNlHTy5kU99uaELu6/SJaOFdFGis3RV9E22Mj83o3NIV+cTzVBXx8IDODyTHn7/9mIzViaLT+V/RaEappGuU7EhtDAGQdpr4FpbICAkvk7MgyDWTfSvjBPDG98PwhyV9AZcQySLSCtmUwfGKcB82kAjSKdmb4V7mbdX0+ZlR6D/9mA2EkoCGBaJ1OVtp7GZP5kt7PhKytIPaMQOSNjqaRny6XRMdRkCUOzqcW4kzbWvUVW0BtoFNuBuU3LE X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59d45f57-a660-4223-e059-08dbfa5293d0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:57.8684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Qj9LSCTxHFx94mKO9oxlTNvtJo5maZhGu4kPGnE78XmdWwgGmOLxOjPvJnVYPfPOqe4H80tyhluN7XpygLKwIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Add the missing 'vni' subcommand to the top level `bridge help`. For `bridge vni { add | del } ...`, 'dev' is a mandatory argument. For `bridge vni show`, 'dev' is an optional argument. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/bridge.c | 2 +- bridge/vni.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge/bridge.c b/bridge/bridge.c index 339101a8..f4805092 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -36,7 +36,7 @@ static void usage(void) fprintf(stderr, "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" " bridge [ -force ] -batch filename\n" -"where OBJECT := { link | fdb | mdb | vlan | monitor }\n" +"where OBJECT := { link | fdb | mdb | vlan | vni | monitor }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" " -o[neline] | -t[imestamp] | -n[etns] name |\n" " -c[ompressvlans] -color -p[retty] -j[son] }\n"); diff --git a/bridge/vni.c b/bridge/vni.c index ecd4c2b5..74668156 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -33,8 +33,8 @@ static void usage(void) fprintf(stderr, "Usage: bridge vni { add | del } vni VNI\n" " [ { group | remote } IP_ADDRESS ]\n" - " [ dev DEV ]\n" - " bridge vni { show }\n" + " dev DEV\n" + " bridge vni { show } [ dev DEV ]\n" "\n" "Where: VNI := 0-16777215\n" ); From patchwork Mon Dec 11 14:07:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487295 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Wc46B/23" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B085184 for ; Mon, 11 Dec 2023 06:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CI6tbiOq7MOcKUiztG1uWT4zFqSX2l2UQw/KKSklb5zm7/g2Ib9QslyZkTG9G+5uhyEXDSWqqgtg8TSVqIZGB6IplbiAG7DQbr50Y3qOvXRlphIshWaveFlgnX8VtXOpX2KRxXXaqtl3VR2IFGUwhTB8c5cXkA0mMrVZ0QAwbsXa9mQK9gSJWeulpwqSSRBlRHxEZ/GGH1RvR4/rHVulRvwfEOJTaoJW7DcxSNyEvAHldbRChZB1KqOC+HicMRdoaqdIR8In08acdLybQ2lt/DKd3PvSD/y9rrvrf5wfM+aaUhrUhJzIN79UjZGrzZAlbOliH7GPtW2aKEB2Uy4Amg== 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=cp4t4t0ripjSMkC9FatbZH+vNgAO0yUpab33gxUwfWM=; b=Qs8QXGVBTU9NQd/M5QWXIJWSBcZFbqXYZqayjIfxA7rpYnvmfdjciuDfLacxg6CLh/AdOmikPBkfg7mvKVZYAcf2mOJAQRpM7K5leCDUTQfwEuKS0T9mfsoO64yoEnLMPd1EO1y67rvY7lBo3FAvrmoIbkNStamgJkyWbD6Rr1qrcR0ygNQXN93z9zmqRa4xCawB0RAI7c0Azy2HD8UTdbZaM6huqtPxSBxbEdgVba4owpVSBx4wk9nbGCptWp9icRDoVmQTiqCxbG8tu8L4JdO/ExNxKOtWCqYAitjobDrV4WLqVca3FUtQXjGj50BtCY+QTWTTgOeXVwPN9gnB4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cp4t4t0ripjSMkC9FatbZH+vNgAO0yUpab33gxUwfWM=; b=Wc46B/23gu0OQdwgNHfXROqgk6z2uzb/+kGrkNc6+nhCIBq9QvsOouE51c7QzDQrg2WiOtY754xGYyIhW2nuqzDtsPVZR29/lxHlfLv0ZUndKU08CVb0Ltr+tqpiE47EJkOrixC2uKE9sVSAx8Vu42nPuIdrhxEDmJu/PbpZDAbr2r+R5eKbD6WQkX2vFvFFwpxJN2BN54W/UsMrcsHMmo/Bc8SJcrnbvuj5OXuV4/s9LV8x1sOg4AFitpsOXr4Gi3bYoEX19dmXmtqRI5Wo7oyUHaDAqfJXq4O29QEq7oO0KZ/nc0fUfJlpZ44yW52GYSq0q9/r3XZPDsB4X5r1Ug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:07:59 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:07:59 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 06/20] bridge: vlan: Use printf() to avoid temporary buffer Date: Mon, 11 Dec 2023 09:07:18 -0500 Message-ID: <20231211140732.11475-7-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0324.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:6c::28) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 152851ab-f1d8-440e-ee07-08dbfa5294bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 96t5+vRxR0sOo+W2c9ItuUwhw1eRYrdCueZhPEkn96IKUDpU+4wCh0VdGXiDlY8UkSE00nghnegb0Bhu1V392/1sxkmH9p78wrxCKlrCLl6lzipy4xW4A1KamzsZmkDcAAgz6KRcajLOFbq/2MwQyrW5vJ0bgimet5ZoWPmA0Up6mNxsvOHcAgRFpARpy0HVzubbWH2CYmMChIPQf4XMjNpEUiCUy/C0Pe04rivFFHpjvTRr7iExaGyb4VQdeqynQjbvv3zKyLkfsS/m90sSX3OcmM/5t7nyF8SR5/cvPDRutkS1nhBKuVJXRjkbnxPct9rwiOkqhsMQGZfklvOkMrnZz7xsBAS2mnLYW/tBdylccKPyP4RjIGANwQ0gFCmkQ8G8xdXWf91wLygR6D+9ssSFUWNdvVO/Rju0KFJO73CqX2Pt2YuldeAOrE9qJEu3R0RPuZ7M5UniN1O2anxWGkvVAc1eyF5AKyD3PA5foq+8Hjj1nP4OtKI7HXSdIYl6yqwNSkvB0ipw0gbqlFg9thHRuunvHOTzZN2ATo7HVp2XOFweduNo4pVLJcw0dVEi X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eX+/z93eym44//d4wfW/6xDQpZVkxSyCU6wBYyQcPcEW4WcSdo4QL90zKmaUshmY8bu5/1+dDDBIX2Pp6Jk7x8gGVwy9AE+9aoYjk7h4W7SZVGvFU8PGD+ADpCMkgsFbLmVifEidiFYvRgd+oNl84mE4/U/k32XYE4urXxMFPKjeeaTeimEfE7IqFdMAG0hVr5o71arPfIXfQ+4eU6S/l1KG/gsMAgeZxjeoxkWZC9l/T+MWPhQb0SrdQxVQM7qWiBxfc5kBqG+ohGJKucA9eHhowZJO+gulL9dUpV9UJXF90eOLJREqxdueiznQOpWWlK4f9pu+r0i3SKEgW42cMIRiLAqumTHWIfhY7fYJnEVfxwOjDv7XGsyj6lJh94QzA2onMODswT/cvveicczs+Dykg1E62kbEtDkdKZjhHPYQ0HBwZ932FeY/RtxbbZd7JRQtdjPV3zX6cSWoutiV2ymPuJXmRDKTy+nVOQoIk+Ai+iy31DbxnynQ0FxQ57HVSP4h8NXbaI0xJLIO6ViEoLsHTQesUu/C3Mb74m9nH+brmEHCbug3yXF7WFZweT7GY6E6VAsflHUooBZSzZuIU8uzvKNcm711Ftna/1FykExcTpLdHTj/AD5flr+Tiye7Ak8mWI2dg3eHpjfO6P5i6aOOkwDhxUjuWDrHlzbaleVZx1Xx73DM/THMsx9MLKwJCPQbhbsGFf/RDI6GkIOh9m20xqHPkrxUFLgGkfL75SZNSEbYiGipH98oTl5lpEIDtuYImsC098kMQwNcJ6jt0STIw02dqE8mqUrs5BZUYnogj0CDr90B8mNUWVnb4HQA//UNfTUTM65zxLyrRBmqri8NU58GkeVjzZ0l32HAOBMCBcpf4dqhrXx8Y18LcQCFpRzeA/yTAEcFuen9T3XGa/4CBAxk4K/Dpu9Qqws6gheq3dYr5hyIXJsm59PrIaW+qjbdvg60AUkOqrjRBzspmNpVvG8LnhgCka8XaDVJfriYzsJbKjkyokYAremcVb3kQEEtB27arAvGFWuJaGvvmSl71iSsUZftzYjh8E4mxgcRx8EtdDVPhlS1CSpDh71JdbVkFqTjh3wpnNjwxdLpbhqIKM3l5zFcLYPz1HR1tcppa3NfNixX1Odd6b3DDPBkrjy8N8+xt1tE3imZO2+vrn9T26qUXmXtrUAcWWIbZb5AhD1lvfT3R/hlvbFNKLwmjn5TRIeCR97+gkrgZH67Fg1aGymxxLJoLrcZSIKs2ohyFVoINJ2EvhmEw10YcGtaMIXHgK81JZusJ1KBCP3YOP5jkQYTwplMsPMTqXjNEnKbyqqSYS/AHoxL0kl1P38h8S1jVCJICWFMOEYvbU2MQF9VnqVsL4Pkb3vW+rSaMzk0KWx455kzqXP/INvSb30KV/whFQOcUrjOtZyRepoMBtrYXuN0hUSym+iDYWVXMmKqElrMfdqyeBvMoIUi1kCId7A7iYFrlTIenIzf2ThlR6B98To/x1isG7jFEc9HvS8W+krOoWNk9+obDwA7hnp7T0IRR89EyXj7GnvAzXzarkFf060FZsCaImFQC8+uwpZaXbxckLr1BWkguiywstnJ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 152851ab-f1d8-440e-ee07-08dbfa5294bc X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:07:59.3973 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: opPsqao7OJa0RySNVtfgzIBslKTp2R09JO6sRh0Dhnw1pA2J4i91gBLWB2rUhI1Mf6VWJit2Vzh1xCzNghpZPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Currently, print_vlan_tunnel_info() is first outputting a formatted string to a temporary buffer in order to use print_string() which can handle json or normal text mode. Since this specific string is only output in normal text mode, by calling printf() directly, we can avoid the need to first output to a temporary string buffer. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vlan.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index dfc62f83..797b7802 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -662,11 +662,8 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex) open_json_object(NULL); width = print_range("vlan", last_vid_start, tunnel_vid); if (width <= VLAN_ID_LEN) { - char buf[VLAN_ID_LEN + 1]; - - snprintf(buf, sizeof(buf), "%-*s", - VLAN_ID_LEN - width, ""); - print_string(PRINT_FP, NULL, "%s ", buf); + if (!is_json_context()) + printf("%-*s ", VLAN_ID_LEN - width, ""); } else { fprintf(stderr, "BUG: vlan range too wide, %u\n", width); From patchwork Mon Dec 11 14:07:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487297 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="PMoevxHN" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5942B2D74 for ; Mon, 11 Dec 2023 06:08:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HcYDN6XC3FseNrfXGi54yRTm1oqG+tAFy02TMl/nAFfwjI9NboKbjCjGMEs92uByfu7S9IAKYwEVxwWPh3bI27PkAtc8ZxvmaFa3qWCDSLfI3AxcwqrarXEDRWL/iSefaScbOtL7x1iC4d3Z0bPTVLQU97JisxZF4mUBBXKGZJL4RsBGQdiUJhLjmVpKnaiN/2Jzj3cNeUYqjgA/n+lDWlCg7cZfG3ioHwwynbyMzR1SURVsBhPYfRf+MdTlm1JYKC4L9Ax+/IHG66syQYxlYPZVkOkFk//VVa+3j5GoAhPgZYS8It/XYsEPnamZ+wNMMeX33Hy+ZWkaPHMQKcjFFQ== 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=2f5sHtkjq5aN5HgzYKRzM5xXUc5vmXYCOFSVzcEZWfQ=; b=WsisCxrehd1tC8usFUVbjXUQ5Wmt7VxofAauD4CAK0hZGTRY9Y6+uNJwHz9Ncq1FaCV0u/veWNyiS9jireVfNJWACVSFtBNShI4ZjBS71Dq80l38zIX+eG3Uujilzw9JrZE1LdCZR1FgVQUOeODpmuGAraPjY5clR0MVOjbK7UilQG7/zWi06Knkl5/zkbsOu2anRuN2RLvwcMevWVHEeTs9brnwZkI9nlythCF3Gq3/+VBCKXwWPGG3sovFem5x2zHfVXlJi6dHlldh0dZ72F349LDR7EN+CKwF+NPqi5/Bclivk59GIXRfNma4HThcH9yxq+cAOsnFawpua0Tu/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2f5sHtkjq5aN5HgzYKRzM5xXUc5vmXYCOFSVzcEZWfQ=; b=PMoevxHNGPa2LUlkxDiVzDFu3yi11rt91FA3Pua/Mm0R0r9LK2RJ+KkKgsldSZVm9i9Gchm7TA6hLAa3HtlakyRd8zfQDmcmvTpJTsrj+n7PXOkyTSbYVIJ7IVoHxn4xqh/mFRI9qW2VOoEithf0+KBGiwZ+GEPaFv8StrLD7d8GkeeZbFQU8wtEDRsmMosGQW1sy4PBvf5tYTOcfrNtmioc3ClDVCfGsLgczu3TWBjAg8BaKkgagagDKRBSNYVcNrYw7w1sd3/4+zsCzXTzdvOUmA3e8gwSEV76h8kMcz8V3/sTAe2y7DBuypodxv2znOBQ99jypcrMuHf5s62Z8Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:01 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:01 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 07/20] bridge: vlan: Remove paranoid check Date: Mon, 11 Dec 2023 09:07:19 -0500 Message-ID: <20231211140732.11475-8-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQXP288CA0002.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::19) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: da0e6003-bd79-4b18-852f-08dbfa5295b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TaQ8ui9xD3qHd7eV0XatdpzbqtaSI96wYa2ZUAIy8tkUKov97iqTOT5iSpZ02Sc4QcxRw7Sab2CHMgVfZRB4bvzHp5/VnLcjKJP7/R+GPMinYoOwJht3Y1dLZw82QzDxvgrtb1PZTc4aDrqx1mW3SVRZ023gHf6NYutCm13HDAqPj2JsgzVkac/bHaRxdJQ3qZmDIcunVe6s5gLE4ZghDU9eLyYGU1QG+dUwMZzKaT1gtDSzbMK/LKXjlR76Vw4+heDyyMsA5pcxN26e7Y300w0PlwszxihTIc/0pQjZ6qPZhuJ0MUlUJPIGMTKh7EqAX2YwjJ8+JI7+OeEpmN0PI6vw7gI5qQup9vLlYYIhGi1L20KSss2PvxcY1hT0Q2+IhWIDR8TTmXfFiLTEBBAY5bWIZ4UwhbxEAgj8nFyGitVAnafldkKbTMu6p+r0M0xUaW4lLi56rXqafFFK++VlgzeRSmupnP5bPHX3X1/XJyxsMWKfIsLJ15h3P9QlCaSouPQgjb8HsB7Dk32A5SNnZ3Y8EoZ7wk8mwB+9ZadhFKfKXFHNeEYqrpWwYeE8PK/Q X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rylk8Eon0Mxg57763Pw49TEcM32XVDFhAIG94tp4DlFMJ8YwBXYzA1IUuukUV/p9ihSfl30t8CEurlNUXUR8/aOP7IdIq/XnHoQeEnSbHtdGJfErRZfanE2T7/tthmZdHJ2O8A2T77JF/Bi9ZJCeiC5crJuj/stl4daWntaAU9pdIUxMWlxU4936dv69r0pCsyg3Uu/TveqWJWiIzFGYukw2x/S6KnKPtYZDcwGxL8CbzgRHfHrDBgxD/SiczV4hjL1JsVKOj+k93/HqQOHQiDa0gl4VKiRarQWejnHwhj9RuHG4tV0YKk6ooQg5LlGFeIaUY/jetYiZdah7vLPNmVJgfrXWZ68gXnq+6EmyZIZAKZ5GOWTo3D2BRXWFI4KEYR1Sls9b0l2sJAlsKawqJPT4BGl+T/4KLMf3K6tpkRqtofwY1mOXR59fR7IzpYG0Kf4GIV/+5mnxkG5f89cykwA1LqnarmXCDJqtLbk7qAIf6Y3aSH2V8ql3tpJMRQDs2b2ONm8VIBmpG3FtZ/dyg7iOsMk0JwpUZaIjg2gpCT7Tn4+EWtRFLLNVtoCCrfpy0T13d+J9exE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bfa5295b2 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:01.0147 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1HZIKIuLo7yKyAplwXEw6AVa+tqc9ujmSfwXhmzv5/S9ohG0R7CgDLIKXaXvyNaZSQ3CyypMMM2l67WBls3pnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com To make the code lighter, remove the check on the actual print_range() output width. In the odd case that an out-of-range, wide vlan id is printed, printf() will treat the negative field width as positive and the output will simply be further misaligned. Suggested-by: Petr Machata Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vlan.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 797b7802..7a175b04 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -661,13 +661,8 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex) open_json_object(NULL); width = print_range("vlan", last_vid_start, tunnel_vid); - if (width <= VLAN_ID_LEN) { - if (!is_json_context()) - printf("%-*s ", VLAN_ID_LEN - width, ""); - } else { - fprintf(stderr, "BUG: vlan range too wide, %u\n", - width); - } + if (!is_json_context()) + printf("%-*s ", VLAN_ID_LEN - width, ""); print_range("tunid", last_tunid_start, tunnel_id); close_json_object(); print_nl(); From patchwork Mon Dec 11 14:07:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487298 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="M9em5cf2" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2040.outbound.protection.outlook.com [40.107.101.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16070199C for ; Mon, 11 Dec 2023 06:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUYBg9SDGkD97Mwb0Qi4mPDxpCkNS7+zXZjYfybPCBErH5uMrVf4CnfLIgBAagi7VJTxJ7vSPaQhCGiBXSOoUAkZBcwqTCoQkBxRt+ARKdUpNbHzLlA2II5r4tEFfARkvT9g7/kOiifFe6ygrr8UnRI8U14wUl7n1ddJR6ZJYjHMGz8zW4uSEwnknaEBj4f5ZkcDvo107/O6hfxklWF+MGANAxjTnHkYcmfDwZgz4qMLKzmPSR68E6Ldm1ZNX/A9NoFmO38EvZIAAUYb3+C4Ay6u/56Vimhptwzy0monKY+4cdDxS+VEQjYZhm7t+jykgCMsMtBpkocPQ77FISvt5Q== 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=uGj4Tm+TghgMzcCI9yP2U2AHmaQAjRsWfHGWgUjAr44=; b=RQhXEbKkXuVW9IKwvn7WddgcnsuyTA/JQHRk7ZnUkHfSDxVO+xuO0ub6zUMt579Tpxebs0/xufV8We78tQULnqdFaifuC0BHp/ZKSZGebBk6uwyHll/RMpJ8rceh4g5SRCGfEDhoDKelumeO+1DPNTA/BqkEp3JDf6RdtEG78rI61lWJVkiMIgwM6wYZ0ms9mSSZFJw98nzdNh/KXtYRlvOGIrgj+lOyMJXerPw0e3uNrq+YE8tBAehiGdL1NzzVPFDDR6y0ESMDGp8MD8+2/qKCx4Jy5U/X9rHzXZ9K3P1v3iItguKzQ7yVqPBEFWmEWsMzSpvwn6kf1VNSclObng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uGj4Tm+TghgMzcCI9yP2U2AHmaQAjRsWfHGWgUjAr44=; b=M9em5cf2k7dDAth7PpwBj6NlzgV8KPU5v1LDO0gREO1tBEjH9NNJB3IO+rsSGkoWwHjxuO8wlLS4gWvaefKrNZE1eG35qcmZdjF9GWSvJp5TyzgyRiTGeQiAaMFKzoQcIvZLGSXP+uhNmKdBV58pJpvwzfaaWVYDJjgcQG2Pn70l/SNeF96A6Z6tzZYqfxWTxmjJtOFdWr2od9acwSX9iAW7KGJcdspciDCHn9+tJXtWbk6O0ttdOEohwWwcF1hTfWwBYITRYHzWcHN2KdF3Nbdilapd+Yef7uv06jbZysGypm+f5QaEjOslcvFaIcGmqGtEp5qJLkPOPfuH5N5IQw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:02 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:02 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 08/20] bridge: vni: Remove print_vnifilter_rtm_filter() Date: Mon, 11 Dec 2023 09:07:20 -0500 Message-ID: <20231211140732.11475-9-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQXP288CA0011.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::24) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: ab693a7c-a7f5-4f41-1c24-08dbfa5296a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /xkBx8UvNBT850LHxpaILYSjObUt0Sk6lrL3jMXvBXWBZXXAsV8PlvS1jX2mbHuG2yEpjJYAJ8YhDfttr7QVuGbDAnpSWv2Zc9lj7fpC6Nt3kTuv+W1pSVwv7VrWev3m/5MIkGaIT90F/1n1WBP+XAcfRh1Kn8WaDTURYq914/PuyLf+hD9rymi+hGIXSv0MRfuWZDnWWdDdMqWaIeKzPJu6toJEQyaQ3OaWJxTMCP3QTWBN0YSu/kwNu7K83ipo4Rx3meJ6JwhUFv+N3SZXk5ofJNJIkeGN8ezgxcWLZNT8J46UMVRrelfWFarccQBRpm54yC7z3GLeIEP3itKhz9k30TmzLjFEytAEujkK+zUYrKPX7PW3O+RTuq+Z3laD4sqjm4ZHMIo8z1sSTbRHfTsm7jHcMh41BtXNQgssFgmEJSJCbutNwWEE1vH0hcQCpe24JHTtsCzqBiqbGvjH8Q8GDUahcQC3GXcFzSpt4i0NxjyxZXHQD7jzsaqaOdPW2VBKm0gUaATYhROgDaItyN+BijdfYnSarpxst8WJCsoA5pzIHQ1XbHjcSMGLbr+9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(4744005)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LjwEhCTg0Gpj8e0GFB3wQ872OXtKoXXSzZxD7rdRDMKXw9E6dbYPN+YuPzM6LwYlnpPxQNYxf7wAPdN6afJyLZxQ4U77gsnlFi9pQI0ZVE2i1/Isq5r51le/22a8MEvCSyYcO29206bnCCUhVu8IdM6p/Mbm+NYVn3WuMyRjdv//G6ZrHgCr5iFiUnNhaZCyw+ZDFb/wDYT4U2m/tx/Pi+Yhz7KEPd7P7Z/DWvU6+AlS2zsMdvih3vju5FIwFX6YfGF1rvNw9X/rMX9+gFht3bEyDJ/XUgi3VbB9lCqIMH3rpl9AHtReRMOrPSCh6YnPQwAyGAbWqI8WgYLl1eY8N7fLsgXqCnJ7LoJxZc456xS03MMQRAt05H2hktdnnBLf/s+V4Ztquf7Y50r9towW1UZIDsEeraP6plTbtwtnMNJwZKWzcw4OjZXR7Vc+87tyZt17LilSvipw16iuZHnPtxr3crYU5gULv7InIEmDoT3sFjwMs1t0x2E4n90LcheOFxFgv+ljcoLBJL7lM/1LqxOI/sm5W5TCt8haEtp5/N4TnW5d8CRzvI+iSAtJ6shDhgieXkan9X6jNWnukNXH1yI0Q0a887iV1kuNkRthTVVUKkRRkagmQgUT9hmg5jL18zqsKe4DVCXpRt1UfHGo2P2jnTHupAeViUMLmM1btkuTKlMVTOXIIfyGxQjmN/V82C1g/EOo64I5UCVEHKQOVrXnFOVmxMmTqlPF8gh4OyGuwGLV+LH+NrPVfSdNSPQCmcJGc82oyiB8uhxypqxWafK/6uiUerLQNREpBVf16KKkw82Tt2GNdz8ERO+4AvpJocoSCms//m0c7RTN+HQ/dax7cdz0o8BElPPQMMsb8v3EjpRUWhlla5wYgIOWmjeF4pmGTIiGaIjEFsznqCSKrD/YiVLNvNKTeoAA0CulSoaxSeFSPIbkGHA5aIPvcWrEP9+cBMfcHMyV4FwlZdR1XlYwiMv0FhyMZOATBVcvVM/CtdvUB/lpA8odixwV+yY+qsnodrh8+PmR6zRIZAHjp/y9iKogpDAq7KOv9F7ti64MZoTVBwBhTGaqA3+J217Cp2XN8C3wZ7pWLpx06kjx+qXCLpHcTKPq2fsDzK5hlEDybdTfIfwkfENmA7Y4mFPhOje81gnpP0wvnTmmM88yKGe8C3rgilWJK6zvLrIHwfAep15KapjISFCtwu9T8OB91yufy9MAM9/Ggf8jdPogSo3u6Xsirzs1C79Glfm6s723spoipKSRFxD51pGhYEWjIpu2dK/bkP2Quw29tarif5giRWNFLPZsyNaJ4DRb7aRcHlHqtcIPGxS8xq26Tl3LLp5cauSoXWqmrTAB49gFBdFTvvDpj8QQCzfa321aseBImPXogxUKTcBjasopeokLWC+EiPSwl6dfiyJZVnqPrapIBYxtsglM1PXYNgSWHoFumI0ewqPg+2X66CTSG7u9zeBltaQswCnZD9jmDF+t/7GP8vfWR2/hTO6obYl3LBqejSsK3hNf4EGUG4M6pMRhjC/qQAAepOE6Qfhgfdkpi0Jv4VdzFdLHDyk2MVLb5FWG0DGNIEV0klwXiLSkx8GR X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab693a7c-a7f5-4f41-1c24-08dbfa5296a8 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:02.6101 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RX8WWqxJxleIdNjde6WKqGj9R4BxlvCK4+xd+kgLrPgjjJXaTF4fPao7BLFipqyOH5DvISEHU5qRhdF5RfF+IA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com print_vnifilter_rtm_filter() adds an unnecessary level of indirection so remove it to simplify the code. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/vni.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 74668156..51e65b89 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -350,11 +350,6 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) return 0; } -static int print_vnifilter_rtm_filter(struct nlmsghdr *n, void *arg) -{ - return print_vnifilter_rtm(n, arg); -} - static int vni_show(int argc, char **argv) { char *filter_dev = NULL; @@ -395,7 +390,7 @@ static int vni_show(int argc, char **argv) printf("\n"); } - ret = rtnl_dump_filter(&rth, print_vnifilter_rtm_filter, NULL); + ret = rtnl_dump_filter(&rth, print_vnifilter_rtm, NULL); if (ret < 0) { fprintf(stderr, "Dump ternminated\n"); exit(1); From patchwork Mon Dec 11 14:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487300 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rXCmTe88" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F345E3AAE for ; Mon, 11 Dec 2023 06:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W9u/6lYFctw8IeWYnRdam2SKVsGAFFvAG3aRIEUerxlABMb8W7ELRrQJfE2WUaWKW1zb1AEJdOwv4UU34xDzFI6i/Y1gdbvTuLkuxJaHZ4EEM2mWC7lsggTKWlKiw3ZokJe5Y+gZd9nOBiCPca53HSR/zOLhiAQHlMW3dXMAyVESQ/11/dm5Vq51yum7Fac9Ekxu0dGxN8nUIykMhGJGoEdikdEuvVUtW1wBF/O/+MvkhWfwwQ0/gSCab66tVb01Jry1nzr4HTxmx3Xfrljo4aT8ZahfLR2RdbTMC9EzTrk7DkrSGMxaL3YVy5zvjMG3r+KVdpfqr656k9BLRK8SPA== 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=1gGalSWQnkmLyq8GixPzxHwiPZxZ5uMyGwFY29R1SaY=; b=PsY0UczELz7dv18vsLAJ6SnKYE3HAF7K3pLIS2mEMSMvi7hRqOeahM5aRmx7uTp498TsT4XcwyRswyRjehRXizANC+52slYtz5kE89mNqtkFWzZNULPpDhW3kfoEteDyT/3+Z+RSdFNiSDe2eWoLWgW9EgzInCwC2wnTMnEL26UT/Rp71NfHQcuYSXtNAvyTpaJR5pdOL3E1QPP7n9d/pY70Pn3GzhcrJt4B4uX8Rf5yNHZKTkO1Zf4wU1QxFALDEoBpkTJAP63UzXiwh+n8NFeZw+ZcEK5HR1sARF8huKzqoDxnbJrvqOMmDbCkjCgl0N+s59dYOLBwtv4nVIFjPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1gGalSWQnkmLyq8GixPzxHwiPZxZ5uMyGwFY29R1SaY=; b=rXCmTe88bL19UuPQkKE8Uj8FaDovfbQ68MgZqtLbBQ9zdHavI/+T9gaS8BoC61QUH5p3Yb8b2Q2iJ6/+cOCnI8vriXxqId1eDzEUX1GkbpnoDSnaKv+IIEcvXVqQi51Fv8cMOCcX+KeCmu4bCGN+AOjRj7j2cQPMcE4QBtGues4BC4+7xcruD+jLycp9rKc/cMNpV9wdyTqF9kObtwL9OqNG+E1dAxZiWZsNAKFvpsQmjNLs0AozPC/W3d6VvZXO6k07tfJ57ZPfFyCT4kUU24XRPJsYuSrxCsq5YvNfafEOG/RVEeKshm3G8XqNMk8+dY0yiKhFJGurLUarkIkDXQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:04 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:04 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 09/20] bridge: vni: Move open_json_object() within print_vni() Date: Mon, 11 Dec 2023 09:07:21 -0500 Message-ID: <20231211140732.11475-10-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQXP288CA0027.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::35) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 00532ede-9f84-44b9-c5a5-08dbfa5297cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a/IuvxeKn70F18lk742TTfHNAdsx+h5n7+qvCNuHxuuaHkU/7jsrdOlHLVWy1HR/ebKkzyMNhwuJezMZhTV8Nt+MxPDATXXOtfgodYi7629cViOSimtsQaYO/ZI9a51gVCDExEBjsqSE+TVUI8Vy144rPwNTyo3nmDIIi3f9JbB5WEUD66yZKfgnBtDRVXOYaW5IPyqWLCx7c0yKqoOgheWOf74NWlqZ7J8pNoqbjOpcdH6JeuqP/uW0yvph3oqQGzRzgq1dw+J+w0h4LkQGtsUZ1hifIfAHG3ym7FsH83dtxaTEAIrNGFTKMpuvm9pG4WnxbFQ7iSYCVzT65/NBfXOGyziIBI0sS66whLNKoNhymliUJj8vRXaLKqagcPkFKFK58hssxmMBSwrdeBewGWmW9Um29C9rK65+CSEjckMUUNDraErHQexbaL1wyaPjpLhDbp2NV0Lb+d9zxPFAr14KAaGgnULCkTTKa5xtXyYXsO31+Ss3dc6G4Xcjcp/NQ4wi6tvpRE8XdygKzgVc0uwACE1+0rhjoNNMYBS7IPWq/WIixYuv7VgVlqSxmQb9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CON76TMKGDc5VkifTjbZy4UN8HDgaC6+a+/Y3gUeq9YBgg7UWxFmW7+GgKqeD/c7ZV/nfeLwKIo2y0WpIhyytrC3wCoohz00hZMvEyr5npPjB37LO62Afz3KpMijnccodqg34MwujpF3mEUZvFOHvsIcgdXoN03Pz0Eo11uishNc1gn7H6iA5rMSAb6XyCHVw+Q4BiE9bJR8AaKpsBXjqaCmDBYp12199MEmB23RIhO0Q1yguCcmRLG4hOFGpNiafM9McKQupgAp1iPdLqVnRpqqE/mtpguwhrskAHwG/Y7vHFgyl/93BHsBIJ9hAfZpZwaqxg2CTuUVaDcj5knmkRJmcHmGf4+z2ldB6glISIaV12SO6cv3lgPPI0x7aSql5W8NfnsQ3Bw+2jFwdEKb5Fie/FKyLNBIET2/yx1Jxhrj+LuMCqTBsimk/w1Olg/BKzLJyXGxLh8CISK97va+5q3JjS2qgWOymZHvhCEbhWeYDnNRcc3s0Gz+lKYulBJCsJDnR73gze386xs/fSNqs/7HxNPS6PRkCXXvl0rg0qljymqJjEkfIosGnL7Thz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ede-9f84-44b9-c5a5-08dbfa5297cf X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:04.5817 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pQnVcEv/aYrm2eAPX1mg7xuBwpP9ucZ2wtIcQSst/Z5Z1axxtU96FlQb+3nWIH0eq6sFytcEy6JZtiuvvFhK2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com print_vni() is used to output one vni or vni range which, in json output mode, looks like { "vni": 100 } Currently, the closing bracket is handled within the function but the opening bracket is handled by open_json_object() before calling the function. For consistency, move the call to open_json_object() within print_vni(). Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/vni.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 51e65b89..8a6ac245 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -242,6 +242,7 @@ static void print_vni(struct rtattr *t, int ifindex) if (ttb[VXLAN_VNIFILTER_ENTRY_END]) vni_end = rta_getattr_u32(ttb[VXLAN_VNIFILTER_ENTRY_END]); + open_json_object(NULL); if (vni_end) print_range("vni", vni_start, vni_end); else @@ -333,10 +334,8 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) continue; if (first) { open_vni_port(tmsg->ifindex, "%s"); - open_json_object(NULL); first = false; } else { - open_json_object(NULL); print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); } From patchwork Mon Dec 11 14:07:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487301 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="M7sk5v9e" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22A614223 for ; Mon, 11 Dec 2023 06:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLVCUp443MLTL2v26fPf3xjn7TYVUKSh49bjXwFOP942AUuT6Z/HMOdVnlmIm9CZlrvPdEUMaWlPqpJ0UTJhj7NHFQ+emmOGf1JVOizy3rvkOGTKtdBHQzt0LQpVNKGBI9CZ1CalVLEuzVmQGkXMi9Xmv7PSJmjMIHrjshow0wPYBvHoVUarHGyfdrtZTeL74Z/qnJz/u1hosQMdk3vzdmpECxOcVkWO/anItZhK+/WHfkgNw6W0mtoNWAbe7Mj6Cb7whuGzurNf+sw6GXPhk8luRgxeuvSOXmqzi28MsdUbOTRJk+xa8tR70zfr8NZEg25uqYdLsHHgTIGMW+27UQ== 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=dXxcryJrq84VzIo1vn00GcFtws8/MXJ0Vkp17jEYEeA=; b=mxt+uwoGUOUDsdbNTuugR8GZ7Zk675NqT7/rD0VMJrK2Tra7pE25AOxW9jHJr0ZoPvsPlQJIxJJ1cNsS5Hx/cftbNNvVIyJ/+q6vzIEdGRZKIQ9/sjahquKbfQhQnhJ2ZIM8ichPrqu653xZMyGMhuFL+GXkRCAO76xlE1dsnu00lI1OtZmF/uvH2Oq/8i1edNQpVupIQrqWho9L1uq4wMD3xsWlTpVvh3YzCmT1mmomCdtr/Mg23EMnDw4r4coNMIt3Zgn3IkSH9Zu//77ftvZq/7l3liEfau0ir1shC9an3lwjCkhs1oIqc8HQPwkh+b0afh8FYmEb+E+oUucLPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dXxcryJrq84VzIo1vn00GcFtws8/MXJ0Vkp17jEYEeA=; b=M7sk5v9eX3rQjp0kbxo8D5HENwteH1xJlDorrqSHwaX9+5i207eTloQJzMsUZJK1KhGrzTbGanOZtI7ihdWEQ8Q77eRsfrLk8dux52onSvwqtmYc6YNvRwOg4eBHJA/AyY68FDeSFpa/BHtRQzc2HLPlYpzw8PXiFujVnmpUGXBTWH09tyWeroDPSuYgkpVzmMPb3cVMaqM27rs/iGeNzaNHpVS6TDWl6lz56gSK1dj63TatBdpytFB/ZRNDh0Jk/MlcYoQjmy+HgUtQgC1gBVr1yz3IiavXDCl2AO5y2Ck79tB4QT34dXkYIMK3ze4b4VaTe6+jmdC6vxzBaiv4Gg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:09 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:09 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 10/20] bridge: vni: Guard close_vni_port() call Date: Mon, 11 Dec 2023 09:07:22 -0500 Message-ID: <20231211140732.11475-11-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0087.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:4::20) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 86c5f84c-689d-4b35-16bc-08dbfa529a5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6kiXxCuby2mS8UAxlEWoEfdHLxEAIlTlqH25bLM8EQMPr07vXxmN6RVJnhEj9LuO6lyokhoGjpvpm5ElO1qV8ZWSfC/aWneBuzG1+iwldT06AeQN/LqN4FPXAWY/o9vVs1cpNqcdK9N8wt0DNnMX2OG4PKV74+miTGx8C9y13MXjcWdqzMLzal+qQzYsR3vXcbGDExCvaAYWYQaUEJ0WImo9KfXjrAG9AtNf+njEhszZgJbslWi0eavbxB/uhPHxbK8JvIHDCn4+11wTVv4TRXnGqzu5Snq3P8KLMDGBWbAKHjpT1j7g97B4kF22lphGYxkGg4c+HD329FjoJ3kqX4Ma42zL33cZ45my77zwyVjwVukpX8t1CbiDXWRUwSGnv0qDXEen/X3xWBBXY04kNJh7wu/y0mRlnU9wS6wUSZMkT/HPghUfcCy+ZcskPGTqQhBpL7ROpqQcgQCwmjD4iIrBVoUjSPHKpu+22Paul4LUZ7EtdaANjcOT4URkBs7LL+SLXOcN9TR2LTWSAQpO90NJYAlZhUIp/jmPJegyintRc+MHJwpplfvjqXkOwaEr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BR7Z4TF0Y7G8fpzH5+J5pwMTrSQnRhbAo9SCqxCsPaehC4UNCpDDZMwf6zcLsfsoNcTUMXL6VatgBrEwMtEwgpCj0c430//j5JzdkbxYwLBbdRHMOCm7GkBRRhBbv15lYc7+ZbMKDd/CUgiHZHcDm9X5CIXHHfPL5YFCvGlKCu/5Ig1dZuByU2QJDqUQ6zNAktBQYxl1L/U6RPnhhDODuHaIpvqjmKYtTeE1FfVMMke3LezdY3pLE1HhkQUMppRUdu13iHpuemEbkYcEtm/EuZCVnUQcamlRL06wtQyFdQ+C6eyNw3ibjvAVtZb3qo+H8Fraq51hQw5nt1rfT9AKWJHRX0v2enCAm/M6lbHphx8DbbdgbBZmCdqPCC8DJJV/Vc73xgvmrNK7t9X0GAjbU3NtPcRJKn8mF1wEHmyWAzCj3xURBYrxaa64q7lCuTogbYRJYYMHLHABoIjgWupmBzn5BkG7nVr3bRtlwcNdj7okBe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CtU6vh8Apyke7thLWWC1WctPwlJCs7T5y/LWljzFKRDhkMD/2pwFt1pZKrnPfrU1eJEb4WXJVAqZ8a4hNQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86c5f84c-689d-4b35-16bc-08dbfa529a5d X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:08.9989 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jHKhDesEWz4QjJHCvJY0Owca0ZwkU3+rtt1OVyvgfim8tUZE+GqGbfHe5acSc7bcO4fI7zbUhH+QXvrJ/8d+Hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Currently, the call to open_vni_port() within print_vnifilter_rtm() is written in a way that is safe if there is a RTM_{NEW,DEL,GET}TUNNEL message without any VXLAN_VNIFILTER_ENTRY attribute. However the close_vni_port() call is written in a way that assumes there is always at least one VXLAN_VNIFILTER_ENTRY attribute within every RTM_*TUNNEL message. At this time, this assumption is correct. However, the code should be consistent in its assumptions. Choose the safe approach and fix the asymmetry between the open_vni_port() and close_vni_port() calls by guarding the latter call with a check. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bridge/vni.c b/bridge/vni.c index 8a6ac245..ca5d2e43 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -341,7 +341,9 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) print_vni(t, tmsg->ifindex); } - close_vni_port(); + + if (!first) + close_vni_port(); print_string(PRINT_FP, NULL, "%s", _SL_); From patchwork Mon Dec 11 14:07:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487302 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="HAg3Hq4v" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2040.outbound.protection.outlook.com [40.107.101.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05A2184 for ; Mon, 11 Dec 2023 06:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YY/RuwrVSJWlOrVyf2Q0HRWb2UWNeXZDVAp0DFNyCTo/aAx5AvoJT1aXkU/XKMA/u8xr+rYutNQfzXTtnLlvwEzvYUymzvoD6nFfZ83cBVD5MF4PKYusLgpZmxRJOme450NncM1cQ8OXnTLQFCai3GJ5RLammIibAPI7nIfR7IOIh/2FwjHO1AF/BMJVvbkaAarw/+YMBscH9I7IgY8jbQWGqLEUdQk3ra2iX5rTRSdRFKwlMOoQ9LANZuXaa8xCAwFEhF9Os5RyJFPwMFbTPqMe/jrKT72q0vXNwxcz19xgbTDF4QvnfrwR997Ykf2zMGLZ288aGd9faIX35ROTIg== 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=njEYY3LhOSE3YnCoHAYfMkjS8e5mNXmAuah2L5uTQvs=; b=N0uEp0K1cea+vCc8GRekeUlbgwVMJs54Vl5wUp+UvDEqa3Uom8gDlwvBX6Lr4i9ijyqgxf5mSZMZ8fd5opsRgak8l1/p6KMezUGueLLrmMmJrxzXx8AJkcNs6AZnkWZFt+hBakIWztqfUBpR6/6gnG2CNV/qbwCFjDk5VZwmL7vQxHJFfVtK+N3gyViygc1nhZAY4n5AvD5IhrD+d1EbcWpnldbJtKrMLyaMvoHQdwKhSsqpBIBjkOPfFYS175beG+/f3ovf1Ej9/xwiJOTlIjZ6pa7Fnxwgdr3aEtJQNox3G8HK2ibuOWN9mcR2e4Q4ss6xiKqM1FBXu0ogL6rSwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=njEYY3LhOSE3YnCoHAYfMkjS8e5mNXmAuah2L5uTQvs=; b=HAg3Hq4vt5zGVJKSyFYjPQCmY1EkgX9szVBR5TlD7M4qwnfuqPxwZnwL1qh303jxkD/5YmwPA2aA1BKP3ZWge3J5ve56nsor6M95iT5lIapCrYLgITNKxwUVHefuxLBrYuFLyffszh3+z2TWHypKLp/HuDEK7DQOyOWmq3UJeMzwPVIQ2gpnEDLsOoRQLV020jj2/dAJECsB57W6JtUsPzpbpPaMuynVAxEV/LbwcrN879Sa46yN+cRY8BVW7KrAFynZ242ZJXIAzjjWrW6rOhEG/LHLJ4vVvWyVvzqsJ+WzpTlqwS8KmPFa/L+pWOTj//3NW7ohg4X19Tr+FL+fxw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:11 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:11 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 11/20] bridge: vni: Reverse the logic in print_vnifilter_rtm() Date: Mon, 11 Dec 2023 09:07:23 -0500 Message-ID: <20231211140732.11475-12-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0264.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::11) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: b84ce03e-9ea4-43db-e597-08dbfa529bc9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qjXUnK1qhE52vH81ZNk/cffgb1K2AUspxDUOZXBp6/i59IzcAztdJkjrF8me0il4LsR0ZSLhHAGAqjd8EYI4NTy/ITezwHi5ce2onO9r9lZC9ToexfK0eqNMBBfGrcpCFFawyQBicrEVO8mF8hSyf9gB7FqBU/mUQSL41x8m8VavcvVLpIc41524sDzQSidUTxeFggPzEM65fUuB3YpHMDFne1YwKbi38p4flnKm9WuofHZ6FpPRT9UftlDVdpeTeJnjoHg+MgvV9lMWbqjJvTpXMDWNNmQNM9kUh0EVBubA6eQLd8es3B4ELrkT01DBIc5Co9KRPa9TiSipfco9SXNxUCg+2+kyiSwaUD6WF9NFWAFSoG7OjwoLnfHSgZ2pUmEO60GC41NolL+XGKGD87Ummr93T4WF3dbuADG079curzAY6f2zbOIcPrKYI47J3as12Xc8tUCvB7PUTQrWe6uao9qLYw9OGFGVNk9Ybg20RVPkpVqhNgsUWfOWLIPvgqd89xoSrDS/c+UM5yqAUEnzfiep03ggzajAgaEvQDfk1nBEn0Apum/B863xHhW3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 94uNcCRs23SadIEzJkeyj+dGz94JDQVrnnsImbfXu3Qy73K9O1LnTTk7+27/kMvaNpdidJeGZZifYQTYGV0oEQ86gmqIh0EVQDkH46ozoE570i2m4cNfIuWgjWDhGagrOPibs/a+DSzCbBy6tRFX06838XkOWuXasZMyAc2lub6PmGkNBGfg7jQdFTlytSkawfk8Jypkf99PQ38tjboCoFC0QUJo8lqL6uYAiKTI/enbO4FAuh1hOK8XdWaHP6Ghg7ZGiGERKHdJws54Jddj3Mu+IkhxuUUQpY8RSK9nghHkre0rC2bxCyjJmykgLnHmLYCVM5HqbCLTuwbLufbDO8sAZfy0ctHLkX2Ak+xk1zGhXBERvFGLrJhDoCWae/doHSJ9mXRJDDmucD+Ha3gF7R2FlO6iczLqsRp62BPo6AnocmQP6eiw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9bx5ezeTDK5WCxdhJi9hE1SmfUeFdt2VzsMfGF2JBNvUWuW0KAqvprDoHYH7+FegT8T0M4y5fkU1nOi8JrI4oQPgL X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b84ce03e-9ea4-43db-e597-08dbfa529bc9 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:11.2066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +wu5HOF5Y7D+eNb73lZNI6mKCJGjVDDKl4g4PQYyJZRrw/W7hxGPvYh0lMvS+MhYuntI58G6QZVVn4wOWPevSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com print_vnifilter_rtm() is structured similarly to print_vlan_tunnel_info() except that in the former, the open_vni_port() call is guarded by a "if (first)" check whereas in the latter, the open_vlan_port() call is guarded by a "if (!opened)" check. Reverse the logic in one of the functions to have the same structure in both. Since the calls being guarded are "open_...()", "close_...()", use the "opened" logic structure. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index ca5d2e43..b597a916 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -296,7 +296,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) { struct tunnel_msg *tmsg = NLMSG_DATA(n); int len = n->nlmsg_len; - bool first = true; + bool opened = false; struct rtattr *t; FILE *fp = arg; int rem; @@ -332,9 +332,10 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) if (rta_type != VXLAN_VNIFILTER_ENTRY) continue; - if (first) { + + if (!opened) { open_vni_port(tmsg->ifindex, "%s"); - first = false; + opened = true; } else { print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); } @@ -342,7 +343,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) print_vni(t, tmsg->ifindex); } - if (!first) + if (opened) close_vni_port(); print_string(PRINT_FP, NULL, "%s", _SL_); From patchwork Mon Dec 11 14:07:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487304 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QlurTTJP" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609092D74 for ; Mon, 11 Dec 2023 06:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RMtODDubOtBaX1PNASmayxWS6XZppgM/Rx33K6yA6BhYNYt1tJhhUyV8R2UBxR8hzzY24vfs/DDz1ICDcqBFteDv/gHwbHRts6pXsmUx9G9SWk7cCyYjogEW7ow+N595yq7Ske2Y0N0IpnTcfOM8/mETtcJPyD5YHz1jQhLSiFN7B5Hhj4I5lwSu7DvjxrpCxdc4Y2arXsfs/8wolFJDWdGDGEteEUZaHL4N2+Z6Xp3aPm5sY+I4O8TiP5sPUm8r4ssdiZz8gLGzetFziY6C+6dZXcgfZu+mchLEIHMdwh8e/+B78nuwPf2I/ZkV96M7f7ZRNkb/coNFgdhHedpcBg== 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=UFZcDCISxDuKevso1cwd+gN77zuBGGC9Tq7Ui0S6cBw=; b=endN7YB9SbJKYgwFmO8dNdyKmAIIbSdYyULl9MiE02aCgaj72DSS0lkXXR5dxEr2wnmUnjrQ5fbkxnV8aYv4+ofARJmsAsCnD2EDDYD2xbmJ+lXmUU3TpnA01XOCNMn8d6I2MqZbV6Xxgmme4OXlW0fxomOLD46ytqzLxJXHBLs3gpjHSqki2jGYFeaAvyrwQFebgCX7bWL0B3nHyWQpv7w3+Y+iBPzN0U8z4pYXfd1cPdiDWWZu6hsKQ3kHeoKA+PnfycvitrW9a2S6eT2kcGNE3xghLbAK9w21DiczwnSFP4ypDiJSUSxYPBP//P5EoIEAQq0zJlO/c4wp1orRxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UFZcDCISxDuKevso1cwd+gN77zuBGGC9Tq7Ui0S6cBw=; b=QlurTTJPiPwHxL6fXO6iP75PCB3E+Wwpyx2msRVK+6Om5dWbqJVcRCFk6zM4fFub76N490N1gVvwVq7WBCkb8M9RrKz8Qty2ePt0CMyQMNO9PRwd+dN2CXaZVh5OoeyLbwW1oszpiF3NE/XuZqsLzmJJhfhuE0kGDi8P6mxHH2DqyQTUsI3jvvA4dvoMrce6d2GlkJgTNa5nB3hyqdAK7l2o+qYxyNljGmxZdlsuOI5gWIMKnb4BNClfBCuUa2SJxZlY6zC3DjkKqLVEwG1xHUFlCo3iYdy7deYLQnnJZkDY3upOyVzNE1hpY6dpAj5iZOP3FGqdbr+32SgRhwzuYg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:12 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:12 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 12/20] bridge: vni: Remove stray newlines after each interface Date: Mon, 11 Dec 2023 09:07:24 -0500 Message-ID: <20231211140732.11475-13-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0108.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:3::44) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 740550d5-d47f-4dd8-557c-08dbfa529cb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yLc1VhcjIbR+j8ph8eJWutYFz3KdnjNHqi7/YHmw2yJLq1iMQsAfE8aF7fJ1WAYVF7BPkX3T+F/M/EbH2aC/mA9rgitdpyJ0IY9qpcPNdPpghyNdzBu8FXNZv/wnAS6tDt78BbsOuALHyR9ZOcy3jvFmG39dRE7ZEhl1ZqHBBjl3z4rIM2VmOLWBbl9qKMx2F6sgFVYWk7KftK1FVUyUL6p1yGHzDJipnb4vYEUmyAV/NFeTi1aATWm8Pty5aLqLw2Rx3GykaeetXPLKigBJ61MlohN7uACmZA4b3lP32EJS78w9ly3F+P0IUriWRRrEUCYl65xaPhe5DoZ99rOA6rEzQ9+3Fei0nlW3hg0VFycHS0Xl4o37gt1xqn4hsvMv1moH5VqPKUPU8jf5ODsqKug2VvLhRGml/ZKnlSIk519Ld3WCRf6TWoEasPHZPTy22cfV6K+1eKHYRQK6/wZw4PJqTU0Tje9Njyt+Hm3EaamI8C016UkUq5npksfW21++3rIkITTE/b3ochICSaogYSWHd0Ped29IaGaJomCLx6ckFSMhpncNqJiNFUTUU+fZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r0tFz25BhtpThPhr/uzVsrISTMbIGyN8qPHzVIEbvqmd9J6eDR0PprvEdQgLVva0mIn77vPJtyJTV9UoD6Db/p93GZlZCtg6xtTYVdJ/R3iRy7HDMKZZOcPzuq4pkX881aNPnDxImewd1fnbCYvtyFwvXDzafpIVpqHrj7l9jYfYFUtTFastIBhl1tDSrMgadZdKYJ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frPMXCCle1AXtDnEqOrfp125BgHW7XLPh+NKaOcbO82CH6EiDf35m/0xheGwFY4rbtORDaaPqKotVmbISDg6j5TCD6tJzVkl5CXmE9UQI75nrp6Ct/MPLNwenZmMS+XaUyC57u/EgCZoaFOehaxxqI23FdOyl62nFGKhaFt7jmGl3fb6Lsml9F63rt19Rp4VrY7EFtf32N2U99XzKhXL0JGWU8x3X95XzjqPSvRuAcC7Dzy6ZsgBj2ZtnawZXDHMa7W2PhbgTTFgI3ucCoWG/JWS5OZvqhqe+V41Ci1f6YjU/mHTqpIdKnjlgOjnhVjEsgY+nogHyVW3cif7XEyV40q X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 740550d5-d47f-4dd8-557c-08dbfa529cb8 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:12.7942 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0KzW5ZlqqlRT9oJCgLGdLY4ONijAtoi1Iy0NrWW5zBQ07ROrmib46+urPfNdw5mieVnMiww5UabsGuTC9HHqLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Currently, `bridge vni` outputs an empty line after each interface. This is not consistent with the output style of other iproute2 commands, in particular `bridge vlan`. Therefore, remove the empty lines. If there are scripts that parse the normal text output of `bridge vni`, those scripts might be broken by the removal of the empty lines. This is a secondary concern because those scripts should consume the JSON output instead. Before: $ bridge vni dev vni group/remote vxlan1 4001 5000-5010 vxlan2 100 $ After: $ ./bridge/bridge vni dev vni group/remote vxlan1 4001 5000-5010 vxlan2 100 $ Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index b597a916..8f88a706 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -346,8 +346,6 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) if (opened) close_vni_port(); - print_string(PRINT_FP, NULL, "%s", _SL_); - fflush(stdout); return 0; } From patchwork Mon Dec 11 14:07:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487305 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="MSIJJ1Jf" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7DFA275 for ; Mon, 11 Dec 2023 06:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H8jviKfCqrErn9CTEuf6PiokLQxRbK6/tSGW6mhYfhexCqPt1pwLxp+6/CaZ5JluMkkhulHPZC6MmKoyCGtw7EB1EymBQkDaj7qctMmzfAPb2adVN4TaBHBkqDm8TCiA+ktLE7OxAdon4VUzpFyf6SAb+C+ysEnxN3fkaOE9nWHRZmWFklF3mko2RXrz0zXOCMglWse4CRV2LHFtjuxrJw4A2Hf9yrgKc0Pw88nnrK9OzUB8bdcVHgllq1mYr23bDoRFxWsxP27hbp8yWxH8fmNNGv+ly3gGmBD2l9uK0Bv/hgn0sB5OPH+ptIoHuneLM+pAtYYgxrXKvd0S2HnP9Q== 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=SNQHUBsTq0ex2Oi2fkQS0vaWEzEO3eGz0yDYvwrlN8k=; b=gwTQ13qJbUmq7DkDlFGDsg8RaVqT8tVWjgy3ivkrhK1Ky4Z/tfX+xXiGAyo0mD5Dhz4rpC+e30K9ZZh+wxiVWrI8sj67GS//GFAomYmJ4nYLNjqsNu3tSVDpHUKmnRcMiupN3/MW+1vb6TsgKcfu8dMeiDEt9ATWOw/iUd5WX+EQKpUKYw8XPzgyzGoyYY53diKRW1569XVDlVoJTFuCnjt3Bn8t924Iv2f3Nm63ZzBMyKoAT7kTJGsOCgRiYzEEjks5bDDLUx+V6y9djc2ZIYa315wXq1ZR8T/qA084gibQ2ve2KNAVjrRnNfEJCfPolL/+vWeXqGi7JSkaMa8VkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SNQHUBsTq0ex2Oi2fkQS0vaWEzEO3eGz0yDYvwrlN8k=; b=MSIJJ1JfD9YR4wp0QKNuzK14vk9r4fP0E9J+YwvKMZHr/s+I+qLSINTTImO8oAy3BSqfLle7jg1ohl9Uiq6KjLIYOopZBbfQ1GTmB1MzPd/Oupqs9na4mz9Iw6H3r+8kBjdNVjNV3rxIx6TumZfreHyufy8DlfEGz286wbQk5g62mNHmgKZBKhsRmRvxMTPnNp2Hw/IdNlxt85gkIkB+iWL3VfHzi2gMGDgWdBW5U+8CguS5wEdGk1CQBDdefYLr5WOMjdz/Yi2uEEuVdF6oTRlsMjMuUWoCoURLI8GMXTP2DxEP4jQpON0Hl32hrYOTMiDGC4q+p2YE42mAz8QmQg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:14 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:14 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 13/20] bridge: vni: Replace open-coded instance of print_nl() Date: Mon, 11 Dec 2023 09:07:25 -0500 Message-ID: <20231211140732.11475-14-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0140.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::40) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: e35b77eb-cd41-40a4-ffeb-08dbfa529dc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qd7qW0DmYbxRkJlIX/Yl/su9P9LFvI40fZ8OLUBb9+euvy3gArBHz8uOEI92gxFbS0zArVqu0IUD0H+EK3b+2fFwAQ47+IbrDe9dXZgLI0vyQRQccEGY1STbQ9M/WW6qo36A+gZL7+PPk+xQYLBpxLwYC1pcWTaua29fCUc0ANEhkhuligB7sccFaOAk/gsc03iOUzEwLsY9+g6dMBOXR1BtjCULjeScJRyqYSY9HXzb1CJhIqj8UbQyL0RBQ+/mVgxG0lv/wvrdsVo7WSW7CgHo0UoloNhgNP/C8/6lA/4xKUKeBEvpd5ErJsP9NGJuvoMcQCh1LSoDywHPptkysx7JkZqbgaJkK0G4nWYQrcHYHaFlUS5LdlavoIYmk0wReq569KsGLBEnE2SHErAcBf5VMPiZmBAj38AcXh5DpbuYoBBOKuTswZZlYRH3v1mXcGjHct9ltSJjXaelN1pmqtPnLLlSt9ctEVqZ1mJFz4fxpIR3BkpR5Jl/MZtg0lryvKiKgZuvRM+Lghd8HdHCeXGFuzu4W616i8BIxr5w+bej/Sq+jZLQxDXx7IV8z6fT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(4744005)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LgWNdNw1XDoP87/PNr3QnEIRr84UY+K0r8F9Pk4HO1pBLlsD0XqLcoyVXnWk1ZCq2j3/kMrSJsPmh7ipeTJ7ZGL985T14mIVIbhQp5fo1iGUIhMJ0bdkvU7mRgHixYS/TPOtfUEcWHSBF5G2NtDryDJGnAylQ/t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ndl5A0tBr9bWjp2Qbq9uF0AtS4fIuTNe30R9Lx3RBW6Ol/o0GlTbUdD3iF/YSbZnOKcqqEDsc6pEv07Kjs/BVxgkibajO4d6Amxk9dyqfjTS7KFEtpNlsH1PdyBUKgOxXC5y4uUsNUFNpW1Kdxc1DKzoxRORxweALBrCQGJ5zVYCM5+8nu6/oXJzLXUgKTSdfpKMEXOAKTy3dOXuSHfh555jL9WvFbbhfHeRTZA6n0RhIYGkNVP9zBz2gAy+EEypXSPO/oCcr5YXf4rXhXGwYRWsPRGNfMTDRyXkbFTPAHUnMw33DzSyo34tZEo1ZujDXnf+wp7ToPimBTDBb7kL+VqCpz2Qfk2ee51VmQY1ccSYI X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e35b77eb-cd41-40a4-ffeb-08dbfa529dc0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:14.5054 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bB+w8ctypMkKtvRrtnIULE4rLjk8bIIYqjtI4y/n/ky9XlGaSSQRdf3Wt4Ph1Zb7mHsPxU0hkIwxboN8l5veRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier Acked-by: Stephen Hemminger --- bridge/vni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/vni.c b/bridge/vni.c index 8f88a706..0d8c1d34 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -289,7 +289,7 @@ static void print_vni(struct rtattr *t, int ifindex) print_vnifilter_entry_stats(ttb[VXLAN_VNIFILTER_ENTRY_STATS]); close_json_object(); - print_string(PRINT_FP, NULL, "%s", _SL_); + print_nl(); } int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) From patchwork Mon Dec 11 14:07:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487306 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="XqViGnoN" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0227A27A for ; Mon, 11 Dec 2023 06:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nBuKly5+Zi5cOBxPDy5EhRXA/V81N2H6+GYCoQnj13x6hYZSVqZTBqzkNOI5QdNt0zKJcxE4hjPX38Yy3R/5TbIiTjIM60m+fqbAB2S3mIvW0vel3Ja/J5jAMW+1fs5yIMx/WBFFwmg98pDo7nF2EEPYH/qVTYeoJ3OEqZ706je5tdXVrtE2z9lDv7/VW1JCW2ot/mD1cQPua/WfH8YeACDk6dguC+YQ+D9iPxDeGtG8w74p6r0MttVYku68ivZ0fDq7A9LqZ1XuwGd0Sj+RXJZfzbE4yDZGX/gWR2pCWvytHgutmh8LXP2ZvI+GvXh/RV8b/EVAR/AJ7TaSAKQtfQ== 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=+iK6crpGi8+O0c9NeOmfN2gIBUowIISQEKDeWH04P0w=; b=MNLKt4oJsFNjPiLrtXTFRBIjHwwrohTrDe3qkBKDIUtnBhtPCGbO8dC54n0Xm0nEXNHSKtU1lB/U0Ti05s7urqkxrRQ76PSTqg0XuFEYRg5RKAy+QyKfrr0Svj+Tb8Mr3rZ2InAheJbnDkL/A9NCKMvL67Rb+414s9+jq2DzbCf/98XZjn4kNDjgHUFHXvCG0u31uAPv/JJAIbBxwUYanyhepOnB+sI/hja6nGopIbYotheN+ntnnTQdt9xTomr8CctpB2H5XtEyGYoTGwTIOkKdhTK64eBdmUGIGqwyMV9/F24+u8ZQfsP45jKkUZ1zLmkBUXw44Y+fg9dG7QIcvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+iK6crpGi8+O0c9NeOmfN2gIBUowIISQEKDeWH04P0w=; b=XqViGnoN/cIo/lxPeyZRaC5xKOrWXiXR1XtRKGN80lOVFquPj5uKDvC3pO7qk7VzeHU58FS6u9yyYMXXkIJIFExvfEPlKqz47+Vh0NCwtLOCPDPbe2YW/mMl9xXAdkCFhDPH4PV2gzxArjsdIBtoS8g/lItkvQn0H1WyA2AyXoNBgpeGSJ46Ho3iAyk+oaXIJfseDeKT7GA4kdacIp+JHpYPMoU/iys9A0Ns3zu9xYJIfWbwJnNqNDHkEUPq2haaTaoc0D6K8uui8a5G7kBMsgS1iQi5cwdUoWRav3CY7D5r0k20/tUT5WZ4hJjtfGKCDp0jNBflFwZGnPNgfigF9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by BY5PR12MB4193.namprd12.prod.outlook.com (2603:10b6:a03:20c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:16 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:16 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 14/20] bridge: vni: Remove unused argument in open_vni_port() Date: Mon, 11 Dec 2023 09:07:26 -0500 Message-ID: <20231211140732.11475-15-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0122.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::22) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|BY5PR12MB4193:EE_ X-MS-Office365-Filtering-Correlation-Id: 57315d38-e4c6-40f3-839d-08dbfa529ea3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZZ9BVJSYMg/KNgUr3idERlzm3OrOcicP0YOtgYsq/JZVJWUiQZqJp8+1HbJl+L6odoClHRR0CJUjcqiy9Xyt2iLPyR9Tq4NS7WLs85XFo3CkXw4/iuR/EdwAWI9rRHBZwGxodSyEqCcZXeZZeqA7CUENND/cYT78F1meAhU4Y7iN5nDeOw00xbNtbnBu6qvvPCrkVtxoRsh+TCFjaaWm+qSn805vERSie9giPa6r9MYPyTfgTJaPRgd6YaYeg5CS/DKroYDO2CK+A/IiXHTWCV9UkLINyZisRqCz+s2b4qmX2gSQzKjzf5zL1nkBn4GNwWnp/8+2GZjWljkqVLXm40roZq/h0TJrQs9/wbGBsoSlkLAh1+obKntcZzT/P+uyKKYnn4kPwA0iiFJovZf1qPkqOOnYptLfrtCBnR1D6aP9gNbxVOVbSkRTl0k1t5ep8Egc3MnvNaooYEEgBRB/VWwvdXdsZLbGzQ1s+vtmHwo7f5jF5B4IBMyOPAWVA1ZjVOVtdazh04HZggo0kEfstNP3Rab2NpkVw6E+i6Vfmke2K6/s2FXqmkEnI+DlhRHf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(4744005)(2906002)(316002)(6916009)(66946007)(66476007)(66556008)(54906003)(5660300002)(8676002)(8936002)(4326008)(86362001)(36756003)(6512007)(6666004)(6506007)(83380400001)(107886003)(26005)(2616005)(1076003)(6486002)(478600001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dF/Gc5Vmw9VOhzAEOP4rjlppmtj65nHpig7jgQktjxqH/jdzcOvj9GNxGl/NIdTszGXsLgRbOfB/4kXBuWclNKXknHfz4zegNgEiqH3eO33GfSl6f3sJG4TrYTotcrOARxcjyVLtEwjuRzR5TMqgiBRF10K1y1631cRITUStOAFcXM+Ao4/cTQVj8uzHP8xFLn03kOUiZS1Blx+Z34hGlkTrsepsoZaoAZk5OoW9LMzA5phe3T55ncCNgHbDPggLPypVMEz1MN8kRrUHS4W8OVtcawGzksptffs65VG6f7T4U7c/X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/G6BbMuyj0rkG8jM6xFhZvtydpSK72iM5Vtt0TmOi8rj79YWF3pnRQBg7QgFov5f8g2hJt5Wlyn3h5vQ0cKKQIcEqIYlqcAZsz8bi8Nxcq1ypsT+KYlOM2oGEi6n/IltBDdgTe4mH3VUEMmIohdF9KESewA+ahUT0eHurcefWRy472hykZW0srlWgpWg1qslNsBJQCNLuSDYUFxrmXs X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57315d38-e4c6-40f3-839d-08dbfa529ea3 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:15.9989 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SUJw3r6tovjIVm0CqQfLLHB1crM5uk1dqkUj1MU9MjpvuPoNPQ0Cr3aCqvW67e5iHilGTSmQbDCIBplnGcRvCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4193 X-Patchwork-Delegate: dsahern@gmail.com Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 0d8c1d34..44781b01 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -147,7 +147,7 @@ static int vni_modify(int cmd, int argc, char **argv) return 0; } -static void open_vni_port(int ifi_index, const char *fmt) +static void open_vni_port(int ifi_index) { open_json_object(NULL); print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", @@ -334,7 +334,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) continue; if (!opened) { - open_vni_port(tmsg->ifindex, "%s"); + open_vni_port(tmsg->ifindex); opened = true; } else { print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); From patchwork Mon Dec 11 14:07:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487294 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="c59dCil9" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5149A2D54 for ; Mon, 11 Dec 2023 06:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NmF3PRTE3SPQg2DsxqhV4OI9/5vEkVBrVcVOfm5D9Ika4K4qnwrb860TsHwukJXz9mf80F5Dx3fWY9NEYodTaYaLu5haoTOdTfY4PHLmiuG6WxhEQJ976K2k2mzSaTZlAO3WfqqjGBV8nzIughUpZxlMlP8fZgikUJpFKV1AryhrPlLvTt5VVTzQx81usqpCHmSuqFi6Akar3foZ1cEsnlY4vnhLSKkK+X+fFRQ4Dk0roYgS89NazBmjSZ4CBaUfVoWj6lxHApHD3GuZiRKrCEtsVAqMzGvs/5j4KcYfijhW1ELZtBYlpgCQRFl0azUndBnxyhDplmodkB+gPPT4Vw== 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=7Rdau9PYG9AM8qZY0RiFsmr2sIJ+TwVr0mrKyAxtunw=; b=EgHHSnq5Kb6Rq5zmv7yvlepikOGx9eaZ7SieU284XwXmptKthugc2TYyeY2fYoO69gTByjX9EilaLpRxBrqY7266HP60qjbmQTuVKxF2O4ACbfu+hE0ZZYldIjaPQ+SdyI7hgPD7+4v7QhDOSnJfJMoLh+AmjsmotGXHPbT4PZX43kCS3Ze1wGSN3uniyGjZKMnQubZc6jFMhVHOw2f+kmDLOSkYxJT0vlp/BkWeQwOcRR87Dz7DAcwfaj4Szh8rin7V7rdKuNrA0QG0HOTJlKhAwEalTuV4eD/WIGEV0nr+3n4J4a0XITpXTinylxn/TBgbkk6eTBucBwhgKReC8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7Rdau9PYG9AM8qZY0RiFsmr2sIJ+TwVr0mrKyAxtunw=; b=c59dCil9rdKZp1M6K3Y5ikha428otSDFSdwjyLJ1wCfQ7VrKGmGr0XSn+3Ktsy8NfylGrHH54fCliF7qwjD6TTI9qK+zFr+YF1s9wzTOeQsMEBoHv6l48XVCH6u7ta+T4hlII/iSiNolhcRv7F23nKyzPmN/nY9LfYNz4cKjF9LNhM1GzvwavXvKtNOxIQx9JsM9Wg5lIV6cVbXhcNlR6x+knKhNeqRDxsw29XRfbTVlXl1jlZjPIEufKSlDyxyB3s8OKQEBFzCxGZiNuPHgthD6p5N+aDmSJoYkK0e7kS+rsw90jkHBPVusvL3zQ5sOeY4GgjoSKfGnGiDhSJbSww== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:17 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:17 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 15/20] bridge: vni: Align output columns Date: Mon, 11 Dec 2023 09:07:27 -0500 Message-ID: <20231211140732.11475-16-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0325.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:6c::23) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: 8579c432-535f-49fb-f2ed-08dbfa529fb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IXw57UXKhY7+K7rOifF/U4GgFFxcjTXWPaQ08dtzUOX87rzFw2bUkeCwYpD957n5EykpneX9Bq53UqJlarfsb6ROE4NasLUmGYTmhWYDfJoQlOeeu8BdO5FdMocoYx7enmBdYzpSNnYDNfjLSxumN38PpBciMpmI/TZlpfsO//jt31IzbtcS9pmvkHq/v4R356W9MYgKUrqNlb1PkF7utpO8Bnis+/MjnnDt1Bx4BCMBIPEVHh4vdx1fYQ4FMEzo73ls8DMvmjQfmR9Tz4U1DWoc7hg6hPJRgKWYpqVcpPY5pquyU2OvzTEhx7WsMjq2nCVirJ+WZjTmwB41StpnoQqi8Ga5rRWOH+TxxiQEBtepOF25yQ0nbQE4hswU7fLwhedggFxQ2cCad6TQB5KWUQs4RcZeghR43eAw3FMI3kC6doBABrRVM5Oo9ZvKpdwiT6Xe8gRRjNJ8qRFQ2x7x9OKhrcICJ8WpIL23W9F4u7jroIJCAqyONkXakl4yGwf4fOmce2h2WZqoIQMZ/M/bzWAwgf4PvH3m++9kJl4Kdbqx+NT+RkvM170YJe9LIayS X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(6512007)(6506007)(1076003)(5660300002)(26005)(2616005)(107886003)(36756003)(66946007)(6486002)(54906003)(66476007)(66556008)(6916009)(2906002)(83380400001)(41300700001)(478600001)(86362001)(8676002)(8936002)(4326008)(316002)(38100700002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vskvS30Si5ZA/LzBlwNe/1bOIl73RuS0zUm1Rbv20iu5soSsNpsdmaGMGmVk/1jecnLpzAnDZPGyRzM78V++yfW01X9QAyaovzFAOllwrdMLsQQBLcy2Y6TuCtSvMeA0ghzAF903li95bsK859MGrBvsb9Adhju0ceIGuGjypVSndq+o8SbIopUZc7mUcnRGXj6y5r9v1GcKZPUJlB3BPJxQzmvc1+bpcHdUimWR4fo1hFMiWQU1wxotozLeCh4Ne1iOwK6XyB5oQGR/xRPVi7MBlq3b5vsbAhyDfAiDrgwzQvdmrscvD1z6H5EUibQxSecxgL0At6xoV9FViM264CET4jQHMtJGr6o1AYDITUCfz7cUsMtmw90+Ml1f6qqhC6pz7PSF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lWQ/IQY7OtAHpL1zu1LJyRPYIskDq42Fv7vD0OwT+plWOiaZvjojXBvegrJzqauMxYOI3tbEE1SMT/P0Tr+hpNfj7vV3cQ54Zo/2OAoJG2LJSONCWtISlZX4pPRXG X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8579c432-535f-49fb-f2ed-08dbfa529fb0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:17.7643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZnNUZkrN7taINuj4YwRy/pktH05gUbmVbl4+Eidc6D9ZmriJSpeaSxV7bMug5i5/IO1c/qcITAsVg4/jnL149Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 X-Patchwork-Delegate: dsahern@gmail.com Use fixed column widths to improve readability. These changes are similar to commit e0c457b1a5a2 ("bridge: Align output columns"). Before: $ bridge vni dev vni group/remote vxlan1 4001 4002 10.0.0.1 5000-5010 16777214-16777215 10.0.0.2 vxlan2 100 After: $ bridge vni dev vni group/remote vxlan1 4001 4002 10.0.0.1 5000-5010 16777214-16777215 10.0.0.2 vxlan2 100 Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index 44781b01..e9943872 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -23,7 +23,8 @@ static unsigned int filter_index; -#define VXLAN_ID_LEN 15 +/* max len of "-" */ +#define VXLAN_ID_LEN 17 #define __stringify_1(x...) #x #define __stringify(x...) __stringify_1(x) @@ -162,16 +163,18 @@ static void close_vni_port(void) close_json_object(); } -static void print_range(const char *name, __u32 start, __u32 id) +static unsigned int print_range(const char *name, __u32 start, __u32 id) { char end[64]; + int width; snprintf(end, sizeof(end), "%sEnd", name); - print_uint(PRINT_ANY, name, " %u", start); + width = print_uint(PRINT_ANY, name, "%u", start); if (start != id) - print_uint(PRINT_ANY, end, "-%-14u ", id); + width += print_uint(PRINT_ANY, end, "-%u", id); + return width; } static void print_vnifilter_entry_stats(struct rtattr *stats_attr) @@ -231,7 +234,8 @@ static void print_vni(struct rtattr *t, int ifindex) { struct rtattr *ttb[VXLAN_VNIFILTER_ENTRY_MAX+1]; __u32 vni_start = 0; - __u32 vni_end = 0; + unsigned int width; + __u32 vni_end; parse_rtattr_flags(ttb, VXLAN_VNIFILTER_ENTRY_MAX, RTA_DATA(t), RTA_PAYLOAD(t), NLA_F_NESTED); @@ -241,12 +245,13 @@ static void print_vni(struct rtattr *t, int ifindex) if (ttb[VXLAN_VNIFILTER_ENTRY_END]) vni_end = rta_getattr_u32(ttb[VXLAN_VNIFILTER_ENTRY_END]); + else + vni_end = vni_start; open_json_object(NULL); - if (vni_end) - print_range("vni", vni_start, vni_end); - else - print_uint(PRINT_ANY, "vni", " %-14u", vni_start); + width = print_range("vni", vni_start, vni_end); + if (!is_json_context()) + printf("%-*s ", VXLAN_ID_LEN - width, ""); if (ttb[VXLAN_VNIFILTER_ENTRY_GROUP]) { __be32 addr = rta_getattr_u32(ttb[VXLAN_VNIFILTER_ENTRY_GROUP]); @@ -255,12 +260,12 @@ static void print_vni(struct rtattr *t, int ifindex) if (IN_MULTICAST(ntohl(addr))) print_string(PRINT_ANY, "group", - " %s", + "%s", format_host(AF_INET, 4, &addr)); else print_string(PRINT_ANY, "remote", - " %s", + "%s", format_host(AF_INET, 4, &addr)); } } else if (ttb[VXLAN_VNIFILTER_ENTRY_GROUP6]) { @@ -271,14 +276,14 @@ static void print_vni(struct rtattr *t, int ifindex) if (IN6_IS_ADDR_MULTICAST(&addr)) print_string(PRINT_ANY, "group", - " %s", + "%s", format_host(AF_INET6, sizeof(struct in6_addr), &addr)); else print_string(PRINT_ANY, "remote", - " %s", + "%s", format_host(AF_INET6, sizeof(struct in6_addr), &addr)); @@ -382,13 +387,10 @@ static int vni_show(int argc, char **argv) exit(1); } - if (!is_json_context()) { + if (!is_json_context()) printf("%-" __stringify(IFNAMSIZ) "s %-" - __stringify(VXLAN_ID_LEN) "s %-" - __stringify(15) "s", - "dev", "vni", "group/remote"); - printf("\n"); - } + __stringify(VXLAN_ID_LEN) "s group/remote\n", "dev", + "vni"); ret = rtnl_dump_filter(&rth, print_vnifilter_rtm, NULL); if (ret < 0) { From patchwork Mon Dec 11 14:07:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487299 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="f9dCSt1P" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAAC12113 for ; Mon, 11 Dec 2023 06:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f26RdZzcRxuG3W4dZ55ELs+rXqxqakdAjEe/uGPxsGBjUADJSNV9hEtf0AylOFvPBirJdXQf0B/RwJBLXupcSHVW247KAxU0G+nACS4gQFxQVTuI+zQN5HNmAN5woXfcQW8ucvC91KVYz9Fncak8wV4tqjypumjkFrKhP4mKGP6i4+4yh8z/LgnAnJ0S/Kys47S3Z9sAIIfQjxZBzhvwvQSX3S2olLhWnNEhjA1gL8wmLQXcRjCJ2qydhj10Gk/9Qum4Gn4y0MKtpbuAnpKD2KRFMgQPOGQNcYnD1LThnz6aEGM15rTnlOVDaROcRQflrR2vbzLAoAuhWrlNNKC6xg== 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=wEQshub/1/xJ1F043v9d07mHlf+sScRDh2PcizKwZTI=; b=g1LrXXJKwSslYQXnqNP81BuhgVtcMNjtD8JY0wh+SVu8UZ6GL5F4qyt1Qy0PZ7RMS+5CjW8JwBZd1SyTs8jcRJpCWTBqEpavS+YyLrNjjvR3BemctNFTG5lgiY1zJf4EeN0zLOTrkRU+wbIha1Q9syrdpMHup0F03boQt5CKDvSnxVnZV2i6A2rqD8REvE3Ajv0Kx0QWMmF0XHpIQtLUFELcXnJSs5R2J2uO7Qlmco1gPM+UspDKRFf5efbY2D8x8WWGX8Fw99CWU2CRlFF89g8vbHju9SoBAsQz8NihE0cnxnC86hwQJc8mYIaHEH23+GIVlbKCaaSUgIJxtPu+KQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wEQshub/1/xJ1F043v9d07mHlf+sScRDh2PcizKwZTI=; b=f9dCSt1PuGgUmxBQviqLg6APInMveViut9KjHeeRMm44iANHWtZb+npZF5WUYv7wNa4U0pUyC2XqwHYGkC3FSAk8D3C3JXry09bzP8UtS/xal1TYQjXop7yhAG4Fuvy9ZVwVPF6gr4pm5HP2CtGMA8TGmZK0hE6z7sxp0/6NB30VhIdm1RvQHRuqXR//xfiInyP+O41U509/8FqdDvxO9Xyq+agzgnrt687oQfm+LYgkfM0xubF8ELZ1RvjswoSSTfhKNvFbLuC+3Ajayb3zDso6smR75L41BbweeawZwqgz7jaHg9SHpi/zMMkd+ZhciZDEoGQJsWLlLBT420WTdQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:20 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:20 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 16/20] bridge: vni: Indent statistics with 2 spaces Date: Mon, 11 Dec 2023 09:07:28 -0500 Message-ID: <20231211140732.11475-17-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR01CA0130.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::30) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f514781-4eee-4ba3-4c9a-08dbfa52a108 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k6wah/MO0f5RWr1Uk1RkLFNX0suU2oKj7C86O8i9diKUBdRDeD2mMPjZXMB7uQNrjOiI1RsVzXUnzN89Rzf7fbsO0YiOXTVACKimO8TdlaeCmTyvAfNY+fmBQAN83i5AyEYgcUXUpOkKcvxCWKdGhS5gwzuPKkSkgQd5pTKugUHjYpoMGfcSq2rKFfqEQJ5GMmPwqTfs/Wa8RtGzZLu9vYNfRZ27bb8HWsaxHbbQ6+UZZAu7REtoVdVpuWr8pQ8BcCSjITLiDKwo/66mNeUiOjEoR67ktAYV89qrfsvTeqVh8bLL+aiB94xYHb9SRLOtNBviC9f/muGxXua4N6l+z0gLIrBzCe7oelrMT+Iqa7Hszb4vIUHCXCnNkuCJ1GsX38qaWZz7z8/rWuRE+GZWCLGHEASH6c95luJGAynZFhsL5oD8l/zPJxNafXYggMHogxCCA616V9eNmhoBFnZH67Dv9cJd6gyT0VrRP4XXTZJ/u+a6hasLpH9hbRc2rTNqbkG4QKYO0lGkr3cZiMWBbE33DNP9hXAdrquOjYmmjvU27e/GX+4y3JaaBaWKjR78 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(6512007)(6506007)(1076003)(5660300002)(26005)(2616005)(107886003)(36756003)(66946007)(6486002)(54906003)(66476007)(66556008)(6916009)(2906002)(83380400001)(41300700001)(478600001)(86362001)(8676002)(8936002)(4326008)(316002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D36iBQR/9hGcsTm/eAeU2Oaw3Nx0QUNKRWhcYb/aC4rWuM4K0QEvtBRhrVEPe9iTxUhfCzZUUARym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iCvpi3p4SxqalhNTAyGZVbUuWLgN0HA9nU5REu0CU+Cd7Utbopiof+cmb/xxvqtTsdPfnTm50fR5IDpDXzvk+BDsP9qRiDcCvL8LyUgO9GYmhMA+Y8s3+l5rfgWy+aBhbnWFvf0eBhOwHm+nmmOvsbVWp7rtMEwHStRTsztATGQc2ICmqfPOMIniavZ3sx9PLVy4wfg2ETTFMwd5j2qKOSbuVtiOFWZosF4RM1Ffu/MGeD8A7gze166x1ynmeXVikYZzrSpivnuBtY+6AaGMnwargZBCGZn8yab9W6wWDRqg83GgtAGMLX9XXd3PCW+Lm6o8Sko9Z9WlS/Us5AYeF34N+9U7YOaUuszAPUh7glYI7OsI/R6EVKBzmKQtNU5kSFThLCWC44i/iUifmVVOPbzUCkctEeyZB0bDLDhN0OpAFRZ3N/ezw2fp X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f514781-4eee-4ba3-4c9a-08dbfa52a108 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:20.0316 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H4hPVEw5emgc45K/UNJjuWtn0bF3FUY8ch5EdZzl62cSEYzeNRC4XvJoqRPhrYPwHhQwn9TppIPJNj7sBZg4DA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 X-Patchwork-Delegate: dsahern@gmail.com `bridge -s vlan` indents statistics with 2 spaces compared to the vlan id column while `bridge -s vni` indents them with 1 space. Change `bridge vni` to match the behavior of `bridge vlan` since that second command predates `bridge vni`. Before: $ bridge -s vni dev vni group/remote vxlan1 4001 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 4002 10.0.0.1 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 vxlan2 100 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 After: $ bridge -s vni dev vni group/remote vxlan1 4001 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 4002 10.0.0.1 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 vxlan2 100 RX: bytes 0 pkts 0 drops 0 errors 0 TX: bytes 0 pkts 0 drops 0 errors 0 Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vni.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bridge/vni.c b/bridge/vni.c index e9943872..2c6d506a 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -187,8 +187,8 @@ static void print_vnifilter_entry_stats(struct rtattr *stats_attr) RTA_PAYLOAD(stats_attr), NLA_F_NESTED); print_nl(); - print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); - print_string(PRINT_FP, NULL, "RX: ", ""); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s RX: ", + ""); if (stb[VNIFILTER_ENTRY_STATS_RX_BYTES]) { stat = rta_getattr_u64(stb[VNIFILTER_ENTRY_STATS_RX_BYTES]); @@ -208,8 +208,8 @@ static void print_vnifilter_entry_stats(struct rtattr *stats_attr) } print_nl(); - print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); - print_string(PRINT_FP, NULL, "TX: ", ""); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s TX: ", + ""); if (stb[VNIFILTER_ENTRY_STATS_TX_BYTES]) { stat = rta_getattr_u64(stb[VNIFILTER_ENTRY_STATS_TX_BYTES]); From patchwork Mon Dec 11 14:07:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487303 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QFvzNu+t" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251E82115 for ; Mon, 11 Dec 2023 06:08:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlTgzG+OJlInf+vIPYH509W14ZamGc6i0ICczn7IA8d2rHcDDYGcyUl4gm567waTDMHUmsbH1W0xBqdKjrC51cNqgTfZtbxHjJnDtUZV/faHLFUlkSEB7VskoxqsP52kXgSoGlGZzEc4KDLZEKQyjJb/B9ivvQATGjbDdMXYK/WuVoEi59PSge8MQkN9ni9+FbqqALinT7XcWSClJFLHXXrb2GEwhuF3hPZpaqKX3GIGqI5znpSI8LQ9Bp0qHDhpdRe0l/uQdUY6pSA3dc1kdjCrhlSFHK+IKt7QUKqb4xtWC7GwUiTDOM0somHxD1XquZSig1hkGj7VVLUyF9Bk8A== 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=2y7nbb0vnAYfLBOXRjELDsfoAaUOLNFUFIkL/wwnUv4=; b=bGoreglCtYiwVyTzpNzfTyLrn8XFe+eFSRqcghSuEC6Dd26rXbdaXhxN91zM1Li1n6OtMEUlUTOzoED2MzocrPiwNOvH03Quu+x/4cmx/6yg+C+qvW9UVgyYckH7ffAJk2CjDtKc8UjK+IR10iFeN8p3Af8q/fCE8cn2nkFePZTEFgW+vzKBTvHbFotpN4WnZK7ywf14RiEAU2ymJcntgHQWtYdSEQdyNuMPBmW36MYWxMp9m41md7Vc9ZGzEsivnoW5zNmdj8kBu6fcYIXqBD4gpKkqzPrYD7hCBTvs2TR8I6DBTaYN3jx+WsQwD1zx/umENFYxbIoXrfnt2IinZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2y7nbb0vnAYfLBOXRjELDsfoAaUOLNFUFIkL/wwnUv4=; b=QFvzNu+t76BSqbrv4GCOSqEXTqnjlAgsw5qviZih7HCeTLcq/7QXQXDPVmFeTpnrFgiQa0+mxT8KxLotCgHG7RednjVdKGL8WHmK5txv3WrkgarWKW8fhB4xLzuUskTk1N34QVRLBJRTMGJiTtKsmWKKAeTNUGsdQeacjhJ5E8sCikNZHlwDK3eKafIOpc0txOWdVTfUMFJqvUZTRl5aUo/DTwXfe/Ig6m6WiqG4TLI1l7QUjPP5cnfQz5ZQF7+yAy2VAJUQ8m5AbyfMJi/tyKoPgHYfvHg+uY9Kj5V4/i5AO5Yu4AVE/I5d1p1ilmMyg95kVpFybYkqAwWW3w6KoA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:22 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:22 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 17/20] bridge: Deduplicate print_range() Date: Mon, 11 Dec 2023 09:07:29 -0500 Message-ID: <20231211140732.11475-18-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQXP288CA0032.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::42) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: 56adb06c-132a-4f27-30eb-08dbfa52a22b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iuCBX6x9g10pbGX9Wa8RULz9RCu2pr0CkXvUDHzLtofM956G35Xj2PV2UtqAqLczeIP5t0g21HyRmYVkIQU89BebGK2z2ZAhSuEzwEifmB47dWIHf9qeztZpYaPA9fBdnQg/VAJKJib0+5ZpoVIDxKTkP6WqcAI2UyDa4emCkeoxWfNJFRqqkWcTqHEe7IZGhNDAT99tgZNo8StfpOWj99JrjcgfU0FX+Tk3L7vTbpOxZVD/lYAwURJ83VUJY+W9Qb0CckEnFR/eV574Yj42evgzoMfLPzZO0mTwpeBh04LWzT723rBDZ+OqJS7qB2WKc4GZ1zCqgG34S+YkssEnoJxlSi+EuVQtChwBm6Xl9yWxm+w3nVDOFeHCfGB7zncuF7H2jUivtkdbNrqQBEhmKt++QAyuqXNwl/csqajtbYHNWnqL7Pt+FUQuk5yOCIPW/yDWBUp4Bye1+FyxXDgdmfwItgj78h+8RBVzHzz6qiMAuvItgHHgjWmDGIaVRV9/ydpK6bj2EgZXOOrowOPdL46N7dqzaZjfoK5f9B1jFaLU4/nVvxvsLT58HC0sDQ82 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(6512007)(6506007)(1076003)(5660300002)(26005)(2616005)(107886003)(36756003)(66946007)(6486002)(54906003)(66476007)(66556008)(6916009)(2906002)(83380400001)(41300700001)(478600001)(86362001)(8676002)(8936002)(4326008)(316002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tfsV3JzQzNPVPA0ZyQw4vAkiewTuzn4a65mqD0WC8H/Y7Jf14ZtRVuSGWBTA9i9lzXUu2lCpHyJp8Lrd2y6Y56TUw9uFfT38PgdJbzUZucSX/b3QSgR9N5tbjm9pZ3vRlbsfSjN/aE1OlO84DKbCKr/i8gWeA8VSmH2i7ez5RWyEyYZFOGb7clRc1sFcSNMH3hj7tkk8kyTw9e4bvdMyE7kJlZbUGrPtOTXAPFNUAY5oGwFKjgr0GEpAxWw9wJE5j27Vl9ljCnmpwK3Aaz53da2d08QnRxAatJu6OD/D5XK4TwykIYKXUUVNVrNi8CHKO3X18GmCdvCDRnnzfnbghsLEF6gK3RKAKT6ESlg/KfGCA/GZ3HD9upuAynV6ivr6szDKCrJPSzuHjnPe4cevBvqFTRb6+eki2msbDCihx2e5OB4tQUJ2BeLRG937a8Fy2xqvBCtvwRR/I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G6bBefeZY0uFbQ1i5Eg+y6jlcqy2t57cuKbEPbvhLNdUV2dTzBBkl4N3GzMbBTl1 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56adb06c-132a-4f27-30eb-08dbfa52a22b X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:21.9569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TYkjWAlKM3PEMzAnVe5W7BTowGoBL5QZjncVERHXKTXb0PmEED0UjY3fbuyoxYIqD44RkRZWCM0cUfhkPXegbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 X-Patchwork-Delegate: dsahern@gmail.com The two implementations are now identical so keep only one instance and move it to json_print.c where there are already a few other specialized printing functions. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vlan.c | 14 -------------- bridge/vni.c | 14 -------------- include/json_print.h | 2 ++ lib/json_print.c | 14 ++++++++++++++ 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 7a175b04..05e6a620 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -590,20 +590,6 @@ static void close_vlan_port(void) close_json_object(); } -static unsigned int print_range(const char *name, __u32 start, __u32 id) -{ - char end[64]; - int width; - - snprintf(end, sizeof(end), "%sEnd", name); - - width = print_uint(PRINT_ANY, name, "%u", start); - if (start != id) - width += print_uint(PRINT_ANY, end, "-%u", id); - - return width; -} - static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex) { struct rtattr *i, *list = tb; diff --git a/bridge/vni.c b/bridge/vni.c index 2c6d506a..ffc3e188 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -163,20 +163,6 @@ static void close_vni_port(void) close_json_object(); } -static unsigned int print_range(const char *name, __u32 start, __u32 id) -{ - char end[64]; - int width; - - snprintf(end, sizeof(end), "%sEnd", name); - - width = print_uint(PRINT_ANY, name, "%u", start); - if (start != id) - width += print_uint(PRINT_ANY, end, "-%u", id); - - return width; -} - static void print_vnifilter_entry_stats(struct rtattr *stats_attr) { struct rtattr *stb[VNIFILTER_ENTRY_STATS_MAX+1]; diff --git a/include/json_print.h b/include/json_print.h index 0b1d84f7..86dc5f16 100644 --- a/include/json_print.h +++ b/include/json_print.h @@ -97,6 +97,8 @@ static inline int print_rate(bool use_iec, enum output_type t, return print_color_rate(use_iec, t, COLOR_NONE, key, fmt, rate); } +unsigned int print_range(const char *name, __u32 start, __u32 id); + int print_color_bool_opt(enum output_type type, enum color_attr color, const char *key, bool value, bool show); diff --git a/lib/json_print.c b/lib/json_print.c index 602de027..072105c0 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -374,3 +374,17 @@ int print_color_rate(bool use_iec, enum output_type type, enum color_attr color, free(buf); return rc; } + +unsigned int print_range(const char *name, __u32 start, __u32 id) +{ + char end[64]; + int width; + + snprintf(end, sizeof(end), "%sEnd", name); + + width = print_uint(PRINT_ANY, name, "%u", start); + if (start != id) + width += print_uint(PRINT_ANY, end, "-%u", id); + + return width; +} From patchwork Mon Dec 11 14:07:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487307 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="MQNzjMZ2" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDAF6A27D for ; Mon, 11 Dec 2023 06:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZ1+4yNW3EkFkaFRpp5cw/uavl9iYHQLpftsGjmFzcLLOUpHvX7Mqmh9nWmwZHAxWBCLgGHLS7G32NIUEQp2rnRL+yZw3tN3SzUsik2mS58nH+g8MTHPHHDccw2c5LkcgJllMf8n2dmhX2N6Dqn2zjoBzRxEeeZ8wJS5r1nkHSFDn+2K4p/8XVZDyPtcQm+Us/9HKfmQBl8UfB3H23b5kV4NVRpJPOZgZF/cKlSTObHpOcwruXoEkvsMhpMDZGF3JhKPYPDfrAttrjy6AO7AqAMVrjwgTB6AxcYAORHHqQpqJlsAypbrZk64+Vh//3lIify2OYZzGAVumKQqpWaquQ== 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=2WLBdPCV+g2NcQI7j912WueceHHf2JgDu/PD93Kkv78=; b=CoQYwaOqB6DbmAi7yHPQhRI0MkQTxLqXE6BHh5I8RJi+G2VilRbxV7rOYB4WHIi8blHXA3JSWoKJcmVlU+VpKF8JY6D1HdG0X3hqbCsUGLe1nAj3yDSU8Ky+rc/hZO6i7ifGPwnRmjJPMRYY8qjS0dVAkdV7tFPnW6By3sQ4tL6bJA8YN0Af4N+0Ec0HVw7cbfyNJq1mQQ9U+3TCcDo0xMJ6feSW7mnZD6H+AYMk3+bg59pOmzVwGuqRs3aLn7oyUFDEUrbjF1r7FHubhUFb2VkNtOM07skQYmYu2Hfn3Ktq7czjfVaXtsitoQDLcR783WJobpgUbfrRJJMfUj+AtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2WLBdPCV+g2NcQI7j912WueceHHf2JgDu/PD93Kkv78=; b=MQNzjMZ2AkG/v66ZkVBktNpxyTXqLlFBJyKC+qD0u9fiyEvLB9urdscdGN2ue/qjwd2lrAG4fRoygU8BRS3lK30ANMeWPTiCjOYXHTShpuGeHRrARBoCXvZWrz8p2PK0+mKosCfmE5Jc4smXkNZOa4wQFCbAhbxJjhdjuy0zJz2jzgNm3EuK8+AXpRyCV5tCR3t0P7aSoSH0fkqPjNPwuWjRGrg/tM58Qaw6EIm9EmSvfbjBWL5apF+oUaUHp7/t+Dercig1H6t5Q4abGwGqwIN0qhF7NIsYAODQaKDs1Jj9dMFf/heK+ReliPkY3kbmuY89/JEdO43GLQykreg4Cw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:26 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:26 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 18/20] json_print: Output to temporary buffer in print_range() only as needed Date: Mon, 11 Dec 2023 09:07:30 -0500 Message-ID: <20231211140732.11475-19-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0130.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:5::33) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: d5b6e7e2-4cbb-4569-34e4-08dbfa52a48b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KoTV7x6gbt+p56oVM1tH2DWf8k7mhCu3s1IZQ1lI//QxuBvGAllq51VruR3gLTXJAmwQdiHlyJJUv622IM9mDdFtLBBKUYJm/y/jtdTHZ3EQ8U1quJ8iRsebVvACv2gaeI+bJBaHZad5kw1K5Ndicq5IMERoouQ6tqybmRqmIRQ5FxYV8xTeUbTq/gqt2b1l0tu1CksQilHgJbYdK1Nzkz8QUfPtagKk6EEtdr5OH6H2WGV+chgGBncewtlOeVeZMwAlAbBYcX03NfBr0Tc6RYibMk4c9RS29paFqkDBHeuxKCKULDurP5QahGdsGirV9mnYjgNITRyKRMiLlsBpLJSeZFtQ+bYmdpxRVt4aA2gWveERv09BTghx2z5iNYaj4GmLLJ6/R+4P0tMpFsy1E0jOFcOP1/FxG1cJ7dc579WVpxP83Q61iaEIsTmwmDGmpMO6/QQtJWWWl5G/W9NuCPbw2cYyNc3Ap0BAzdX9WJIVYefKRkuY5UgDExT0ThWfbjaa+SjChDNtHPdk7vZF5Yk3tRR2mDNFovcsUrcWyIP340RU7hAosVlJ2vSwWZjX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(6512007)(6506007)(1076003)(5660300002)(26005)(2616005)(107886003)(36756003)(66946007)(6486002)(54906003)(66476007)(66556008)(6916009)(4744005)(2906002)(83380400001)(41300700001)(478600001)(86362001)(8676002)(8936002)(4326008)(316002)(38100700002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KvqM60i9IXHZGV2Wmj7s6cbN1NGazfvB2jXN8txyfGWYTVYhGclsVVBFd664AUUqWL5petI6dodDFZg8fDm6TfdoBc3aknPupPtJLGLu8pXWlyQdm1ab9sHYLsVtxd/RqBNb/dTGe0Ah7aYnmgjrheuLNMSv1cKl9oYno7RW9Gk/jj1ZAweCyjaNxk+WqDNz50Mgkoqrpyw54gyzeJMhETxf2QrI5qB3hfBMmivGH9zkzyrkgFrbGSxyW5ZP6DMOsHsoT4EJMKQykKff8hQ6eeKvX+g4BOyb5ZJMuAtoMw8DHNzxPalFZwxXKeMFxAEHoMd7JuucxxE4vFXSkYVqQWCEfeH+HkeZzcOyB+McZnz0/4agJPfa+6DLVbnU9vvby35eQ2/f6mO93UYy+NPmPBPSKyEeqhtlSC0LdZuNeWYSeqd3ACM3o76Kk8sdUExLX6MT3KJBtht8H11bDDzW7u8oxty2sr/AE7z5fMgtXfleYyKcXb1EVG0PZJwmRce3dqdBCNaOpkUR+ZU4u+98p3jr/iCoPXxLAV0djM+L/OthLgsa+dOyRDhev2jzWm7ETeMZAVVHz4P4TiyI5KeOLzTIbB/nBYLJGUT+Cv9YgOmlG8Fw90ZeeH0Jsq2PPcbNqhyD4Ki1a0HDAZuIBgvvVUdLZRe0H1ydSMOfsI/vMgWtxL6pS2NPF/RGY4X5nxvsn8aT+LxMstdhflUBHi7KR2mlBBgM70J5xZ7znoBMN9TktVnnLAT05zBKbDakohuqoBgLzLGRHPgj2WHFzxss2QUU+xcF+KrjUdLjq9f4chSSLVJPHH1MG8qOHjNhjVbBK5dpSRCXgssgBE7bWur4+DaUBJVCoZfxDc0OZs/ypG0F4zDzOtMAirsHzZHgki4NwvcPUoea8igqfe7t1COMRs3Mni3aoz9uFmbGFDB8tYr7pzc72+cE2gpCXPQaYoYmpPlZ5ge6+BFKrVqZoeEW0KQMLDjeM7vVguCe0xDLSERJE0UmziNxcbu6DNCv+sux8goHpocYOFNCEd9iKPuAtDJLBj7ahG7/uLHvFY+JksA75QLKr0MtaRvIvvwgtC2CZAEwsNbzGh1tXZb5cq1Rb76g3E5/kalnJkKPCxRBgB0fb0WR/+qiEyMaM4VGgCNPE8Z4y5qZHyFqJcBBjmxrnXeeY/gEhRBphKMo5Dv5+Hu8bOS40B2rwtdlhXSnwRfy8VmY6uy9Cfuocrnk25r2V2mR5cNTiL+58EAgCsIvMTKYuhRf+KeAM2VNwhnqjEddnjNmaSwjWvoW8uz4O7obiVTOsqYfHkay/tjRxrQuK69IbYBbU/XhWDrels0Whbe77ZFR/p6YH2iNACFu8FbYt01u5fvLa0gze6aPoB0gGQd6kJr16h1lcWFkver/DpFjW/Q9lSIIYAXaS3ggR51G4mQTE8nh9llTZTgJJnI3uKjR+Aj3OIOuDVg1V8A4QdkbMLwh/vCk1n9XG3sITHZDUosX0i+tOwf1DdMIbVOAwcFNojN9AVY81seUOhSrn6XkJ0X1QJpqytO0SRMfmrvZhcMJRTqfsHiHEP7WwiCjuaAeJaRPPmkcM08Z/G4BwWRUU9Ti6ZHp0pMZ6umJ7bbK+A== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5b6e7e2-4cbb-4569-34e4-08dbfa52a48b X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:26.0403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9G6py+KoTrmF88Pc5iNay57+QF+/qKAwFvrCaHdurq+f/7964QKxYO5H91XBVVCZwz5Dsgwkf25uDXAc1L5v2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 X-Patchwork-Delegate: dsahern@gmail.com The string that's formatted in the "end" buffer is only needed when outputting a range so move the snprintf() call within the condition. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- lib/json_print.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/json_print.c b/lib/json_print.c index 072105c0..f38171ff 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -377,14 +377,15 @@ int print_color_rate(bool use_iec, enum output_type type, enum color_attr color, unsigned int print_range(const char *name, __u32 start, __u32 id) { - char end[64]; int width; - snprintf(end, sizeof(end), "%sEnd", name); - width = print_uint(PRINT_ANY, name, "%u", start); - if (start != id) + if (start != id) { + char end[64]; + + snprintf(end, sizeof(end), "%sEnd", name); width += print_uint(PRINT_ANY, end, "-%u", id); + } return width; } From patchwork Mon Dec 11 14:07:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487308 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Gnt3G5qR" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E5C268A for ; Mon, 11 Dec 2023 06:08:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITCbkJpa85Lv+vUKKVCfWA5wDdgkrG8yQvs0h78CvgW9ohA4n0pscN8B4SKzHS83PTXKQPCq0UWvRixNgnNCaVoGI6oLozm8lcAE/87HD9vqpmn9Hc+ZiAxoZwPkCFnd/g3mWPsh+uG62eF0NdAepNIu0ebqPeV33USLbufWn/DBcEi1oDUtcJBOxAf+OkOxBt6wj2hSJO4K7PugkrCptcgadO5eGMQf/CG/5QVxuYuiri72jJxLSqYVMta1Qq8LuRMos+bStjOHzjsxVN7AtU4WHz3J1gMv8tJqpGMIV9wd0BK6Lvzi639dgmwQbvMMdY3Y6NHpq6cwOU/XH9aT+g== 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=3bT/MIWOWf/FpoOQXEAlTvcGlfc7cLFeB2ulJDxNhSk=; b=HUkObmzinxc7b5sayOUJnVfPQd0uFYjGTbeWMW/0vRE0WYyx8rIG3xPJeBqIA+rmVZUU+P98/SEgLK0QkSpvCEnLhJTuI2h4cHhqKEN/RAmcm2ECDqEu4vQwnMt6vD1/cVvITbPR98imk6ZBuGEYboVz4W0esZnqA8GeANjbiqGM7XGZZ/hCryntwb2uHP+XwTrYEPYJ9cgZa/ExEidQtS0s20oueWZYr7QmbTAnmbVUxdUb685U74hvxFZwhabKczkQAOZL9p3rsSHZTROyVRTdMxYxB8+Pn9PF3VhYJsyFI0KbwRrv2u03j1FeFAOoqOBCjZJW8ZnWb0gc0QHy5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3bT/MIWOWf/FpoOQXEAlTvcGlfc7cLFeB2ulJDxNhSk=; b=Gnt3G5qRStll1fACC7vN5QihPKquaduJ38G4EDbKyX//UsfkqPYzPJRceggoFwfQsfSWhAcY6UAObznLllijZPXfrW+kSsd7qDHWb5LM8h+K5P/WnvEovxhkP3gfIdFhPuOjCCijAXhqw+3bBIzp3HkT/aqaRBZ1/4R5TR1yi/p7cHXvaDnywq8MeCyYO6kUWP0CtZ3pU4PZ7ZQSrYn7+I9ez2IHe5AhiHmCqPiLlFqkwNXz6VNJ4/pef5VQNyc4L6AbyLLnAbyI7PmmebljI/09deUa6Ts51BspxXmju4YalChc/z/wOw9QhCE0uUn9ZvJDSFMFn/8rtTzuFFO9xQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:28 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:28 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 19/20] json_print: Rename print_range() argument Date: Mon, 11 Dec 2023 09:07:31 -0500 Message-ID: <20231211140732.11475-20-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQXP288CA0015.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::31) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: 527bce7b-2485-434f-7a3d-08dbfa52a5ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wkdxUpZvZ/wu2SbNXUp1nMB2gPioqJBPOS4EupG0427diXQoRHjDprHxcF5QBjrMC6WhfZ2OkJiZmYmH0EXzVt8sO3aAhNfc8fzS7f83LZ8L75RnUCQ4aALZOeOyxW3Dvjk9R64cQbrfGrcR7Lrrk3V3Rg3UAsaHZ9Cp3odcHf9fE3Pq3MB/Vi3xCKV3yJYBUWI6buFZoruWjl1/mVdAPlN15L1IEgTb3Hkp1NCbuzydF7m970FSXHI/EM3kijQW1FQ8QgJEJ+W0FAKzUAs2XirvsMSWBOZ54Dr+zl7syy56Pr2vWuZGYG8k3D+9zw/OuFWSx4uCjyDtJ9h9+gT/OcRqyrMSFEiMGqJoU22tgz8teo1dAFZUHL6Z1Nce9yhZGYaPnO54NsQc4MXSsZzCIvI/yrshEpjB6M0RWC7mznk6/X4l+7FHrF5inIodrG/LT2HPGw9tbYFf8eXdZXZ1oA24qDnQtprmLT30hyhqXqRabHI9yQ4cTnAGyohxcWqkRny/uQ/IyOEY8j8S55HYa1Dujw5vUOEKu2UjWvw6Mlm0Tt1WZFwetwOZA9tC4bUz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(6512007)(6506007)(1076003)(5660300002)(26005)(2616005)(107886003)(36756003)(66946007)(6486002)(54906003)(66476007)(66556008)(6916009)(2906002)(83380400001)(41300700001)(478600001)(86362001)(8676002)(8936002)(4326008)(316002)(38100700002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KP3XBdfqSZABXANEfXP9p+Yd2ZzZfRbHdSF9lHKy2MQ9szIBWjoJcI319E18UjCbaPll/NOFaXBEK7mYVpxNLqOxNJRsko12ul4y7x70QXh5DROPP2Wxh3IEDnyzQtwZYdMGIshAugCW3b+MIGWPQ0SOiLfMqJAYRqf0FKoyiOgbpI+8e+tDhVDhaYNQwplrOQdizjfu0BqXGcKHYbDpajzQoxs3+7zmgsizZmYyCrL5toz5YFN6W4mxEFR+hbCNegY+BYdIahDTA6fYKD7Xr5XKMWQmuf1rEFGOyv+u/olmAmr6FfWpWthDqDZLQbiC6XkTVA/J3IBL/7evIhVFEI4xBtXYueFz3VWSHt/Rxy/lKE4/ZPhip0zCEuqZsUfzSTARXj6XAbAuiSBVGcOYrIpOf/DM/Uv8mjCEbMaKNiCJAefkMAcgeDb1XwlQr627l82i6raIWejs+4+UcZ7xuQ1tfmdXJXbvlEUlgoBRmiwmJqWBOd8xW4iQ3KpZvsBjj1gpDqxil+2yAAV06xpZIS1FWaulBOpFf9kuTGx40XoCSvydK8yiQXBmx/F/WStvlltxvjnucySbyu/+RamNZNNEDxBYySgu2Eb5EYWVKaIRMoHYnhlCAcMQhfU/aL/mhagIQBvBtAdqjcJA63mpuOVkhkMP8Yy1NmvHrGEPT2Ab1o0pj1Xf4CorZx8BaAoYJOniy42/SISktz/dPAQ7yWiw23kVgoXINXpH+EZ/34k0+bOz3bkV8sExs0VfTgY7o5QbEgXdsSYFD/gjiNBVDfym7iDSWYj9jfVySS76IC/lpJd/p7thA+4qy4n7E4Xx+Jf1xmCexWbgGqjxvFJxKr20t0cr1HduIKpnxlZu+LE0+l580JOG3o2sbM1ZJUachMpjpcBerEPFDNvYB/eNBESL2dp49QkhYTrgvDry8WpV3brPoDnW8TXm4YTsaW4nahwuFkBR/x20VYeJEw9Ea0DaXnZaPkqNOhO/0JhKYavD1LUnEug7StX6kRKOP06t3jDs4y5ETp4Cx79VHa/HA0U2aif7qcYkt4kiK3dttQT7p6NEn2/qRjZ9dt4m1KXUc70rwskGQFCQgb5dLPPvKGn/81WPluFfoN+pwrjUR697hVGpWYIGDxabK0QnkLkh8jw6i5Zcm4TI7aG8xA+m6iOlx0+gjQ6s4FBN7aQItUrnOV4oiBu0UpAcGXH7uSF+xEf5rquNI0KhTHFPUdGH/A+TEd0Rid7SlAUMfHkR1ONFofffcIyuh6bwe1MQg8nizLBgJoNJoZAl1sbhX+YGPJgzKJ1rMUWA42LPVc0Dk5EAoyN+Rx0VFRX0RkvKcGZsZxHFvP3G2DIzqqpEcF9K7YbBV2s3Jfc5mzDdoS0FnXsetMW5OeULG6yBn9GCmNGNsmF0IR8e9xO2tGTwPah/5G39IBFs9WeYKCiZY1EW++98JPdU9VtmJWk8R3b3ar+zIXsIT5sCyWfSMyUZ9TPDOCJEkNvttLb36FcMRmn0u8I9Vz0XvFhtpheu9hnj61V9S4yWDSQy4jtKLkynwhOoe7xM5sHgHx5mrqrealsDyYZrwR4geeEfcV0tf5J+uE0A X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 527bce7b-2485-434f-7a3d-08dbfa52a5ee X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:28.2117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RdT3wi+ukQhZYqjl7c/rrVAHv4FSfJ8KFgkDpMNrMLX44HALQ2Ko21IUb8Nxk7UobLNXzbuiRqNSH5UMwMcfUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 X-Patchwork-Delegate: dsahern@gmail.com The second argument's purpose is better conveyed by calling it "end" rather than "id" so rename it. Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- include/json_print.h | 2 +- lib/json_print.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/json_print.h b/include/json_print.h index 86dc5f16..daebcf5d 100644 --- a/include/json_print.h +++ b/include/json_print.h @@ -97,7 +97,7 @@ static inline int print_rate(bool use_iec, enum output_type t, return print_color_rate(use_iec, t, COLOR_NONE, key, fmt, rate); } -unsigned int print_range(const char *name, __u32 start, __u32 id); +unsigned int print_range(const char *name, __u32 start, __u32 end); int print_color_bool_opt(enum output_type type, enum color_attr color, const char *key, bool value, bool show); diff --git a/lib/json_print.c b/lib/json_print.c index f38171ff..7b3b6c3f 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -375,16 +375,16 @@ int print_color_rate(bool use_iec, enum output_type type, enum color_attr color, return rc; } -unsigned int print_range(const char *name, __u32 start, __u32 id) +unsigned int print_range(const char *name, __u32 start, __u32 end) { int width; width = print_uint(PRINT_ANY, name, "%u", start); - if (start != id) { - char end[64]; + if (start != end) { + char buf[64]; - snprintf(end, sizeof(end), "%sEnd", name); - width += print_uint(PRINT_ANY, end, "-%u", id); + snprintf(buf, sizeof(buf), "%sEnd", name); + width += print_uint(PRINT_ANY, buf, "-%u", end); } return width; From patchwork Mon Dec 11 14:07:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13487296 X-Patchwork-Delegate: stephen@networkplumber.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Hq9bf+6Z" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2056.outbound.protection.outlook.com [40.107.244.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8EDD2101 for ; Mon, 11 Dec 2023 06:08:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l6fEfByv4iReYW2wSWHS3APawln9PqgToQNvNQbOwWx5LA7lwzwnKAmLW2HREunaqM3EbzLFH/F1v+FqtN2WPRJw24/ggLfeSF6shjXUn/Ta10WbJYzBwhrW6o59d8eXd/ToYUYFcV8dpjzGGoxG87IVH5Mr3Xc8R+he9REa0LhG7yfd6Jaab5v1ZMcUwUsmfZgzsKoqIGOYqIQT2/LyDEVlqjs8Oc5Zs3mUqVye+Vv8QpQSDTVakbkgSxAxI1IQCjPu+0mWycLor6QfqLEIG+sXYmtfKIw9oOrmg4FhxZj1OLF0n0WAnz4rQ0ZfU0KNREe4/bBvWooYvokpkYRovA== 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=LegqRqy5JA70RZJpAVqfQng4bUN2757Tp344e+7ljUg=; b=DO8/ZXGMddv/qukJWsbbNiUVoWvKdXRC6gSmJADTEuE4wFM7YBcoL/fQ6mcNkK+fowPlVfBGf3hRDPDjwV4fa75pY2eJy3uiQ9L8T72RNFmOzPVA5O0jIICJZhgLB+ASpJsvV3OKHsYQhbVid3WnAK2qOIetfS3zRZ8K3Y1/Y6MSBtETrwt0BsPMmQtcbEAASSftchTLejSzj0mwDlI4+SOa0iWu6fxG7QzGn/AX67gWndrK7m8Vqhv+31rCni+HdZzlvJPpLtIfy6OXsMcUwCNMrv5z0T6ondULsNpON1eCnpvfs5N8PsZVhxBaioiFiDWE57ARecGldiEu9hpNPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LegqRqy5JA70RZJpAVqfQng4bUN2757Tp344e+7ljUg=; b=Hq9bf+6Z0FF/3VCtmjZeRE9Dnn/NTAxyxf2qEgvQlhDuEhgm2kUX3EFyXBv4RLHplKiVBzDcbZo2/GSwoBpKU6SqqY0qVHxEKgIB9sb6liealUlTpVj7Rp+UCev6mSKiv23GOG1ZuR/k7PrOApri7OgGsbQ6MlHxolutBijkRFTgoKzeExEov7QUX6+YBzAw8N5aHU2ZWWvLcsLR9E0T5FjBG4ByVnp+t0eA3z6GTtyATdQ2/FEl8SooHi9g/VCeBc/lhPW8Bg5HDJdDgg6gYNU4+6npJX7uacDjLe2O8p82uL/L0DPw263CeCh5XVbTZ81aFWL+MocSDBK8YCa6Hw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by DS0PR12MB9398.namprd12.prod.outlook.com (2603:10b6:8:1b3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 14:08:32 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::ff68:f81b:d451:9765%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 14:08:32 +0000 From: Benjamin Poirier To: netdev@vger.kernel.org Cc: Petr Machata , Roopa Prabhu Subject: [PATCH iproute2-next 20/20] bridge: Provide rta_type() Date: Mon, 11 Dec 2023 09:07:32 -0500 Message-ID: <20231211140732.11475-21-bpoirier@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211140732.11475-1-bpoirier@nvidia.com> References: <20231211140732.11475-1-bpoirier@nvidia.com> X-ClientProxiedBy: YQBPR0101CA0105.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:5::8) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4373:EE_|DS0PR12MB9398:EE_ X-MS-Office365-Filtering-Correlation-Id: 58baf668-9076-4893-69ed-08dbfa52a85a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Wd8Kuh8mtC/GL1NYrgo2hQvDi4D4pt8NjRfcwwRFq7co0H14dqjZBfNYDvbLXQONTI5Q59K+kJcDp+VNF7BIh04F460TFNDz4mAInjD0jsGMCmE5a0W8AjKXMJB1Se9QN4HAeg/HMyLTqIObuL934s7ByRycvYMnTepdIkeaXO56v6NEKZ+fypecvK1aG62Jgth0m3j7OTdao2gwj0Ihr4xzbvivhNwq24rygUmK2rrTGRS5059MuLbsEPT/y+x+tx6d+M7icbmldE8OKzBeH8jwKETa3IpFhQVnmcP5+/oWQHTTEXIfpZvpPc03Q0Gw8qvBCIvgruUA5MgVa1FXrG224YNrUWbwW7cvdpd9pRKIEEZCu5XCBkZ+o6XU1Tu6OFkxnlys/mcXnGDbftwwycEDj8c+s6ML6y5n0NInwfdc48lGLOU5oirHSwL0MQGhMkXrxhGcd07CklH2df59u9IR9C9PUX0s370ODTIWFs+UzNzi4vU/bm63vUnUxlhxVPnU6fgLeCnTZlgb7UvRGjK+VGk9nOXanS2ToPi505SltAsTi5bAAZboj61pLin X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(376002)(39860400002)(346002)(366004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(1076003)(26005)(107886003)(2616005)(6916009)(36756003)(38100700002)(86362001)(5660300002)(83380400001)(6506007)(6512007)(316002)(66556008)(66946007)(8936002)(8676002)(54906003)(66476007)(6486002)(4326008)(2906002)(41300700001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vx+RknpQ+eHyiLQxnUvXaSJeLaCxDlmOt8V7O6mwNd7yPuMtyqgKBdsYJSnF9INpK1a61HfnMBEMD50v2t9e5/Pb9jXDzmPB/FUB4qL9VWapoAZeIRcfHoGaGBCLXyIoiP5q0qq1RwjalDSAlRCFToDwg7kBi90Q42JPatX8sItfnOTOWZ5k8fpwe+DNGQSg+j+/grVKFyP76CsFICE8jUT9mCKuxerdoJFf9XXoOz+TYAEhvdP4f68Gto3njsLv/1HNW6hgLzkz/jqu0BLx/b5axbj11fTcz0/0/LYq/JJt694rxnN2e8e1JnVQq3/BTkey5LQIhlBgI3mJALc417tWEF7Iwhig6chnKOLf4+dCRbVEsxwvdhU2ezAI4PZ4ff58NujeuPTwp7g+NrLemPRxwwVTPEfES1hzQzNgmjpn3MJs50LsFcHNX/rbmdLAEE7YrYjmmeTCAnJyIpQmdmrzJsRbFKstnegDPL9rt6tVOI8NNK3oTWNtPLxm+vx935kjqo7VSBiXXf5TURpQJfX6/pAfg9iL/PUqkoVp2LPIVlpsEDeby1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-CrossTenant-Network-Message-Id: 58baf668-9076-4893-69ed-08dbfa52a85a X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 14:08:32.2846 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rN5zxE9F4YkGI8jx0Fnfsd2RrnMyFaUjkEQPXWBGl+r1sLsqoY9BGBd6d+WXKC4iuZJerVvexrublR3lIEH79A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9398 X-Patchwork-Delegate: dsahern@gmail.com Factor out the repeated code pattern rta_type = attr->rta_type & NLA_TYPE_MASK into a helper which is similar to the existing kernel function nla_type(). Reviewed-by: Petr Machata Tested-by: Petr Machata Signed-off-by: Benjamin Poirier --- bridge/vlan.c | 12 ++++++------ bridge/vni.c | 4 +--- include/libnetlink.h | 4 ++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 05e6a620..5352eb24 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -851,7 +851,7 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1], *vattr; __u16 vid, vrange = 0; - if ((a->rta_type & NLA_TYPE_MASK) != BRIDGE_VLANDB_GLOBAL_OPTIONS) + if (rta_type(a) != BRIDGE_VLANDB_GLOBAL_OPTIONS) return; parse_rtattr_flags(vtb, BRIDGE_VLANDB_GOPTS_MAX, RTA_DATA(a), @@ -960,7 +960,7 @@ static void print_vlan_opts(struct rtattr *a, int ifindex) __u16 vrange = 0; __u8 state = 0; - if ((a->rta_type & NLA_TYPE_MASK) != BRIDGE_VLANDB_ENTRY) + if (rta_type(a) != BRIDGE_VLANDB_ENTRY) return; parse_rtattr_flags(vtb, BRIDGE_VLANDB_ENTRY_MAX, RTA_DATA(a), @@ -1086,14 +1086,14 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, bool global_only rem = len; for (a = BRVLAN_RTA(bvm); RTA_OK(a, rem); a = RTA_NEXT(a, rem)) { - unsigned short rta_type = a->rta_type & NLA_TYPE_MASK; + unsigned short attr_type = rta_type(a); /* skip unknown attributes */ - if (rta_type > BRIDGE_VLANDB_MAX || - (global_only && rta_type != BRIDGE_VLANDB_GLOBAL_OPTIONS)) + if (attr_type > BRIDGE_VLANDB_MAX || + (global_only && attr_type != BRIDGE_VLANDB_GLOBAL_OPTIONS)) continue; - switch (rta_type) { + switch (attr_type) { case BRIDGE_VLANDB_ENTRY: print_vlan_opts(a, bvm->ifindex); break; diff --git a/bridge/vni.c b/bridge/vni.c index ffc3e188..a7abe6de 100644 --- a/bridge/vni.c +++ b/bridge/vni.c @@ -319,9 +319,7 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg) rem = len; for (t = TUNNEL_RTA(tmsg); RTA_OK(t, rem); t = RTA_NEXT(t, rem)) { - unsigned short rta_type = t->rta_type & NLA_TYPE_MASK; - - if (rta_type != VXLAN_VNIFILTER_ENTRY) + if (rta_type(t) != VXLAN_VNIFILTER_ENTRY) continue; if (!opened) { diff --git a/include/libnetlink.h b/include/libnetlink.h index 39ed87a7..ad7e7127 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -275,6 +275,10 @@ static inline const char *rta_getattr_str(const struct rtattr *rta) { return (const char *)RTA_DATA(rta); } +static inline int rta_type(const struct rtattr *rta) +{ + return rta->rta_type & NLA_TYPE_MASK; +} int rtnl_listen_all_nsid(struct rtnl_handle *); int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler,