From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDF8CA04F5 for ; Wed, 11 Dec 2019 22:28:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B1AB71D9E; Wed, 11 Dec 2019 22:28:51 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id BC9511BEDE for ; Wed, 11 Dec 2019 22:28:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576099729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mrVDnUWyf1deHZsmqEVZi58LvTK1YUYTRLpbGm8tN4=; b=LRx9HOC0G0fag7lUO0sk794xWjB2yvDyo1vTTYKdEDS64A/5iXN7CLgUwt7J7luwC/GMFv DztjYuca75ebqiwJl7h2LeYvDsFdovMFAHS/9Qp0qpOr8H3Pn9daR1ho26Ts6h49Ps6I/c Oab2OWhD3Yzbz7LuAtF0wr9ZO4UWcDM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-1btRcO_WPECHRgMGd7Q8VA-1; Wed, 11 Dec 2019 16:28:48 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0830A107ACC5; Wed, 11 Dec 2019 21:28:47 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2594610013A1; Wed, 11 Dec 2019 21:28:43 +0000 (UTC) From: Kevin Traynor To: David Marchand Cc: Ferruh Yigit , dpdk stable Date: Wed, 11 Dec 2019 21:26:34 +0000 Message-Id: <20191211212702.27851-42-ktraynor@redhat.com> In-Reply-To: <20191211212702.27851-1-ktraynor@redhat.com> References: <20191211212702.27851-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 1btRcO_WPECHRgMGd7Q8VA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'app/testpmd: report invalid command line parameter' has been queued to LTS release 18.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/17/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/6abcaabc8dc56fe7c6= c0480a739f63672576e50d Thanks. Kevin. --- >From 6abcaabc8dc56fe7c6c0480a739f63672576e50d Mon Sep 17 00:00:00 2001 From: David Marchand Date: Mon, 18 Nov 2019 16:37:14 +0100 Subject: [PATCH] app/testpmd: report invalid command line parameter [ upstream commit 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 ] We currently do not check that a non option string has been passed to testpmd. Example: $ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \ =09--vdev net_null1 -- -i nb-cores=3D2 --total-num-mbuf 2048 [...] testpmd> show config fwd io packet forwarding - ports=3D2 - cores=3D1 - streams=3D2 - NUMA support enabled, MP allocation mode: native Logical Core 1 (socket 0) forwards packets on 2 streams: RX P=3D0/Q=3D0 (socket 0) -> TX P=3D1/Q=3D0 (socket 0) peer=3D02:00:00:00= :00:01 RX P=3D1/Q=3D0 (socket 0) -> TX P=3D0/Q=3D0 (socket 0) peer=3D02:00:00:00= :00:00 Here nb-cores=3D2 is just ignored, while the (probably sleepy) user did not notice this. Validate that all strings passed to testpmd are part of a known option. After this patch: $ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \ =09--vdev net_null1 -- -i nb-cores=3D2 --total-num-mbuf 2048 [...] Invalid parameter: nb-cores=3D2 EAL: Error - exiting with code: 1 Cause: Command line incorrect While at it, when passing an unknown option, print the string that gets refused by getopt_long to help the user. Fixes: af75078fece3 ("first public release") Signed-off-by: David Marchand Reviewed-by: Ferruh Yigit --- app/test-pmd/parameters.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index bfb5834f4..4d5e28970 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -1246,4 +1246,5 @@ launch_args_parse(int argc, char** argv) =09=09default: =09=09=09usage(argv[0]); +=09=09=09printf("Invalid option: %s\n", argv[optind]); =09=09=09rte_exit(EXIT_FAILURE, =09=09=09=09 "Command line is incomplete or incorrect\n"); @@ -1252,4 +1253,10 @@ launch_args_parse(int argc, char** argv) =09} =20 +=09if (optind !=3D argc) { +=09=09usage(argv[0]); +=09=09printf("Invalid parameter: %s\n", argv[optind]); +=09=09rte_exit(EXIT_FAILURE, "Command line is incorrect\n"); +=09} + =09/* Set offload configuration from command line parameters. */ =09rx_mode.offloads =3D rx_offloads; --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-11 21:24:16.041470581 +0000 +++ 0042-app-testpmd-report-invalid-command-line-parameter.patch=092019-12-= 11 21:24:12.691650722 +0000 @@ -1 +1 @@ -From 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 Mon Sep 17 00:00:00 2001 +From 6abcaabc8dc56fe7c6c0480a739f63672576e50d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 ] + @@ -37 +38,0 @@ -Cc: stable@dpdk.org @@ -46 +47 @@ -index deca7a682..2e7a50441 100644 +index bfb5834f4..4d5e28970 100644 @@ -49 +50 @@ -@@ -1364,4 +1364,5 @@ launch_args_parse(int argc, char** argv) +@@ -1246,4 +1246,5 @@ launch_args_parse(int argc, char** argv) @@ -55 +56 @@ -@@ -1370,4 +1371,10 @@ launch_args_parse(int argc, char** argv) +@@ -1252,4 +1253,10 @@ launch_args_parse(int argc, char** argv)