[PATCH 0/2] netconsole: give the console of each target a unique name
From: Chris Down
Date: Fri Dec 04 2026 - 15:01:59 EST
0d97bae9abbe ("netconsole: register one console per target") calls the
console of a target netcons_<target name>, but only 15 characters of
that fit and a target made through configfs always has index 0, so
targets whose names start with the same seven characters all register
a console with the same name and index. At the moment that only means
that /proc/consoles can't tell them apart, but with the per-console
loglevel series [0] applied on top, the second such target fails to get
its directory in /sys/class/console, and the replay trigger planned for
netconsole [1] would go by the same names.
Patch 1 gives a new target the lowest index which no other target with
the same console name has. Two such targets then become, say,
netcons_target_0 and netcons_target_1, and a target with a short name
like foo is still netcons_foo0.
Patch 2 adds a selftest which creates two such targets and checks that
/proc/consoles lists a different console for each, since no test looks
at the console names so far.
Breno, 0d97bae9abbe says that names can collide, so you may well have
your own plans for this already. Patch 1 keeps the names you chose and
only uses the index to tell them apart, but please do tell me if you'd
rather go about it another way.
This is based on net-next, since nothing else has 0d97bae9abbe yet.
[0]: https://lore.kernel.org/r/84b8d91693e56f6026271bc40553bcb6657ab24d.1764272407.git.chris@xxxxxxxxxxxxxx
[1]: https://lore.kernel.org/r/at84qygscue8crQi@xxxxxxxxx
Chris Down (2):
netconsole: give the console of each target a unique name
selftests: netconsole: check that targets get distinct console names
drivers/net/netconsole.c | 43 +++++++++++-
.../selftests/drivers/net/netconsole/Makefile | 1 +
.../net/netconsole/netcons_console_name.sh | 70 +++++++++++++++++++
3 files changed, 113 insertions(+), 1 deletion(-)
create mode 100755 tools/testing/selftests/drivers/net/netconsole/netcons_console_name.sh
base-commit: d5cf954cebe4f175dfd834e1dc471a3aa203ec7d
--
2.56.1