From: Jakub Kicinski <hidden> Date: 2018-02-15 06:43:09
Quentin says:
These are two minor fixes to avoid breaking JSON output in batch mode. The
first one makes bpftool output a "null" JSON object, as expected in batch
mode if nothing else is to be printed, when dumping program instructions
into an output file. The second one replaces a call to "perror()" with
something that does not break JSON when parsing input file for batch mode.
Quentin Monnet (2):
tools: bpftool: preserve JSON for batch mode when dumping insns to
file
tools: bpftool: preserve JSON output on errors on batch file parsing
tools/bpf/bpftool/main.c | 2 +-
tools/bpf/bpftool/prog.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
--
2.15.1
From: Jakub Kicinski <hidden> Date: 2018-02-15 06:43:10
From: Quentin Monnet <redacted>
Print a "null" JSON object to standard output when bpftool is used to
print program instructions to a file, so as to avoid breaking JSON
output on batch mode.
This null object was added for most commands in a previous commit, but
this specific case had been omitted.
Fixes: 004b45c0e51a ("tools: bpftool: provide JSON output for all possible commands")
Signed-off-by: Quentin Monnet <redacted>
Acked-by: Jakub Kicinski <redacted>
---
tools/bpf/bpftool/prog.c | 3 +++
1 file changed, 3 insertions(+)
From: Jakub Kicinski <hidden> Date: 2018-02-15 06:43:10
From: Quentin Monnet <redacted>
Before this patch, perror() function is used in some cases when bpftool
fails to parse its input file in batch mode. This function does not
integrate well with the rest of the output when JSON is used, so we
replace it by something that is compliant.
Most calls to perror() had already been replaced in a previous patch,
this one is a leftover.
Fixes: d319c8e101c5 ("tools: bpftool: preserve JSON output on errors on batch file parsing")
Signed-off-by: Quentin Monnet <redacted>
Acked-by: Jakub Kicinski <redacted>
---
tools/bpf/bpftool/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Daniel Borkmann <daniel@iogearbox.net> Date: 2018-02-15 09:03:46
On 02/15/2018 07:42 AM, Jakub Kicinski wrote:
Quentin says:
These are two minor fixes to avoid breaking JSON output in batch mode. The
first one makes bpftool output a "null" JSON object, as expected in batch
mode if nothing else is to be printed, when dumping program instructions
into an output file. The second one replaces a call to "perror()" with
something that does not break JSON when parsing input file for batch mode.