]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools: ynl: decode hex input
authorAsbjørn Sloth Tønnesen <ast@fiberby.net>
Mon, 15 Sep 2025 14:42:55 +0000 (14:42 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 16 Sep 2025 15:16:57 +0000 (08:16 -0700)
commit52550d518d2454bf0af0b79ca54b6d38f2d94777
tree451388d8dbc45c3d9dfb9cfd7141d162b946cb88
parent5c51ae2446c2f56b505974b1ff91d0c802a0e301
tools: ynl: decode hex input

This patch adds support for decoding hex input, so
that binary attributes can be read through --json.

Example (using future wireguard.yaml):
 $ sudo ./tools/net/ynl/pyynl/cli.py --family wireguard \
   --do set-device --json '{"ifindex":3,
     "private-key":"2a ae 6c 35 c9 4f cf <... to 32 bytes>"}'

In order to somewhat mirror what is done in _formatted_string(),
then for non-binary attributes attempt to convert it to an int.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250915144301.725949-11-ast@fiberby.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/lib/ynl.py