]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: netconsole: only restore MAC when it changed on resume
authorAndre Carvalho <asantostc@gmail.com>
Fri, 10 Jul 2026 22:19:17 +0000 (23:19 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Fri, 17 Jul 2026 11:15:20 +0000 (13:15 +0200)
The "mac" bind mode reactivation downs the interface, restores the saved
MAC and renames it to trigger a target resume. This assumes the recreated
interface comes back with a different MAC, which is true under
MACAddressPolicy=none (as on the Netdev CI) but not when MACs are
persistent. In the persistent case netconsole resumes the target on its
own, and the down/restore/rename flow instead drops it and fails the test.

Guard the block on the MAC having actually changed so the test passes
under both policies.

Fixes: 6ecc08329bab ("selftests: netconsole: validate target resume")
Reported-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Closes: https://lore.kernel.org/netdev/f398373e-2cb4-4649-a491-9763df94d98b@kernel.org/
Signed-off-by: Andre Carvalho <asantostc@gmail.com>
Tested-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260710-netcons-mac-reload-v1-1-3fb1bcc70b4a@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh

index cb59cf436dd0a327260ee684f125864e06bb2433..d9111f2102bcd1df524e0a95a8606695cb958614 100755 (executable)
@@ -44,7 +44,8 @@ function trigger_reactivation() {
        # Restore MACs
        ip netns exec "${NAMESPACE}" ip link set "${DSTIF}" \
                address "${SAVED_DSTMAC}"
-       if [ "${BINDMODE}" == "mac" ]; then
+       if [ "${BINDMODE}" == "mac" ] &&
+               [ "$(mac_get "${SRCIF}")" != "${SAVED_SRCMAC}" ]; then
                ip link set dev "${SRCIF}" down
                ip link set dev "${SRCIF}" address "${SAVED_SRCMAC}"
                # Rename device in order to trigger target resume, as initial