]> git.itanic.dy.fi Git - linux-stable/commitdiff
tools: ynl: don't ignore errors in NLMSG_DONE messages
authorJakub Kicinski <kuba@kernel.org>
Sat, 20 Apr 2024 02:08:26 +0000 (19:08 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 23 Apr 2024 13:37:33 +0000 (15:37 +0200)
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: e4b48ed460d3 ("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>
tools/net/ynl/lib/ynl.py

index 5fa7957f6e0f56646249c278b7434f300754df77..25810e18b0a73272f42ff3a8d9335ee79699b6a0 100644 (file)
@@ -182,6 +182,7 @@ class NlMsg:
             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