Skip to content

Commit

Permalink
tools: ynl: don't ignore errors in NLMSG_DONE messages
Browse files Browse the repository at this point in the history
NLMSG_DONE contains an error code, it has to be extracted.
Prior to this change all dumps will end in success,
and in case of failure the result is silently truncated.

Fixes: e4b48ed ("tools: ynl: add a completely generic client")
Signed-off-by: Jakub Kicinski <[email protected]>
Reviewed-by: Donald Hunter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
kuba-moo authored and Paolo Abeni committed Apr 23, 2024
1 parent 467324b commit a44f2eb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/net/ynl/lib/ynl.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def __init__(self, msg, offset, attr_space=None):
self.done = 1
extack_off = 20
elif self.nl_type == Netlink.NLMSG_DONE:
self.error = struct.unpack("i", self.raw[0:4])[0]
self.done = 1
extack_off = 4

Expand Down

0 comments on commit a44f2eb

Please sign in to comment.