Skip to content

Commit fad361a

Browse files
leitaokuba-moo
authored andcommitted
netconsole: Enable compile time configuration
Enable netconsole features to be set at compilation time. Create two Kconfig options that allow users to set extended logs and release prepending features at compilation time. Right now, the user needs to pass command line parameters to netconsole, such as "+"/"r" to enable extended logs and version prepending features. With these two options, the user could set the default values for the features at compile time, and don't need to pass it in the command line to get them enabled, simplifying the command line. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20230811093158.1678322-3-leitao@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b0a9e2c commit fad361a

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/net/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,28 @@ config NETCONSOLE_DYNAMIC
332332
at runtime through a userspace interface exported using configfs.
333333
See <file:Documentation/networking/netconsole.rst> for details.
334334

335+
config NETCONSOLE_EXTENDED_LOG
336+
bool "Set kernel extended message by default"
337+
depends on NETCONSOLE
338+
default n
339+
help
340+
Set extended log support for netconsole message. If this option is
341+
set, log messages are transmitted with extended metadata header in a
342+
format similar to /dev/kmsg. See
343+
<file:Documentation/networking/netconsole.rst> for details.
344+
345+
config NETCONSOLE_PREPEND_RELEASE
346+
bool "Prepend kernel release version in the message by default"
347+
depends on NETCONSOLE_EXTENDED_LOG
348+
default n
349+
help
350+
Set kernel release to be prepended to each netconsole message by
351+
default. If this option is set, the kernel release is prepended into
352+
the first field of every netconsole message, so, the netconsole
353+
server/peer can easily identify what kernel release is logging each
354+
message. See <file:Documentation/networking/netconsole.rst> for
355+
details.
356+
335357
config NETPOLL
336358
def_bool NETCONSOLE
337359

drivers/net/netconsole.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ static struct netconsole_target *alloc_and_init(void)
178178
if (!nt)
179179
return nt;
180180

181+
if (IS_ENABLED(CONFIG_NETCONSOLE_EXTENDED_LOG))
182+
nt->extended = true;
183+
if (IS_ENABLED(CONFIG_NETCONSOLE_PREPEND_RELEASE))
184+
nt->release = true;
185+
181186
nt->np.name = "netconsole";
182187
strscpy(nt->np.dev_name, "eth0", IFNAMSIZ);
183188
nt->np.local_port = 6665;

0 commit comments

Comments
 (0)