diff options
author | David S. Miller <davem@davemloft.net> | 2024-02-09 13:23:46 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-09 13:23:46 +0300 |
commit | 20ad40187d5badb13e492b553080ec18fb1cdfe9 (patch) | |
tree | ee5ca807dadabf62ccddf32e8076e8bf20a504d2 /include/linux/wwan.h | |
parent | e7689879d14ee730085c2f5974003c2d0ebbebc6 (diff) | |
parent | 1ec9daf950936c2a1c591596e83c09ce2eb12ade (diff) | |
download | linux-20ad40187d5badb13e492b553080ec18fb1cdfe9.tar.xz |
Merge branch 'netconsole-userdata-append'
Matthew Wood says:
====================
netconsole: Add userdata append support
Add the ability to add custom userdata to every outbound netconsole message
as a collection of key/value pairs, allowing users to add metadata to every
netconsole message which can be used for for tagging, filtering, and
aggregating log messages.
In a previous patch series the ability to prepend the uname release was
added towards the goals above. This patch series builds on that
idea to allow any userdata, keyed by a user provided name, to be
included in netconsole messages.
If CONFIG_NETCONSOLE_DYNAMIC is enabled an additional userdata
directory will be presented in the netconsole configfs tree, allowing
the addition of userdata entries.
/sys/kernel/config/netconsole/
<target>/
enabled
release
dev_name
local_port
remote_port
local_ip
remote_ip
local_mac
remote_mac
userdata/
<key>/
value
<key>/
value
...
v1->v2:
* Updated netconsole_target docs, kdoc is now clean
v2->v3:
* Remove inline keyword from to_userdat* functions
* Break up some lines that exceeded 80 chars
* Replace typos and remove {} from single line if statement
* Remove unused variable
Testing for this series is as follows:
Build every patch without CONFIG_NETCONSOLE_DYNAMIC, and also built
with CONFIG_NETCONSOLE_DYNAMIC enabled for every patch after the config
option was added
Test Userdata configfs
# Adding userdata
cd /sys/kernel/config/netconsole/ && mkdir cmdline0 && cd cmdline0
mkdir userdata/release && echo hotfix1 > userdata/release/value
preview=$(for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done)
[[ "$preview" == $'release=hotfix1' ]] && echo pass || echo fail
mkdir userdata/testing && echo something > userdata/testing/value
preview=$(for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done)
[[ "$preview" == $'release=hotfix1\ntesting=something' ]] && echo pass || echo fail
#
# Removing Userdata
rmdir userdata/testing
preview=$(for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done)
[[ "$preview" == $'release=hotfix1' ]] && echo pass || echo fail
rmdir userdata/release
preview=$(for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done)
[[ "$preview" == $'' ]] && echo pass || echo fail
#
# Adding userdata key with too large of 6.7.0-rc8-virtme,12,481,17954104,-directory name [<54 chars]
mkdir userdata/testing12345678901234567890123456789012345678901234567890
[[ $? == 1 ]] && echo pass || echo fail
#
# Adding userdata value with too large of value [<200 chars]
mkdir userdata/testing
echo `for i in {1..201};do printf "%s" "v";done` > userdata/testing/value
[[ $? == 1 ]] && echo pass || echo fail
rmdir userdata/testing
- Output:
pass
pass
pass
pass
pass
mkdir: cannot create directory ‘cmdline0/userdata/testing12345678901234567890123456789012345678901234567890’: File name too long
pass
bash: echo: write error: Message too long
pass
Test netconsole messages (w/ msg fragmentation)
echo `for i in {1..996};do printf "%s" "v";done` > /dev/kmsg
- Output:
6.7.0-rc8-virtme,12,484,84321212,-,ncfrag=0/997;vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv6.7.0-rc8-virtme,12,484,84321212,-,ncfrag=952/997;vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Test empty userdatum
cd /sys/kernel/config/netconsole/ && mkdir cmdline0
mkdir cmdline0/userdata/empty
echo test > /dev/kmsg
rmdir cmdline0/userdata/empty
- Output:
Test netconsole messages (w/o userdata fragmentation)
cd /sys/kernel/config/netconsole/ && mkdir cmdline0
mkdir cmdline0/userdata/release && echo hotfix1 > cmdline0/userdata/release/value
mkdir cmdline0/userdata/testing && echo something > cmdline0/userdata/testing/value
echo test > /dev/kmsg
rmdir cmdline0/userdata/release
rmdir cmdline0/userdata/testing
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/wwan.h')
0 files changed, 0 insertions, 0 deletions