From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
edumazet@google.com, pabeni@redhat.com
Subject: Re: [PATCH net-next 2/3] tools: ynl: print some information about attribute we can't parse
Date: Mon, 06 Jan 2025 13:30:42 +0000 [thread overview]
Message-ID: <m25xmsnk71.fsf@gmail.com> (raw)
In-Reply-To: <20250105012523.1722231-3-kuba@kernel.org> (Jakub Kicinski's message of "Sat, 4 Jan 2025 17:25:22 -0800")
Jakub Kicinski <kuba@kernel.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@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
next prev parent reply other threads:[~2025-01-06 13:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-05 1:25 [PATCH net-next 0/3] tools: ynl: decode link types present in tests Jakub Kicinski
2025-01-05 1:25 ` [PATCH net-next 1/3] tools: ynl: correctly handle overrides of fields in subset Jakub Kicinski
2025-01-06 13:27 ` Donald Hunter
2025-01-06 15:36 ` Jakub Kicinski
2025-01-06 17:33 ` Donald Hunter
2025-01-05 1:25 ` [PATCH net-next 2/3] tools: ynl: print some information about attribute we can't parse Jakub Kicinski
2025-01-06 13:30 ` Donald Hunter [this message]
2025-01-05 1:25 ` [PATCH net-next 3/3] netlink: specs: rt_link: decode ip6tnl, vti and vti6 link attrs Jakub Kicinski
2025-01-06 13:38 ` Donald Hunter
2025-01-06 15:53 ` [PATCH net-next 0/3] tools: ynl: decode link types present in tests Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m25xmsnk71.fsf@gmail.com \
--to=donald.hunter@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.