mbox series

[bpf-next,0/2] bpftool: Fix some json formatting for struct_ops

Message ID 20231018230133.1593152-1-chantr4@gmail.com (mailing list archive)
Headers show
Series bpftool: Fix some json formatting for struct_ops | expand

Message

Manu Bretelle Oct. 18, 2023, 11:01 p.m. UTC
When dumping struct_ops with bpftool, the json produced was invalid.
1) pointer values where not printed with surrounding quotes, causing an
invalid json integer to be emitted
2) when bpftool struct_ops dump id <id>, the 2 dictionaries were not
wrapped in a array, here also causing an invalid json payload to be
emitted. 

Manu Bretelle (2):
  bpftool: fix printing of pointer value
  bpftool: wrap struct_ops dump in an array

 tools/bpf/bpftool/btf_dumper.c | 2 +-
 tools/bpf/bpftool/struct_ops.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Eduard Zingerman Oct. 19, 2023, 12:56 p.m. UTC | #1
On Wed, 2023-10-18 at 16:01 -0700, Manu Bretelle wrote:
> When dumping struct_ops with bpftool, the json produced was invalid.
> 1) pointer values where not printed with surrounding quotes, causing an
> invalid json integer to be emitted
> 2) when bpftool struct_ops dump id <id>, the 2 dictionaries were not
> wrapped in a array, here also causing an invalid json payload to be
> emitted. 

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

Hi Manu,

I've tested this patch-set and everything seems to work as expected.

Thanks,
Eduard

> Manu Bretelle (2):
>   bpftool: fix printing of pointer value
>   bpftool: wrap struct_ops dump in an array
> 
>  tools/bpf/bpftool/btf_dumper.c | 2 +-
>  tools/bpf/bpftool/struct_ops.c | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
Quentin Monnet Oct. 19, 2023, 2:28 p.m. UTC | #2
On 19/10/2023 00:01, Manu Bretelle wrote:
> When dumping struct_ops with bpftool, the json produced was invalid.
> 1) pointer values where not printed with surrounding quotes, causing an
> invalid json integer to be emitted
> 2) when bpftool struct_ops dump id <id>, the 2 dictionaries were not
> wrapped in a array, here also causing an invalid json payload to be
> emitted. 
> 
> Manu Bretelle (2):
>   bpftool: fix printing of pointer value
>   bpftool: wrap struct_ops dump in an array
> 
>  tools/bpf/bpftool/btf_dumper.c | 2 +-
>  tools/bpf/bpftool/struct_ops.c | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 

Acked-by: Quentin Monnet <quentin@isovalent.com>

Thanks a lot for these fixes!
patchwork-bot+netdevbpf@kernel.org Oct. 19, 2023, 2:40 p.m. UTC | #3
Hello:

This series was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed, 18 Oct 2023 16:01:31 -0700 you wrote:
> When dumping struct_ops with bpftool, the json produced was invalid.
> 1) pointer values where not printed with surrounding quotes, causing an
> invalid json integer to be emitted
> 2) when bpftool struct_ops dump id <id>, the 2 dictionaries were not
> wrapped in a array, here also causing an invalid json payload to be
> emitted.
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/2] bpftool: fix printing of pointer value
    https://git.kernel.org/bpf/bpf-next/c/90704b4be0b0
  - [bpf-next,2/2] bpftool: wrap struct_ops dump in an array
    https://git.kernel.org/bpf/bpf-next/c/6bd5e167af2e

You are awesome, thank you!