From patchwork Wed Sep 9 18:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC6C3C433E2 for ; Wed, 9 Sep 2020 18:26:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70EB821D7F for ; Wed, 9 Sep 2020 18:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726976AbgIIS0K (ORCPT ); Wed, 9 Sep 2020 14:26:10 -0400 Received: from mailrelay105.isp.belgacom.be ([195.238.20.132]:5249 "EHLO mailrelay105.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbgIIS0G (ORCPT ); Wed, 9 Sep 2020 14:26:06 -0400 IronPort-SDR: zA9XNXEXspEXpvQAk0e0EupO3hw14WwrAkNg2p18c00um0kWtImOjXUXDKjIKJ6dn+mKrW/8ik f3jPcfGEfL8I/U+QWJSotKeaqR/5cjXRhHyBqr1Whyek7Pdk8Ppbw7/VAiGlQTB5TypClQZvpL sZrb7XFOu1kQeXlm+Qj5eLnJxAcAOtxzli+ga8bvvwyBgDSC2mZZj4vec7h1xvtgMwgTImibVl QF6Nma1Gnsf8D2Ssnh/+7o8B9licIZ535M83fniN+HXuoGLLQfn2h1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E/hF+EJIYQBJonnEOCb4MNhF1+kTsPIaBWklGhaoF6TSAYgyQJRxkNnGhCMDcCBgoBAQMJVwE9AY0yAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 09 Sep 2020 20:26:01 +0200 From: Fabian Frederick To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Fabian Frederick Subject: [PATCH 1/3 nf] selftests: netfilter: add cpu counter check Date: Wed, 9 Sep 2020 20:25:36 +0200 Message-Id: <20200909182536.23730-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org run task on first CPU with netfilter counters reset and check cpu meta after another ping Signed-off-by: Fabian Frederick --- tools/testing/selftests/netfilter/nft_meta.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/netfilter/nft_meta.sh b/tools/testing/selftests/netfilter/nft_meta.sh index d250b84dd5bc3..17b2d6eaa2044 100755 --- a/tools/testing/selftests/netfilter/nft_meta.sh +++ b/tools/testing/selftests/netfilter/nft_meta.sh @@ -33,6 +33,7 @@ table inet filter { counter infproto4count {} counter il4protocounter {} counter imarkcounter {} + counter icpu0counter {} counter oifcount {} counter oifnamecount {} @@ -54,6 +55,7 @@ table inet filter { meta nfproto ipv4 counter name "infproto4count" meta l4proto icmp counter name "il4protocounter" meta mark 42 counter name "imarkcounter" + meta cpu 0 counter name "icpu0counter" } chain output { @@ -119,6 +121,18 @@ check_one_counter omarkcounter "1" true if [ $ret -eq 0 ];then echo "OK: nftables meta iif/oif counters at expected values" +else + exit $ret +fi + +#First CPU execution and counter +taskset -p 01 $$ > /dev/null +ip netns exec "$ns0" nft reset counters > /dev/null +ip netns exec "$ns0" ping -q -c 1 127.0.0.1 > /dev/null +check_one_counter icpu0counter "2" true + +if [ $ret -eq 0 ];then + echo "OK: nftables meta cpu counter at expected values" fi exit $ret From patchwork Wed Sep 9 18:26:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 261225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 957BFC2D0E0 for ; Wed, 9 Sep 2020 18:26:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5459621D81 for ; Wed, 9 Sep 2020 18:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbgIIS0m (ORCPT ); Wed, 9 Sep 2020 14:26:42 -0400 Received: from mailrelay105.isp.belgacom.be ([195.238.20.132]:5273 "EHLO mailrelay105.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbgIIS0c (ORCPT ); Wed, 9 Sep 2020 14:26:32 -0400 IronPort-SDR: bD8uNhFGVHwEVPYlwW5V5w67iMWVYwJpup2/wKODiZDjkJl4W0UA0clZ2xOG5QUebakvN+0kVg pAHcfR1bvr4gvRFOh+S5nE50W5IKd1PSD6xCcwORVr0mPm0c7dRc/TW4+8CAj9CvJ5gSGXlV5k 4FaEoD94Kb38IuHnrxv7DrhLcYw8A7G2P9zLhIgqSoYxDdSXUZfn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jTqSUZICCwEBAQEBAQEBASMRAQIEAQGES4IUJTgTAgMBAQEDAgUBAQYBAQEBAQEFBAGGD0WCNyKDUgEjI4E/EoMmAYJXKbUihBCEdYFCgTgBiCuFGYFBP4RfhASGMAS2aoJvgw2EXX6ROw8hoFYtkiShaoF6TSAYO4JpCUcZDY4oGo4mQjA3AgYKAQEDCVcBPQGKbIJGAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 09 Sep 2020 20:26:30 +0200 From: Fabian Frederick To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Fabian Frederick Subject: [PATCH 2/3 nf] selftests: netfilter: fix nft_meta.sh error reporting Date: Wed, 9 Sep 2020 20:26:13 +0200 Message-Id: <20200909182613.23784-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When some test directly done with check_one_counter() fails, counter variable is undefined. This patch calls ip with cname which avoids errors like: FAIL: oskuidcounter, want "packets 2", got Error: syntax error, unexpected newline, expecting string list counter inet filter ^ Error is now correctly rendered: FAIL: oskuidcounter, want "packets 2", got table inet filter { counter oskuidcounter { packets 1 bytes 84 } } Signed-off-by: Fabian Frederick --- tools/testing/selftests/netfilter/nft_meta.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/netfilter/nft_meta.sh b/tools/testing/selftests/netfilter/nft_meta.sh index 17b2d6eaa2044..1f5b46542c14c 100755 --- a/tools/testing/selftests/netfilter/nft_meta.sh +++ b/tools/testing/selftests/netfilter/nft_meta.sh @@ -90,7 +90,7 @@ check_one_counter() if [ $? -ne 0 ];then echo "FAIL: $cname, want \"$want\", got" ret=1 - ip netns exec "$ns0" nft list counter inet filter $counter + ip netns exec "$ns0" nft list counter inet filter $cname fi }