bpftool: Add libbpf's version number to "bpftool version" output
authorQuentin Monnet <quentin@isovalent.com>
Thu, 10 Feb 2022 10:42:36 +0000 (10:42 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 11 Feb 2022 05:09:47 +0000 (21:09 -0800)
commit61fce9693f0311949c59cc62a8fdee6e36243553
tree0d88ba70c42f95bfb2715ad78fe7360e56e26fdb
parent4cc0991abd3954609a6929234bbb8c0fe7a0298d
bpftool: Add libbpf's version number to "bpftool version" output

To help users check what version of libbpf is being used with bpftool,
print the number along with bpftool's own version number.

Output:

    $ ./bpftool version
    ./bpftool v5.16.0
    using libbpf v0.7
    features: libbfd, libbpf_strict, skeletons

    $ ./bpftool version --json --pretty
    {
        "version": "5.16.0",
        "libbpf_version": "0.7",
        "features": {
            "libbfd": true,
            "libbpf_strict": true,
            "skeletons": true
        }
    }

Note that libbpf does not expose its patch number.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220210104237.11649-2-quentin@isovalent.com
tools/bpf/bpftool/Documentation/common_options.rst
tools/bpf/bpftool/main.c