lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180718091942.2963-1-daniel@iogearbox.net>
Date:   Wed, 18 Jul 2018 11:19:42 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     alexei.starovoitov@...il.com
Cc:     jakub.kicinski@...ronome.com, netdev@...r.kernel.org,
        Daniel Borkmann <daniel@...earbox.net>
Subject: [PATCH bpf-next] bpf: show in bpftool map overview whether btf is available

For a quick overview in 'bpftool map' display 'btf' if it's
available for the dump for a specific map:

  # bpftool map list
  11: array  flags 0x0  btf
          key 4B  value 20B  max_entries 40  memlock 4096B

  # bpftool --json --pretty map list
  [{
          "id": 11,
          "type": "array",
          "flags": 0,
          "btf_available": true,
          "bytes_key": 4,
          "bytes_value": 20,
          "max_entries": 40,
          "bytes_memlock": 4096
      }
  ]

Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
---
 tools/bpf/bpftool/map.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 9c81918..2cc4741 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -490,6 +490,8 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
 
 	jsonw_name(json_wtr, "flags");
 	jsonw_printf(json_wtr, "%d", info->map_flags);
+	jsonw_name(json_wtr, "btf_available");
+	jsonw_bool(json_wtr, info->btf_key_type_id && info->btf_value_type_id);
 
 	print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);
 
@@ -535,6 +537,8 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
 		printf("name %s  ", info->name);
 
 	printf("flags 0x%x", info->map_flags);
+	if (info->btf_key_type_id && info->btf_value_type_id)
+		printf("  btf");
 	print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
 	printf("\n");
 	printf("\tkey %uB  value %uB  max_entries %u",
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ