Commit 5b114087 authored by Andre Carvalho's avatar Andre Carvalho Committed by Jakub Kicinski
Browse files

netconsole: clear dev_name for devices bound by mac



This patch makes sure netconsole clears dev_name for devices bound by mac
in order to allow calling setup_netpoll on targets that have previously
been cleaned up (in order to support resuming deactivated targets).

This is required as netpoll_setup populates dev_name even when devices are
matched via mac address. The cleanup is done inside netconsole as bound
by mac is a netconsole concept.

Signed-off-by: default avatarAndre Carvalho <asantostc@gmail.com>
Reviewed-by: default avatarBreno Leitao <leitao@debian.org>
Tested-by: default avatarBreno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260118-netcons-retrigger-v11-4-4de36aebcf48@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e8f4005a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -242,6 +242,12 @@ static void populate_configfs_item(struct netconsole_target *nt,
}
#endif	/* CONFIG_NETCONSOLE_DYNAMIC */

/* Check if the target was bound by mac address. */
static bool bound_by_mac(struct netconsole_target *nt)
{
	return is_valid_ether_addr(nt->np.dev_mac);
}

/* Allocate and initialize with defaults.
 * Note that these targets get their config_item fields zeroed-out.
 */
@@ -284,6 +290,8 @@ static void netconsole_process_cleanups_core(void)
		/* all entries in the cleanup_list needs to be disabled */
		WARN_ON_ONCE(nt->state == STATE_ENABLED);
		do_netpoll_cleanup(&nt->np);
		if (bound_by_mac(nt))
			memset(&nt->np.dev_name, 0, IFNAMSIZ);
		/* moved the cleaned target to target_list. Need to hold both
		 * locks
		 */