From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 68EAE1B3B2; Tue, 4 Dec 2018 08:46:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2018 23:46:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,313,1539673200"; d="scan'208";a="256620072" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by orsmga004.jf.intel.com with ESMTP; 03 Dec 2018 23:46:02 -0800 Received: from pgsmsx101.gar.corp.intel.com ([169.254.1.244]) by KMSMSX154.gar.corp.intel.com ([169.254.12.217]) with mapi id 14.03.0415.000; Tue, 4 Dec 2018 15:46:01 +0800 From: "Zhao1, Wei" To: "dev@dpdk.org" CC: "stable@dpdk.org" , "Peng, Yuan" Thread-Topic: [PATCH] app/testpmd: add boundary check in flow commandline Thread-Index: AQHUi5j4bmEnINAgf06DR+KBhXmgbKVuM2DA Date: Tue, 4 Dec 2018 07:46:00 +0000 Message-ID: References: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> In-Reply-To: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: add boundary check in flow commandline X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 07:46:14 -0000 Send on behalf of Peng, Yuan Tested-by: Peng, Yuan - Tested Branch: dpdk-master - Tested commit 0da7f445df445630c794897347ee360d6fe6348b - OS: 4.5.5-300.fc24.x86_64 - GCC: gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2) - CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz - NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection [80= 86:10fb] (rev 01) - Default x86_64-native-linuxapp-gcc configuration - Prerequisites: - Total 1 cases, 1 passed, 0 failed - Prerequisites command / instruction: Bind DUT ports to dpdk driver - Case:=20 Steps: Start test application with normal eal parameter. ./$RTE_TARGET/app/testpmd -c f -n 4 -- -i testpmd> flow create 0 ingress pattern eth / ipv4 src is 192.168.0.3 ds= t is 192.168.0.4 / udp src is 22 dst is 65536 / end actions queue index 0 /= end Bad arguments testpmd> flow create 0 ingress pattern eth / ipv4 src is 192.168.0.3 dst is= 192.168.0.4 / udp src is 65536 dst is 33 / end actions queue index 0 / end Bad arguments the rule failed to be created. I tried TCP/SCTP rule, and got the same result. I tried validating the rule instead of creating the rules with wrong spor= t/dport, and got the same result. The bug is fixed. > -----Original Message----- > From: Zhao1, Wei > Sent: Tuesday, December 4, 2018 1:52 PM > To: dev@dpdk.org > Cc: stable@dpdk.org; Peng, Yuan ; Zhao1, Wei > > Subject: [PATCH] app/testpmd: add boundary check in flow commandline >=20 > There is need to add boundary for input number from commandline, If it > beyond the defination, code will return error. >=20 > Signed-off-by: Wei Zhao > --- > app/test-pmd/cmdline_flow.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 23ea7cc..515f95c 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -4325,6 +4325,25 @@ parse_int(struct context *ctx, const struct token > *token, > } > buf =3D (uint8_t *)ctx->object + arg->offset; > size =3D arg->size; > + switch (size) { > + case sizeof(uint8_t): > + if (u > 0xff) > + return -1; > + case sizeof(uint16_t): > + if (u > 0xffff) > + return -1; > + case sizeof(uint8_t [3]): > + if (u > 0xffffff) > + return -1; > + case sizeof(uint32_t): > + if (u > 0xffffffff) > + return -1; > + case sizeof(uint64_t): > + if (u > 0xffffffffffffffff) > + return -1; > + default: > + break; > + } > objmask: > switch (size) { > case sizeof(uint8_t): > -- > 2.7.5