[PATCH net-next 10/11] tools: ynl: decode hex input

Jacob Keller jacob.e.keller at intel.com
Sat Sep 6 00:27:46 UTC 2025



On 9/5/2025 3:51 AM, Donald Hunter wrote:
> Asbjørn Sloth Tønnesen <ast at fiberby.net> writes:
> 
>> This patch add 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>"}'
>>
>> Signed-off-by: Asbjørn Sloth Tønnesen <ast at fiberby.net>
> 
> Reviewed-by: Donald Hunter <donald.hunter at gmail.com>
> 
> FWIW, the hex can include spaces or not when using bytes.fromhex(). When
> formatting hex for output, I chose to include spaces, but I don't really
> know if that was a good choice or not.

I also prefer the spaces for readability.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20250905/e3a75c79/attachment.sig>


More information about the WireGuard mailing list