Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b984a20 authored by Jiri Olsa's avatar Jiri Olsa Committed by Daniel Borkmann
Browse files

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: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent fb6ef42b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ EXAMPLES
**# bpftool prog show**
::

  10: xdp  name some_prog  tag 005a3d2123620c8b
  10: xdp  name some_prog  tag 005a3d2123620c8b  gpl
	loaded_at Sep 29/20:11  uid 0
	xlated 528B  jited 370B  memlock 4096B  map_ids 10

@@ -108,6 +108,7 @@ EXAMPLES
                "id": 10,
                "type": "xdp",
                "tag": "005a3d2123620c8b",
                "gpl_compatible": true,
                "loaded_at": "Sep 29/20:11",
                "uid": 0,
                "bytes_xlated": 528,
+3 −0
Original line number Diff line number Diff line
@@ -235,6 +235,8 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
		     info->tag[0], info->tag[1], info->tag[2], info->tag[3],
		     info->tag[4], info->tag[5], info->tag[6], info->tag[7]);

	jsonw_bool_field(json_wtr, "gpl_compatible", info->gpl_compatible);

	print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);

	if (info->load_time) {
@@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
	printf("tag ");
	fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
	print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
	printf("%s", info->gpl_compatible ? "  gpl" : "");
	printf("\n");

	if (info->load_time) {