Skip to contentSkip to conversation

tools: ynl: don't ignore errors in NLMSG_DONE messages

PATCH Applied Jakub Kicinski 3 participants 3 messages Apr 20, 2024 – Apr 23, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: don't ignore errors in NLMSG_DONE messages

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")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/lib/ynl.py | 1 +
 1 file changed, 1 insertion(+)
tools/net/ynl/lib/ynl.py +1 -0
index a67f7b6fef92..a9e4d588baf6 100644
@@ -203,6 +203,7 @@ from .nlspec import SpecFamily
             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
 
Signature · 1 line
2.44.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jakub Kicinski

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")
Quoted 19 lines

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/lib/ynl.py | 1 +
 1 file changed, 1 insertion(+)
tools/net/ynl/lib/ynl.py +1 -0
index a67f7b6fef92..a9e4d588baf6 100644
@@ -203,6 +203,7 @@ from .nlspec import SpecFamily
             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
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Fri, 19 Apr 2024 19:08:26 -0700 you wrote:

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")

[...]

Here is the summary with links:
- [net] tools: ynl: don't ignore errors in NLMSG_DONE messages

    https://git.kernel.org/netdev/net/c/a44f2eb106a4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html