Re: [PATCH net-next v01 3/4] selftests: net/psock_fanout: restore loopback up/down state on exit
From: Willem de Bruijn
Date: Mon Oct 07 2024 - 18:15:22 EST
Gur Stavi wrote:
> Minimize the risk that psock_fanout leaves loopback device in a different
> state than the start state.
>
> Restore loopback up/down state when test reaches end of main.
> For abort on errors, globally replace all 'exit' with 'cleanup_and_exit'
> that restores loopback up/down state.
Luckily tools/testing/selftests/net/run_afpackettests already runs
this test in a network namespace, so nothing terrible will happen if
it leaves lo down on exit.
I'd like to avoid this many code changes. As long as the test exits
with failure, it's fine if this particular state is left.
And prefer separate set_loopback_up and .._down helpers, rather than
a toggle whose behavior depends on current state.
> Signed-off-by: Gur Stavi <gur.stavi@xxxxxxxxxx>