diff mbox series

[net] tools: ynl: don't ignore errors in NLMSG_DONE messages

Message ID 20240420020827.3288615-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit a44f2eb106a46f2275a79de54ce0ea63e4f3d8c8
Delegated to: Netdev Maintainers
Headers show
Series [net] tools: ynl: don't ignore errors in NLMSG_DONE messages | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-21--03-00 (tests: 995)

Commit Message

Jakub Kicinski April 20, 2024, 2:08 a.m. UTC
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>
---
CC: donald.hunter@gmail.com
CC: jiri@resnulli.us
CC: sdf@google.com
---
 tools/net/ynl/lib/ynl.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Donald Hunter April 22, 2024, 12:08 p.m. UTC | #1
Jakub Kicinski <kuba@kernel.org> writes:

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

> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
> CC: sdf@google.com
> ---
>  tools/net/ynl/lib/ynl.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index a67f7b6fef92..a9e4d588baf6 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -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
patchwork-bot+netdevbpf@kernel.org April 23, 2024, 1:50 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

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")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index a67f7b6fef92..a9e4d588baf6 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -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