Commit f02ced62 authored by Fabian Frederick's avatar Fabian Frederick Committed by Pablo Neira Ayuso

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: default avatarFabian Frederick <fabf@skynet.be>
Acked-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 25b8ab91
...@@ -33,6 +33,7 @@ table inet filter { ...@@ -33,6 +33,7 @@ table inet filter {
counter infproto4count {} counter infproto4count {}
counter il4protocounter {} counter il4protocounter {}
counter imarkcounter {} counter imarkcounter {}
counter icpu0counter {}
counter oifcount {} counter oifcount {}
counter oifnamecount {} counter oifnamecount {}
...@@ -54,6 +55,7 @@ table inet filter { ...@@ -54,6 +55,7 @@ table inet filter {
meta nfproto ipv4 counter name "infproto4count" meta nfproto ipv4 counter name "infproto4count"
meta l4proto icmp counter name "il4protocounter" meta l4proto icmp counter name "il4protocounter"
meta mark 42 counter name "imarkcounter" meta mark 42 counter name "imarkcounter"
meta cpu 0 counter name "icpu0counter"
} }
chain output { chain output {
...@@ -119,6 +121,18 @@ check_one_counter omarkcounter "1" true ...@@ -119,6 +121,18 @@ check_one_counter omarkcounter "1" true
if [ $ret -eq 0 ];then if [ $ret -eq 0 ];then
echo "OK: nftables meta iif/oif counters at expected values" 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 fi
exit $ret exit $ret
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment