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
[ Upstream commit a44f2eb ]

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 <kuba@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20240420020827.3288615-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
kuba-moo authored and gregkh committed May 2, 2024
1 parent 4fee8fa commit 6a65f01
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 @@ -201,6 +201,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 6a65f01

Please sign in to comment.