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

Configure Feed

Select the types of activity you want to include in your feed.

selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt

Quoted from musl wiki:

GNU getopt permutes argv to pull options to the front, ahead of
non-option arguments. musl and the POSIX standard getopt stop
processing options at the first non-option argument with no
permutation.

Thus these scripts stop working on musl since non-option arguments for
tools using getopt() (in this case, (ar)ping) do not always come last.
Fix it by reordering arguments.

Signed-off-by: David Yang <mmyangfl@gmail.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20250919053538.1106753-1-mmyangfl@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Yang and committed by
Jakub Kicinski
50d51cef 312e6f76

+13 -13
+1 -1
tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
··· 226 226 # Generate 16384 echo requests, each with a random flow label. 227 227 ip vrf exec v$h1 sh -c \ 228 228 "for _ in {1..16384}; do \ 229 - $PING6 2001:db8:4::2 -F 0 -c 1 -q >/dev/null 2>&1; \ 229 + $PING6 -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1; \ 230 230 done" 231 231 } 232 232
+1 -1
tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
··· 321 321 # Generate 16384 echo requests, each with a random flow label. 322 322 ip vrf exec v$h1 sh -c \ 323 323 "for _ in {1..16384}; do \ 324 - $PING6 2001:db8:2::2 -F 0 -c 1 -q >/dev/null 2>&1; \ 324 + $PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \ 325 325 done" 326 326 } 327 327
+3 -3
tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh
··· 95 95 96 96 # Send too big packets 97 97 ip vrf exec $vrf_name \ 98 - $PING6 -s 1300 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null 98 + $PING6 -s 1300 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null 99 99 100 100 local t1=$(ipv6_stats_get $rtr1 Ip6InTooBigErrors) 101 101 test "$((t1 - t0))" -ne 0 ··· 131 131 # Disable forwarding temporary while sending the packet 132 132 sysctl -qw net.ipv6.conf.all.forwarding=0 133 133 ip vrf exec $vrf_name \ 134 - $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null 134 + $PING6 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null 135 135 sysctl -qw net.ipv6.conf.all.forwarding=1 136 136 137 137 local t1=$(ipv6_stats_get $rtr1 Ip6InAddrErrors) ··· 150 150 # Add a policy to discard 151 151 ip xfrm policy add dst 2001:1:2::2/128 dir fwd action block 152 152 ip vrf exec $vrf_name \ 153 - $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null 153 + $PING6 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null 154 154 ip xfrm policy del dst 2001:1:2::2/128 dir fwd 155 155 156 156 local t1=$(ipv6_stats_get $rtr1 Ip6InDiscards)
+1 -1
tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
··· 323 323 # Generate 16384 echo requests, each with a random flow label. 324 324 ip vrf exec v$h1 sh -c \ 325 325 "for _ in {1..16384}; do \ 326 - $PING6 2001:db8:2::2 -F 0 -c 1 -q >/dev/null 2>&1; \ 326 + $PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \ 327 327 done" 328 328 } 329 329
+4 -4
tools/testing/selftests/net/forwarding/lib.sh
··· 1267 1267 1268 1268 vrf_name=$(master_name_get $if_name) 1269 1269 ip vrf exec $vrf_name \ 1270 - $PING $args $dip -c $PING_COUNT -i 0.1 \ 1271 - -w $PING_TIMEOUT &> /dev/null 1270 + $PING $args -c $PING_COUNT -i 0.1 \ 1271 + -w $PING_TIMEOUT $dip &> /dev/null 1272 1272 } 1273 1273 1274 1274 ping_test() ··· 1298 1298 1299 1299 vrf_name=$(master_name_get $if_name) 1300 1300 ip vrf exec $vrf_name \ 1301 - $PING6 $args $dip -c $PING_COUNT -i 0.1 \ 1302 - -w $PING_TIMEOUT &> /dev/null 1301 + $PING6 $args -c $PING_COUNT -i 0.1 \ 1302 + -w $PING_TIMEOUT $dip &> /dev/null 1303 1303 } 1304 1304 1305 1305 ping6_test()
+1 -1
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh
··· 238 238 ip neigh flush dev br1 239 239 setup_wait_dev $up_dev 240 240 setup_wait_dev $host_dev 241 - $ARPING -I br1 192.0.2.130 -qfc 1 241 + $ARPING -I br1 -qfc 1 192.0.2.130 242 242 sleep 2 243 243 mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 ">= 10" 244 244
+2 -2
tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
··· 196 196 197 197 bridge vlan add dev $swp3 vid 555 198 198 # Re-prime FDB 199 - $ARPING -I br1.555 192.0.2.130 -fqc 1 199 + $ARPING -I br1.555 -fqc 1 192.0.2.130 200 200 sleep 1 201 201 quick_test_span_gre_dir $tundev 202 202 ··· 290 290 291 291 bridge fdb del dev $swp2 $h3mac vlan 555 master 2>/dev/null 292 292 # Re-prime FDB 293 - $ARPING -I br1.555 192.0.2.130 -fqc 1 293 + $ARPING -I br1.555 -fqc 1 192.0.2.130 294 294 sleep 1 295 295 quick_test_span_gre_dir $tundev 296 296