From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 020DD4561A for ; Mon, 15 Jul 2024 12:15:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F148C4067A; Mon, 15 Jul 2024 12:15:42 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011013.outbound.protection.outlook.com [52.101.70.13]) by mails.dpdk.org (Postfix) with ESMTP id E0BDB40269; Mon, 15 Jul 2024 12:15:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vSU6JWKyBy7AkkR7eiqzEhYuGTZwOuE6aLOspplcD8IhX968xmsmO5bKybkatBJGJ0vwXy4Non4OcZdpJCxIr1j9+/xr+9KVi0Q5TAQDOYJlsPfaMaQu+vYsmtyFFCE6BkKp7K6qhXeFDEtiGU/CRdFMVGNYQF0kZ3kbxvfhogqzzpyzVfC06VtBg4hEH0v6uaUdipcQSp/gpdfATRtoxLg3RdP9MWDNQ5gkgI8dpTZoC6sSy+KQDJXd9+QqlHvyYZVR3BP2PnoogKOnX7OzN6BfV5kb+Yk3HYFVhNxs3ik2+JXumue0Rbsj5Upe4j1joYD62XOdcuTN2pPn0qEMTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=E4LzW1K6HDsTKSItyDO5Kz8mQu+weToVURmrKa0KuAE=; b=zMXrBD7Fu0I6Pmppv232NjLvNbSe0/m1cA9hGDYCJKgTfLey0o3UJIx7U22ojlb28WfjSQQtNkDeV7d48u+al/zj5K/EXxoKR2FXKbPG2Na7SBSYFQduNMyVFksnLyrEWAvdtfLYEZQtMFcAjDKP3mmLtZQ9Lh/QEazik1njZ/Gm+mEa3CjNUiEIhtFOXgSoY9o9O2JAbXLql2n7NdhvEsEpOb+6PjbPMj2pIXMKX3dmp+onXC4uPFuz1/phFm3aIhllAOF2cY4mCyyNVMcQiZKjDHjgLA9SNH8C9Lt+AuqQ/4y9gxxFxywlHlQM4cVn7hXqPAu56vJGHtIcVh8HXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E4LzW1K6HDsTKSItyDO5Kz8mQu+weToVURmrKa0KuAE=; b=R/FuyC7ieczShUUGrfXSk7h9NY503EsiRBwEDE8dOwlOLZf0xdTH/az8+oHrF8pgHb6jbUL9L7iOqM0ocRH4Xe4W7NEkcNTvwmzVtPw+hA+1I6UHC/F5nr2McPi9dMaYNDzUtCIYxHEJtID2cAeglIVQdc4RnHtMv0nhYlIen5w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by DB8PR04MB7131.eurprd04.prod.outlook.com (2603:10a6:10:fd::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Mon, 15 Jul 2024 10:15:38 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7762.027; Mon, 15 Jul 2024 10:15:38 +0000 From: Gagandeep Singh To: dev@dpdk.org, Konstantin Ananyev , Sean Morrissey Cc: stable@dpdk.org Subject: [PATCH 3/3] examples/l3fwd: fix maximum acceptable port ID in routes Date: Mon, 15 Jul 2024 15:44:58 +0530 Message-Id: <20240715101458.645014-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240715101458.645014-1-g.singh@nxp.com> References: <20240715101458.645014-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0125.apcprd03.prod.outlook.com (2603:1096:4:91::29) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|DB8PR04MB7131:EE_ X-MS-Office365-Filtering-Correlation-Id: 498b30ea-e59f-4056-6635-08dca4b71324 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rZz56edGiWd2XQCbMv8rNPQ8W5wuZXx6AcrjcsJBaxJ7jdtMqnPNLcDUkY1G?= =?us-ascii?Q?ACCiDlnImNSQMfQlfpdZ4fN1lp7rKKLKzH4d0dW8BvkJbX+0tSHwBbq1bNYp?= =?us-ascii?Q?l9Y8E7vxp3VlcQAMG64imlxdQyifI/5OYaihpi7xRk4QsuaUfVKHCRH5ZuiA?= =?us-ascii?Q?NgNegAGpnDjGWNNHB6SYi6FFG0H2mZ86DvV64ZVIcPQEqSRic9XpnkGVfa/7?= =?us-ascii?Q?51WKomSemVTezpJUgdEGiMgcmGDYq/L6Cn6wRtOXXFlf8k+kTN4YHSkEPHGo?= =?us-ascii?Q?uDe6g27QVwaMncmgKHwdmtgZFPKGNF5AmBf0I4/5/iadcMIbQPWvTvv6sf2K?= =?us-ascii?Q?DnHvxAa7RkHfx83XRBvau+JZpyuIXWMb2sMU5nroPRdU/6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ZpTLqWVHPgarJgygYUmaBEIRMI9j5F9+JhmNyhGkg?= =?us-ascii?Q?tJ9UUKGkmv5XwzGjUVLGW+6IT90vODpRnxCWQHR+9QvEbnBbttsYoHzVVWdX?= =?us-ascii?Q?ISIZ0rPqXeXZ2SHMCum+18jgANnWz51PLV1mXFf82LkMvtdMQQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YgZQQDehn8CxMVUAOmOhZm1EXicF/bbJvYxI2RO14G3lLuVJI6UGjEQInZeO?= =?us-ascii?Q?YUqZHfL3KQ3Lm9Cu4G3xtG3fi7k8e1YFj1AkAUA5k1+H+DoBDZUm/zQF0ECO?= =?us-ascii?Q?mS3+Ugi6zcwhTyol1NjDskpKgWBn8cnoo18LdqOBiIA1OP3Jf55w8KyehruT?= =?us-ascii?Q?sz+PX7O+egrge42P3RTnFv2vHDbKvQrqA9u1wU5uBdfelzMTz27t1Z2ctPTb?= =?us-ascii?Q?z58z0L/GvhCzIIY3fB0abRDGs1qTiVCjIKWTpab8yL8XwBeT2eLh/8DB9q72?= =?us-ascii?Q?wuGxtCks/68lKRaiBUJj7H1v6bLdH9phikJ+u9b2mCe1kCsDwr/9Fb4zA2A7?= =?us-ascii?Q?51bD1UWreND40V/3DRDB5AMMjx1PsDEqljXUe88claScHEmLzm6/dSbhOZJS?= =?us-ascii?Q?+O1Si2XDGssW+acZIUh9eDE3T84k5pKrp/rPXjpJ4WSS2FWh1sdffhZkV3Fd?= =?us-ascii?Q?83/rIQDok3aTHIpujTFNNQamXVnDJY7WOURTpRr+o4MQLMcTFRsGwSpwi0HP?= =?us-asc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T2qoZhP9fAXC?= =?us-ascii?Q?UDPaO8GupfOGr+9L379c11IcSxmZP9SB6aR/W7iu3LqhKxN6sYk/vThnDQbi?= =?us-ascii?Q?Tgb81jMTSVuUVJkL9gb5yahKDMpef1xyr6rjRHh/6gUaWTexKIs8bTUKQ18A?= =?us-ascii?Q?R5D1cuLAN5sjHQvLf/g=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 498b30ea-e59f-4056-6635-08dca4b71324 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2024 10:15:38.8392 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: syqJ2VPKsc3rZBmNcDfJLf9aEX5SANCRMEQP4mOrYwx4tH+tD3taANDxf3I2yr3T X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7131 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Application is accepting routes for port ID up to UINT8_MAX for LPM amd EM routes on parsing the given rule file, but only up to 32 ports can be enabled as per the variable enabled_port_mask which is defined as uint32_t. This patch restricts the rules parsing code to accept routes for port ID up to 31 only to avoid any unnecessary maintenance of rules which will never be used. Fixes: e7e6dd643092 ("examples/l3fwd: support config file for EM") Fixes: 52def963fc1c ("examples/l3fwd: support config file for LPM/FIB") Cc: sean.morrissey@intel.com Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- examples/l3fwd/em_route_parse.c | 6 ++++-- examples/l3fwd/lpm_route_parse.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/l3fwd/em_route_parse.c b/examples/l3fwd/em_route_parse.c index 8b534de5f1..65c71cd1ba 100644 --- a/examples/l3fwd/em_route_parse.c +++ b/examples/l3fwd/em_route_parse.c @@ -65,7 +65,8 @@ em_parse_v6_rule(char *str, struct em_rule *v) /* protocol. */ GET_CB_FIELD(in[CB_FLD_PROTO], v->v6_key.proto, 0, UINT8_MAX, 0); /* out interface. */ - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); return 0; } @@ -102,7 +103,8 @@ em_parse_v4_rule(char *str, struct em_rule *v) /* protocol. */ GET_CB_FIELD(in[CB_FLD_PROTO], v->v4_key.proto, 0, UINT8_MAX, 0); /* out interface. */ - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); return 0; } diff --git a/examples/l3fwd/lpm_route_parse.c b/examples/l3fwd/lpm_route_parse.c index f27b66e838..357c12d9fe 100644 --- a/examples/l3fwd/lpm_route_parse.c +++ b/examples/l3fwd/lpm_route_parse.c @@ -110,7 +110,8 @@ lpm_parse_v6_rule(char *str, struct lpm_route_rule *v) rc = lpm_parse_v6_net(in[CB_FLD_DST_ADDR], v->ip_32, &v->depth); - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); return rc; } @@ -132,7 +133,8 @@ lpm_parse_v4_rule(char *str, struct lpm_route_rule *v) rc = parse_ipv4_addr_mask(in[CB_FLD_DST_ADDR], &v->ip, &v->depth); - GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0); + GET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, + (sizeof(enabled_port_mask) * CHAR_BIT) - 1, 0); return rc; } -- 2.25.1