Re: [PATCH 2/2 net] selftests: fib_tests: add temporary IPv6 address renewal test

Ido Schimmel
2026-05-04T16:42:04Z

On Mon, May 04, 2026 at 12:11:41AM +0200, Fernando Fernandez Mancera wrote:
> Add a test to check that temporary IPv6 address is regenerated properly
> after the base prefix is deprecated and restored.
>
> Fib6 temporary address renewal test
> TEST: IPv6 temporary address cleanly deprecated and regenerated [ OK ]

Thanks for the test, but I reverted the fix and it still passes :(

>
> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
> ---
> tools/testing/selftests/net/fib_tests.sh | 55 +++++++++++++++++++++++-
> 1 file changed, 54 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
> index af64f93bb2e1..6a6e545cb40d 100755
> --- a/tools/testing/selftests/net/fib_tests.sh
> +++ b/tools/testing/selftests/net/fib_tests.sh
> @@ -12,7 +12,7 @@ TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify \
> ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr \
> ipv6_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh fib6_gc_test \
> ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance \
> - ipv4_mpath_balance_preferred fib6_ra_to_static"
> + ipv4_mpath_balance_preferred fib6_ra_to_static fib6_temp_addr_renewal"
>
> VERBOSE=0
> PAUSE_ON_FAIL=no
> @@ -1611,6 +1611,58 @@ fib6_ra_to_static()
> cleanup &> /dev/null
> }
>
> +fib6_temp_addr_renewal() {
> + setup
> +
> + echo
> + echo "Fib6 temporary address renewal test"
> + set -e
> +
> + # ra6 is required for the test. (ipv6toolkit)
> + if [ ! -x "$(command -v ra6)" ]; then
> + echo "SKIP: ra6 not found."
> + set +e
> + cleanup &> /dev/null
> + return
> + fi
> +
> + # Create a pair of veth devices to send a RA message from one
> + # device to another.
> + $IP link add veth1 type veth peer name veth2
> + $IP link set dev veth1 up
> + $IP link set dev veth2 up
> +
> + # Make veth1 ready to receive RA messages.
> + $NS_EXEC sysctl -wq net.ipv6.conf.veth1.accept_ra=2
> + $NS_EXEC sysctl -wq net.ipv6.conf.veth1.use_tempaddr=2
> + $NS_EXEC sysctl -wq net.ipv6.conf.veth1.temp_prefered_lft=15
> + $NS_EXEC sysctl -wq net.ipv6.conf.veth1.max_desync_factor=0
> +
> + # Send a RA message with a prefix from veth2.
> + $NS_EXEC ra6 -i veth2 -s fe80::1 -d ff02::1 -P 2001:12::/64\#LA\#3600\#3600 -e
> + sleep 2
> +
> + # Deprecate it
> + $NS_EXEC ra6 -i veth2 -s fe80::1 -d ff02::1 -P 2001:12::/64\#LA\#3600\#0 -e
> + sleep 2
> +
> + # Restore it
> + $NS_EXEC ra6 -i veth2 -s fe80::1 -d ff02::1 -P 2001:12::/64\#LA\#3600\#3600 -e
> +
> + ret=1
> + for i in $(seq 1 25); do
> + sleep 1
> + num_dep="$($IP -6 addr | grep -c "temporary deprecated" || true)"
> + num_tot="$($IP -6 addr | grep -c "temporary" || true)"
> +
> + if [ "$num_dep" -eq 1 ] && [ "$num_tot" -ge 2 ]; then
> + ret=0
> + break
> + fi
> + done
> + log_test "$ret" 0 "IPv6 temporary address cleanly deprecated and regenerated"

Missing:

set +e

cleanup &> /dev/null

Like in fib6_ra_to_static() and the skip path?

> +}
> +
> # add route for a prefix, flushing any existing routes first
> # expected to be the first step of a test
> add_route()
> @@ -3002,6 +3054,7 @@ do
> ipv6_mpath_balance) ipv6_mpath_balance_test;;
> ipv4_mpath_balance_preferred) ipv4_mpath_balance_preferred_test;;
> fib6_ra_to_static) fib6_ra_to_static;;
> + fib6_temp_addr_renewal) fib6_temp_addr_renewal;;
>
> help) echo "Test names: $TESTS"; exit 0;;
> esac
> --
> 2.53.0
>