summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2023-05-09 06:11:59 +0300
committerDavid S. Miller <davem@davemloft.net>2023-05-10 11:27:20 +0300
commitb6d1599f8c282bfbc4d291af750436d93005b9ea (patch)
treedf65a8c1dca040c2a1d42645e0ce0532560803fa /tools/testing
parent84df83e0ecd3beba62c3d06b43ab51cc47efaca0 (diff)
downloadlinux-b6d1599f8c282bfbc4d291af750436d93005b9ea.tar.xz
selftests: forwarding: lib: add netns support for tc rule handle stats get
When run the test in netns, it's not easy to get the tc stats via tc_rule_handle_stats_get(). With the new netns parameter, we can get stats from specific netns like num=$(tc_rule_handle_stats_get "dev eth0 ingress" 101 ".packets" "-n ns") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/net/forwarding/lib.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 057c3d0ad620..9ddb68dd6a08 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -791,8 +791,9 @@ tc_rule_handle_stats_get()
local id=$1; shift
local handle=$1; shift
local selector=${1:-.packets}; shift
+ local netns=${1:-""}; shift
- tc -j -s filter show $id \
+ tc $netns -j -s filter show $id \
| jq ".[] | select(.options.handle == $handle) | \
.options.actions[0].stats$selector"
}