OSDN Git Service

tools: ynl: support pretty printing bad attribute names
authorJakub Kicinski <kuba@kernel.org>
Tue, 31 Jan 2023 02:33:48 +0000 (18:33 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Feb 2023 04:36:03 +0000 (20:36 -0800)
commit4cd2796f3f8d82aa3a13d3eca39950fe6fe9d672
tree728297b75177b27071eaefc5a26c25856eac6047
parent90256f3f8093284ef4f162229438ff1eea3a928e
tools: ynl: support pretty printing bad attribute names

One of my favorite features of the Netlink specs is that they
make decoding structured extack a ton easier.
Implement pretty printing bad attribute names in YNL.

For example it will now say:

  'bad-attr': '.header.flags'

rather than the useless:

  'bad-attr-offs': 32

Proof:

  $ ./cli.py --spec ethtool.yaml --do rings_get \
     --json '{"header":{"dev-index":1, "flags":4}}'
  Netlink error: Invalid argument
  nl_len = 68 (52) nl_flags = 0x300 nl_type = 2
error: -22 extack: {'msg': 'reserved bit set',
 'bad-attr': '.header.flags'}

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/lib/ynl.py