* [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt
@ 2025-09-19 5:35 David Yang
2025-09-19 13:12 ` Petr Machata
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Yang @ 2025-09-19 5:35 UTC (permalink / raw)
To: netdev
Cc: David Yang, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan, Petr Machata, Amit Cohen,
Li Shuang, Alessandro Zanni, Hangbin Liu, linux-kselftest,
linux-kernel
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>
---
v2: https://lore.kernel.org/r/20250906170440.3513399-1-mmyangfl@gmail.com
- fix (ar)ping only
v1: https://lore.kernel.org/r/20250905173947.3164807-1-mmyangfl@gmail.com
- fix CI errors
.../selftests/net/forwarding/custom_multipath_hash.sh | 2 +-
.../selftests/net/forwarding/gre_custom_multipath_hash.sh | 2 +-
.../selftests/net/forwarding/ip6_forward_instats_vrf.sh | 6 +++---
.../net/forwarding/ip6gre_custom_multipath_hash.sh | 2 +-
tools/testing/selftests/net/forwarding/lib.sh | 8 ++++----
.../selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh | 2 +-
.../selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh | 4 ++--
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
index 7d531f7091e6..5dbfab0e23e3 100755
--- a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
@@ -226,7 +226,7 @@ send_flowlabel()
# Generate 16384 echo requests, each with a random flow label.
ip vrf exec v$h1 sh -c \
"for _ in {1..16384}; do \
- $PING6 2001:db8:4::2 -F 0 -c 1 -q >/dev/null 2>&1; \
+ $PING6 -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1; \
done"
}
diff --git a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
index dda11a4a9450..b4f17a5bbc61 100755
--- a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
@@ -321,7 +321,7 @@ send_flowlabel()
# Generate 16384 echo requests, each with a random flow label.
ip vrf exec v$h1 sh -c \
"for _ in {1..16384}; do \
- $PING6 2001:db8:2::2 -F 0 -c 1 -q >/dev/null 2>&1; \
+ $PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
done"
}
diff --git a/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh b/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh
index 49fa94b53a1c..25036e38043c 100755
--- a/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh
+++ b/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh
@@ -95,7 +95,7 @@ ipv6_in_too_big_err()
# Send too big packets
ip vrf exec $vrf_name \
- $PING6 -s 1300 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null
+ $PING6 -s 1300 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null
local t1=$(ipv6_stats_get $rtr1 Ip6InTooBigErrors)
test "$((t1 - t0))" -ne 0
@@ -131,7 +131,7 @@ ipv6_in_addr_err()
# Disable forwarding temporary while sending the packet
sysctl -qw net.ipv6.conf.all.forwarding=0
ip vrf exec $vrf_name \
- $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null
+ $PING6 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null
sysctl -qw net.ipv6.conf.all.forwarding=1
local t1=$(ipv6_stats_get $rtr1 Ip6InAddrErrors)
@@ -150,7 +150,7 @@ ipv6_in_discard()
# Add a policy to discard
ip xfrm policy add dst 2001:1:2::2/128 dir fwd action block
ip vrf exec $vrf_name \
- $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null
+ $PING6 -c 1 -w $PING_TIMEOUT 2001:1:2::2 &> /dev/null
ip xfrm policy del dst 2001:1:2::2/128 dir fwd
local t1=$(ipv6_stats_get $rtr1 Ip6InDiscards)
diff --git a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
index e28b4a079e52..b24acfa52a3a 100755
--- a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
@@ -323,7 +323,7 @@ send_flowlabel()
# Generate 16384 echo requests, each with a random flow label.
ip vrf exec v$h1 sh -c \
"for _ in {1..16384}; do \
- $PING6 2001:db8:2::2 -F 0 -c 1 -q >/dev/null 2>&1; \
+ $PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
done"
}
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 08121cb9dc26..2c252423b326 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1267,8 +1267,8 @@ ping_do()
vrf_name=$(master_name_get $if_name)
ip vrf exec $vrf_name \
- $PING $args $dip -c $PING_COUNT -i 0.1 \
- -w $PING_TIMEOUT &> /dev/null
+ $PING $args -c $PING_COUNT -i 0.1 \
+ -w $PING_TIMEOUT $dip &> /dev/null
}
ping_test()
@@ -1298,8 +1298,8 @@ ping6_do()
vrf_name=$(master_name_get $if_name)
ip vrf exec $vrf_name \
- $PING6 $args $dip -c $PING_COUNT -i 0.1 \
- -w $PING_TIMEOUT &> /dev/null
+ $PING6 $args -c $PING_COUNT -i 0.1 \
+ -w $PING_TIMEOUT $dip &> /dev/null
}
ping6_test()
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh
index a20d22d1df36..8d4ae6c952a1 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh
@@ -238,7 +238,7 @@ test_lag_slave()
ip neigh flush dev br1
setup_wait_dev $up_dev
setup_wait_dev $host_dev
- $ARPING -I br1 192.0.2.130 -qfc 1
+ $ARPING -I br1 -qfc 1 192.0.2.130
sleep 2
mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 ">= 10"
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
index 1b902cc579f6..a21c771908b3 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
@@ -196,7 +196,7 @@ test_span_gre_forbidden_egress()
bridge vlan add dev $swp3 vid 555
# Re-prime FDB
- $ARPING -I br1.555 192.0.2.130 -fqc 1
+ $ARPING -I br1.555 -fqc 1 192.0.2.130
sleep 1
quick_test_span_gre_dir $tundev
@@ -290,7 +290,7 @@ test_span_gre_fdb_roaming()
bridge fdb del dev $swp2 $h3mac vlan 555 master 2>/dev/null
# Re-prime FDB
- $ARPING -I br1.555 192.0.2.130 -fqc 1
+ $ARPING -I br1.555 -fqc 1 192.0.2.130
sleep 1
quick_test_span_gre_dir $tundev
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt
2025-09-19 5:35 [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt David Yang
@ 2025-09-19 13:12 ` Petr Machata
2025-09-21 6:41 ` Ido Schimmel
2025-09-22 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2025-09-19 13:12 UTC (permalink / raw)
To: David Yang
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan, Petr Machata, Amit Cohen,
Li Shuang, Alessandro Zanni, Hangbin Liu, linux-kselftest,
linux-kernel
David Yang <mmyangfl@gmail.com> writes:
> 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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt
2025-09-19 5:35 [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt David Yang
2025-09-19 13:12 ` Petr Machata
@ 2025-09-21 6:41 ` Ido Schimmel
2025-09-22 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2025-09-21 6:41 UTC (permalink / raw)
To: David Yang
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Shuah Khan, Petr Machata, Amit Cohen,
Li Shuang, Alessandro Zanni, Hangbin Liu, linux-kselftest,
linux-kernel
On Fri, Sep 19, 2025 at 01:35:33PM +0800, David Yang wrote:
> 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: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt
2025-09-19 5:35 [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt David Yang
2025-09-19 13:12 ` Petr Machata
2025-09-21 6:41 ` Ido Schimmel
@ 2025-09-22 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-22 18:40 UTC (permalink / raw)
To: David Yang
Cc: netdev, davem, edumazet, kuba, pabeni, horms, shuah, petrm,
amcohen, shuali, alessandro.zanni87, liuhangbin, linux-kselftest,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 19 Sep 2025 13:35:33 +0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next,v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt
https://git.kernel.org/netdev/net-next/c/50d51cef555e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-22 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 5:35 [PATCH net-next v3] selftests: forwarding: Reorder (ar)ping arguments to obey POSIX getopt David Yang
2025-09-19 13:12 ` Petr Machata
2025-09-21 6:41 ` Ido Schimmel
2025-09-22 18:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).