Skip to content

Commit b6d1599

Browse files
liuhangbindavem330
authored andcommitted
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>
1 parent 84df83e commit b6d1599

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • tools/testing/selftests/net/forwarding

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,9 @@ tc_rule_handle_stats_get()
791791
local id=$1; shift
792792
local handle=$1; shift
793793
local selector=${1:-.packets}; shift
794+
local netns=${1:-""}; shift
794795

795-
tc -j -s filter show $id \
796+
tc $netns -j -s filter show $id \
796797
| jq ".[] | select(.options.handle == $handle) | \
797798
.options.actions[0].stats$selector"
798799
}

0 commit comments

Comments
 (0)