summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/netfilter
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2020-09-09 21:25:36 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2020-09-22 02:55:11 +0300
commitf02ced62ec35e847ebadb1c6759320345c30fcb5 (patch)
treedeedc45e5faeb01aa6a192dcc6bb8a87ed7adf58 /tools/testing/selftests/netfilter
parent25b8ab916dd7a1f490b603d68c7765c06f9ed9e1 (diff)
downloadlinux-f02ced62ec35e847ebadb1c6759320345c30fcb5.tar.xz
selftests: netfilter: add cpu counter check
run task on first CPU with netfilter counters reset and check cpu meta after another ping Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tools/testing/selftests/netfilter')
-rwxr-xr-xtools/testing/selftests/netfilter/nft_meta.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/netfilter/nft_meta.sh b/tools/testing/selftests/netfilter/nft_meta.sh
index d250b84dd5bc..17b2d6eaa204 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