]> asedeno.scripts.mit.edu Git - linux.git/commit
tools: bpftool: add JSON output for `bpftool batch file FILE` command
authorQuentin Monnet <quentin.monnet@netronome.com>
Mon, 23 Oct 2017 16:24:12 +0000 (09:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Oct 2017 00:25:09 +0000 (01:25 +0100)
commit3aaca6bf7a09150e4c87f2932dc8ebe82a586252
tree5f58efe61c9d6f20f79d34d75058fce3bd7e6a8f
parent831a0aafe5c39405150d47994fe0a5bcd78fbadc
tools: bpftool: add JSON output for `bpftool batch file FILE` command

`bpftool batch file FILE` takes FILE as an argument and executes all the
bpftool commands it finds inside (or stops if an error occurs).

To obtain a consistent JSON output, create a root JSON array, then for
each command create a new object containing two fields: one with the
command arguments, the other with the output (which is the JSON object
that the command would have produced, if called on its own).

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/bpf/bpftool/main.c