Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In tools/testing/selftests/net/openvswitch/openvswitch.sh,
  both new tests guard datapath creation with `ovs_add_dp "$t" "$dp" ||…

--

selftests/net/openvswitch: check that a failed set keeps the features

This adds a set-dp command to ovs-dpctl.py and two openvswitch selftests
that use it. The tests check that a set with an empty per-cpu-pids is
rejected with EINVAL and leaves the datapath features unchanged, and that
an outdated OVS_DP_CMD_NEW request drops the features. The config fragment
also gains NET_SCHED, NET_CLS_ACT and NET_TC_SKB_EXT for the recirc bit.

> diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh 
> b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> index 21444657a0404..cdeca5a63671f 100755
> --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
> +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh

[ ... ]

> +test_dp_features() {
> +     local t="test_dp_features"
> +     local dp="dpfeat0"
> +
> +     sbx_add "$t" || return $?
> +     ovs_add_dp "$t" "$dp" || return 1

[Severity: Medium]
Can this "|| return 1" ever trigger when add-dp fails?

ovs_add_dp() runs add-dp and then calls on_exit():

ovs_add_dp () {
        ...
        ovs_sbx "$sbxname" python3 $ovs_base/ovs-dpctl.py add-dp $*
        on_exit "ovs_sbx $sbxname python3 $ovs_base/ovs-dpctl.py del-dp $1;"
}

on_exit() {
        echo "$1" > ${ovs_dir}/cleanup.tmp
        cat ${ovs_dir}/cleanup >> ${ovs_dir}/cleanup.tmp
        mv ${ovs_dir}/cleanup.tmp ${ovs_dir}/cleanup
}

The function returns the status of the final mv, so the exit status of
add-dp is lost. OvsDatapath.create() swallows only EEXIST and re-raises
any other NetlinkError, so add-dp can exit non-zero.

If that happens, the first failure the test sees is the next step:

> +
> +     info "clear the datapath features"
> +     ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 ||
> +         { ovs_fail "the datapath features could not be cleared"; return 1; }

Here set-dp prints "DP 'dpfeat0' not found." to stdout. ovs_sbx sends that
into debug.log, and run_test removes $ovs_dir on FAIL. The only reason left
on stderr is "the datapath features could not be cleared", while the real
cause was that the datapath was never created.

The commit message says:

    Every step that can fail says why it did.

The datapath creation step doesn't seem to meet that. Could add-dp's
status be checked, either with "|| return 1" on the add-dp line in
ovs_add_dp() before on_exit, or by calling add-dp directly in the new tests
with an ovs_fail message?

The ovs_add_dp() behaviour is older than this patch, but the new tests
depend on a return status that the helper never gives.

[ ... ]

> +test_dp_features_recirc() {
> +     local t="test_dp_features_recirc"
> +     local dp="dpfeat1"
> +
> +     sbx_add "$t" || return $?
> +     ovs_add_dp "$t" "$dp" || return 1
> +
> +     ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 ||
> +         { ovs_fail "the datapath features could not be cleared"; return 1; }

The same applies here. A failed add-dp for dpfeat1 would be reported as
"the datapath features could not be cleared".

[ ... ]

-- 
Sashiko AI review · 
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124145033.627044-1-houminxi%40gmail.com
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to