Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: lib.sh: Add PING_COUNT to allow sending configurable amount of packets

Currently `ping_do()` and `ping6_do()` send 10 packets.

There are cases that it is not possible to catch only the interesting
packets using tc rule, so then, it is possible to send many packets and
verify that at least this amount of packets hit the rule.

Add `PING_COUNT` variable, which is set to 10 by default, to allow tests
sending more than 10 packets using the existing ping API.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Amit Cohen and committed by
Jakub Kicinski
0cd0b1f7 70ec72d5

+5 -2
+5 -2
tools/testing/selftests/net/forwarding/lib.sh
··· 20 20 NETIF_CREATE=${NETIF_CREATE:=yes} 21 21 MCD=${MCD:=smcrouted} 22 22 MC_CLI=${MC_CLI:=smcroutectl} 23 + PING_COUNT=${PING_COUNT:=10} 23 24 PING_TIMEOUT=${PING_TIMEOUT:=5} 24 25 WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} 25 26 INTERFACE_TIMEOUT=${INTERFACE_TIMEOUT:=600} ··· 1112 1111 1113 1112 vrf_name=$(master_name_get $if_name) 1114 1113 ip vrf exec $vrf_name \ 1115 - $PING $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null 1114 + $PING $args $dip -c $PING_COUNT -i 0.1 \ 1115 + -w $PING_TIMEOUT &> /dev/null 1116 1116 } 1117 1117 1118 1118 ping_test() ··· 1134 1132 1135 1133 vrf_name=$(master_name_get $if_name) 1136 1134 ip vrf exec $vrf_name \ 1137 - $PING6 $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null 1135 + $PING6 $args $dip -c $PING_COUNT -i 0.1 \ 1136 + -w $PING_TIMEOUT &> /dev/null 1138 1137 } 1139 1138 1140 1139 ping6_test()