[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd439a28-fed1-b35c-79b0-2100c58584ed@iogearbox.net>
Date: Wed, 5 Jun 2019 22:10:30 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Krzesimir Nowak <krzesimir@...volk.io>, bpf@...r.kernel.org
Cc: Alban Crequy <alban@...volk.io>,
Iago López Galeiras <iago@...volk.io>,
Quentin Monnet <quentin.monnet@...ronome.com>,
Alexei Starovoitov <ast@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Stanislav Fomichev <sdf@...gle.com>,
Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>,
Okash Khawaja <osk@...com>,
David Calavera <david.calavera@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [BPF v1] tools: bpftool: Fix JSON output when lookup fails
On 06/05/2019 09:17 PM, Krzesimir Nowak wrote:
> In commit 9a5ab8bf1d6d ("tools: bpftool: turn err() and info() macros
> into functions") one case of error reporting was special cased, so it
> could report a lookup error for a specific key when dumping the map
> element. What the code forgot to do is to wrap the key and value keys
> into a JSON object, so an example output of pretty JSON dump of a
> sockhash map (which does not support looking up its values) is:
>
> [
> "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x00"
> ],
> "value": {
> "error": "Operation not supported"
> },
> "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x01"
> ],
> "value": {
> "error": "Operation not supported"
> }
> ]
>
> Note the key-value pairs inside the toplevel array. They should be
> wrapped inside a JSON object, otherwise it is an invalid JSON. This
> commit fixes this, so the output now is:
>
> [{
> "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x00"
> ],
> "value": {
> "error": "Operation not supported"
> }
> },{
> "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x01"
> ],
> "value": {
> "error": "Operation not supported"
> }
> }
> ]
>
> Fixes: 9a5ab8bf1d6d ("tools: bpftool: turn err() and info() macros into functions")
> Cc: Quentin Monnet <quentin.monnet@...ronome.com>
> Signed-off-by: Krzesimir Nowak <krzesimir@...volk.io>
Applied, thanks!
Powered by blists - more mailing lists