Skip to content

Commit 7224a07

Browse files
committed
Merge branch 'bpf/bpftool: add program & link type names'
Milan Landaverde says: ==================== With the addition of the syscall prog type we should now be able to see feature probe info for that prog type: $ bpftool feature probe kernel ... eBPF program_type syscall is available ... eBPF helpers supported for program type syscall: ... - bpf_sys_bpf - bpf_sys_close And for the link types, their names should aid in the output. Before: $ bpftool link show 50: type 7 prog 5042 bpf_cookie 0 pids vfsstat(394433) After: $ bpftool link show 57: perf_event prog 5058 bpf_cookie 0 pids vfsstat(394725) ==================== Signed-off-by: Andrii Nakryiko <[email protected]>
2 parents 4eeebce + 7b53eaa commit 7224a07

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

tools/bpf/bpftool/feature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,
567567

568568
res = probe_prog_type_ifindex(prog_type, ifindex);
569569
} else {
570-
res = libbpf_probe_bpf_prog_type(prog_type, NULL);
570+
res = libbpf_probe_bpf_prog_type(prog_type, NULL) > 0;
571571
}
572572

573573
#ifdef USE_LIBCAP

tools/bpf/bpftool/link.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ static const char * const link_type_name[] = {
2020
[BPF_LINK_TYPE_CGROUP] = "cgroup",
2121
[BPF_LINK_TYPE_ITER] = "iter",
2222
[BPF_LINK_TYPE_NETNS] = "netns",
23+
[BPF_LINK_TYPE_XDP] = "xdp",
24+
[BPF_LINK_TYPE_PERF_EVENT] = "perf_event",
25+
[BPF_LINK_TYPE_KPROBE_MULTI] = "kprobe_multi",
2326
};
2427

2528
static struct hashmap *link_table;

tools/bpf/bpftool/prog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const char * const prog_type_name[] = {
6868
[BPF_PROG_TYPE_EXT] = "ext",
6969
[BPF_PROG_TYPE_LSM] = "lsm",
7070
[BPF_PROG_TYPE_SK_LOOKUP] = "sk_lookup",
71+
[BPF_PROG_TYPE_SYSCALL] = "syscall",
7172
};
7273

7374
const size_t prog_type_name_size = ARRAY_SIZE(prog_type_name);

0 commit comments

Comments
 (0)