diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-04-26 04:18:01 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-04-26 16:39:22 -0400 |
commit | 9b984a20ca84337af81cdab92d1e8ae37007894a (patch) | |
tree | 1f43b64539b0ddef3c6c53d467f8e2201f97d8ff /tools/bpf | |
parent | fb6ef42b5c8e4ce92c2c3c36398ad7574b290951 (diff) |
tools, bpftool: Display license GPL compatible in prog show/list
Display the license "gpl" string in bpftool prog command, like:
# bpftool prog list
5: tracepoint name func tag 57cd311f2e27366b gpl
loaded_at Apr 26/09:37 uid 0
xlated 16B not jited memlock 4096B
# bpftool --json --pretty prog show
[{
"id": 5,
"type": "tracepoint",
"name": "func",
"tag": "57cd311f2e27366b",
"gpl_compatible": true,
"loaded_at": "Apr 26/09:37",
"uid": 0,
"bytes_xlated": 16,
"jited": false,
"bytes_memlock": 4096
}
]
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf')
-rw-r--r-- | tools/bpf/bpftool/Documentation/bpftool-prog.rst | 3 | ||||
-rw-r--r-- | tools/bpf/bpftool/prog.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst index 67ca6c69376c..43d34a5c3ec5 100644 --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst | |||
@@ -95,7 +95,7 @@ EXAMPLES | |||
95 | **# bpftool prog show** | 95 | **# bpftool prog show** |
96 | :: | 96 | :: |
97 | 97 | ||
98 | 10: xdp name some_prog tag 005a3d2123620c8b | 98 | 10: xdp name some_prog tag 005a3d2123620c8b gpl |
99 | loaded_at Sep 29/20:11 uid 0 | 99 | loaded_at Sep 29/20:11 uid 0 |
100 | xlated 528B jited 370B memlock 4096B map_ids 10 | 100 | xlated 528B jited 370B memlock 4096B map_ids 10 |
101 | 101 | ||
@@ -108,6 +108,7 @@ EXAMPLES | |||
108 | "id": 10, | 108 | "id": 10, |
109 | "type": "xdp", | 109 | "type": "xdp", |
110 | "tag": "005a3d2123620c8b", | 110 | "tag": "005a3d2123620c8b", |
111 | "gpl_compatible": true, | ||
111 | "loaded_at": "Sep 29/20:11", | 112 | "loaded_at": "Sep 29/20:11", |
112 | "uid": 0, | 113 | "uid": 0, |
113 | "bytes_xlated": 528, | 114 | "bytes_xlated": 528, |
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index 548adb9b7317..e71a0a11afde 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c | |||
@@ -235,6 +235,8 @@ static void print_prog_json(struct bpf_prog_info *info, int fd) | |||
235 | info->tag[0], info->tag[1], info->tag[2], info->tag[3], | 235 | info->tag[0], info->tag[1], info->tag[2], info->tag[3], |
236 | info->tag[4], info->tag[5], info->tag[6], info->tag[7]); | 236 | info->tag[4], info->tag[5], info->tag[6], info->tag[7]); |
237 | 237 | ||
238 | jsonw_bool_field(json_wtr, "gpl_compatible", info->gpl_compatible); | ||
239 | |||
238 | print_dev_json(info->ifindex, info->netns_dev, info->netns_ino); | 240 | print_dev_json(info->ifindex, info->netns_dev, info->netns_ino); |
239 | 241 | ||
240 | if (info->load_time) { | 242 | if (info->load_time) { |
@@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd) | |||
295 | printf("tag "); | 297 | printf("tag "); |
296 | fprint_hex(stdout, info->tag, BPF_TAG_SIZE, ""); | 298 | fprint_hex(stdout, info->tag, BPF_TAG_SIZE, ""); |
297 | print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino); | 299 | print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino); |
300 | printf("%s", info->gpl_compatible ? " gpl" : ""); | ||
298 | printf("\n"); | 301 | printf("\n"); |
299 | 302 | ||
300 | if (info->load_time) { | 303 | if (info->load_time) { |