[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m25xmsnk71.fsf@gmail.com>
Date: Mon, 06 Jan 2025 13:30:42 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com
Subject: Re: [PATCH net-next 2/3] tools: ynl: print some information about
attribute we can't parse
Jakub Kicinski <kuba@...nel.org> writes:
> When parsing throws an exception one often has to figure out which
> attribute couldn't be parsed from first principles. For families
> with large message parsing trees like rtnetlink guessing the
> attribute can be hard.
>
> Print a bit of information as the exception travels out, e.g.:
>
> # when dumping rt links
> Error decoding 'flags' from 'linkinfo-ip6tnl-attrs'
> Error decoding 'data' from 'linkinfo-attrs'
> Error decoding 'linkinfo' from 'link-attrs'
> Traceback (most recent call last):
> File "/home/kicinski/linux/./tools/net/ynl/cli.py", line 119, in <module>
> main()
> File "/home/kicinski/linux/./tools/net/ynl/cli.py", line 100, in main
> reply = ynl.dump(args.dump, attrs)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 1064, in dump
> return self._op(method, vals, dump=True)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 1058, in _op
> return self._ops(ops)[0]
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 1045, in _ops
> rsp_msg = self._decode(decoded.raw_attrs, op.attr_set.name)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 738, in _decode
> subdict = self._decode(NlAttrs(attr.raw), attr_spec['nested-attributes'], search_attrs)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 763, in _decode
> decoded = self._decode_sub_msg(attr, attr_spec, search_attrs)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 714, in _decode_sub_msg
> subdict = self._decode(NlAttrs(attr.raw, offset), msg_format.attr_set)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 749, in _decode
> decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
> File "/home/kicinski/linux/tools/net/ynl/lib/ynl.py", line 147, in as_scalar
> return format.unpack(self.raw)[0]
> struct.error: unpack requires a buffer of 2 bytes
>
> The Traceback is what we would previously see, the "Error..."
> messages are new. We print a message per level (in the stack
> order). Printing single combined message gets tricky quickly
> given sub-messages etc.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Donald Hunter <donald.hunter@...il.com>
Powered by blists - more mailing lists