From: no-reply@sashiko.virtuozzo.com
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>, khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v4 1/1] selftests: drv-net-hw: skip the tests that need a real interface
Date: Wed, 7 Oct 2026 14:55:27 +0000 [thread overview]
Message-ID: <010701a116dcbb5f-f0370f13-c6c7-45cc-8776-e6fc65a55026-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261007145044.2647274-2-eva.kurchatova@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] selftests: skip_on_veth() misses a forwarding.config veth override under NETIF_FIND_DRIVER
- [Low] selftests: skip_on_veth() duplicates lib.sh interface selection and skips explicit veths
--
commit cb2e8721faec852dd04b82eca1ff441b1fede385
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
selftests: drv-net-hw: skip the tests that need a real interface
This patch adds a skip_on_veth() helper. The helper is sourced by the
ethtool, ethtool_extended_state, ethtool_rmon, hw_stats_l3 and
hw_stats_l3_gre tests ahead of lib.sh. It exits with ksft_skip when the
first interface would be a veth, or when lib.sh would create one.
> diff --git a/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh b/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh
> new file mode 100644
> index 0000000000000..64f9c217d0fed
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/skip_on_veth.sh
> @@ -0,0 +1,42 @@
[ ... ]
> +# forwarding.config assigns by name into the array lib.sh declares
> +declare -A NETIFS
> +
> +if [[ -f $forwarding_dir/forwarding.config ]]; then
> + source "$forwarding_dir/forwarding.config"
> +fi
> +
> +: "${NETIF_CREATE:=yes}"
> +: "${NETIF_TYPE:=veth}"
> +
> +# Call before sourcing lib.sh, exiting after it leaves the veth pair behind.
> +# Judges by the first interface, the one lib.sh creates the pair from,
> +# found the way lib.sh finds it: keep in step with lib.sh.
> +skip_on_veth()
> +{
> + # lib.sh takes the interfaces from the command line ahead of anything
> + local p1=${1:-}
> + local kind
> +
> + # Otherwise with NETIF_FIND_DRIVER it takes those of that driver, and
> + # skips by itself when it finds none
> + [[ -z $p1 && -n $find_driver ]] && return
[Severity: Medium]
Can this early return bypass the veth check when forwarding.config
overrides the discovered interface? In lib.sh, netif_find_driver runs
first when NETIF_FIND_DRIVER is set, and forwarding.config is sourced
after that:
if [[ $NETIF_FIND_DRIVER ]]; then
unset NETIFS
declare -A NETIFS
netif_find_driver
fi
...
if [[ -f $net_forwarding_dir/forwarding.config ]]; then
source "$net_forwarding_dir/forwarding.config"
Suppose NETIF_FIND_DRIVER is set, no arguments are given, and
forwarding.config sets NETIFS[p1] to a veth. Suppose instead it sets
NETIFS[p1] to a missing name that lib.sh would create as a veth. In
both cases skip_on_veth() returns without looking at NETIFS[p1]. The
five tests then run on veth and fail, which is what this patch is meant
to prevent.
The comment above the function says the logic is "found the way lib.sh
finds it: keep in step with lib.sh", but this ordering is not mirrored.
Should the NETIFS[p1] value from forwarding.config be checked in this
case too?
> + p1=${p1:-${NETIFS[p1]-veth0}}
> + if ip link show dev "$p1" &> /dev/null; then
> + kind=$(ip -j -d link show dev "$p1" | jq -r '.[].linkinfo.info_kind')
[Severity: Low]
This isn't a bug, but skip_on_veth() copies lib.sh's interface selection
by hand. That covers the NETIFS defaults, NETIF_FIND_DRIVER,
forwarding.config, command line arguments and NETIF_CREATE/NETIF_TYPE.
The two copies have to be kept in step manually.
forwarding.config is also sourced twice, once here and once in lib.sh,
so any side effects in the config run twice.
The check skips purely on info_kind being veth. A user who deliberately
passes or configures a pre-created veth pair is therefore skipped.
The message "set NETIFS in forwarding.config" is misleading when NETIFS
is already set.
Would it be cleaner to share the selection logic with lib.sh rather than
duplicating it?
> + elif [[ $NETIF_CREATE == yes && $NETIF_TYPE == veth ]]; then
> + kind=veth # what lib.sh creates when the interface is missing
> + fi
> + [[ $kind == veth ]] || return
> + echo "SKIP: needs a real interface, set NETIFS in forwarding.config"
> + exit 4 # ksft_skip, lib.sh is not sourced yet
> +}
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261007145044.2647274-1-eva.kurchatova@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-10-07 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 14:50 [Devel] [PATCH hci-8.1 v4 0/1] " Eva Kurchatova
2026-10-07 14:50 ` [Devel] [PATCH hci-8.1 v4 1/1] selftests: " Eva Kurchatova
2026-10-07 14:55 ` no-reply [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=010701a116dcbb5f-f0370f13-c6c7-45cc-8776-e6fc65a55026-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=eva.kurchatova@virtuozzo.com \
--cc=khorenko@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox