Re: [PATCH net-next v5 3/3] selftests: net: veth: propagate bad-settings check failures to exit status

From: Hangbin Liu

Date: Mon Nov 23 2026 - 00:22:29 EST


Hi Omokefe,
On Sat, Nov 21, 2026 at 07:22:17PM +0100, Omokefe Emmanuel Onanaroghene wrote:
> Three more checks in veth.sh print "fail - set operation successful
> ?!?" without setting ret: "bad setting: XDP with RX nr less than TX",
> "bad setting: reducing RX nr below peer TX with XDP set", and "bad
> setting: increasing peer TX nr above RX with XDP set". A kernel that
> wrongly accepts any of these invalid operations would be reported yet
> the script would still exit 0. Wrap each fail branch so it sets ret=1.
>
> Reported-by: Tianyi Gao <tianyi@xxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/all/CAG4wq-cd01i7YrcFPmma=BXUcwn_PK=wneKW=vyEBYzQ3Bn7QA@xxxxxxxxxxxxxx/
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@xxxxxxxxx>
> ---
> tools/testing/selftests/net/veth.sh | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
> index 7a2bbed0263e7..6eeb123aaf885 100755
> --- a/tools/testing/selftests/net/veth.sh
> +++ b/tools/testing/selftests/net/veth.sh
> @@ -474,9 +474,13 @@ if [ $CPUS -gt 1 ]; then
> ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
> ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
> printf "%-60s" "bad setting: XDP with RX nr less than TX"
> - ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
> - section xdp 2>/dev/null &&\
> - echo "fail - set operation successful ?!?" || echo " ok "
> + if ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
> + section xdp 2>/dev/null; then
> + echo "fail - set operation successful ?!?"
> + ret=1
> + else
> + echo " ok "
> + fi
>
> # the following tests will run with multiple channels active
> ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
> @@ -484,16 +488,24 @@ if [ $CPUS -gt 1 ]; then
> ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
> section xdp 2>/dev/null
> printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
> - ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
> - echo "fail - set operation successful ?!?" || echo " ok "
> + if ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null; then
> + echo "fail - set operation successful ?!?"
> + ret=1
> + else
> + echo " ok "
> + fi
> CUR_RX=2
> CUR_TX=2
> fi
>
> if [ $CPUS -gt 2 ]; then
> printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set"
> - ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\
> - echo "fail - set operation successful ?!?" || echo " ok "
> + if ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null; then
> + echo "fail - set operation successful ?!?"
> + ret=1
> + else
> + echo " ok "
> + fi
> chk_channels "setting invalid channels nr" $DST 2 2
> fi
>
> --
> 2.43.0
>

This one and patch 2 are fixing the same issue in the same test. Why bother
with two patches?

Thanks
Hangbin