Skip to content

Commit 93a3545

Browse files
jsitnickiAlexei Starovoitov
authored andcommitted
tools/bpftool: Add name mappings for SK_LOOKUP prog and attach type
Make bpftool show human-friendly identifiers for newly introduced program and attach type, BPF_PROG_TYPE_SK_LOOKUP and BPF_SK_LOOKUP, respectively. Also, add the new prog type bash-completion, man page and help message. Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200717103536.397595-14-jakub@cloudflare.com
1 parent 499dd29 commit 93a3545

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

tools/bpf/bpftool/Documentation/bpftool-prog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ PROG COMMANDS
4545
| **cgroup/getsockname4** | **cgroup/getsockname6** | **cgroup/sendmsg4** | **cgroup/sendmsg6** |
4646
| **cgroup/recvmsg4** | **cgroup/recvmsg6** | **cgroup/sysctl** |
4747
| **cgroup/getsockopt** | **cgroup/setsockopt** |
48-
| **struct_ops** | **fentry** | **fexit** | **freplace**
48+
| **struct_ops** | **fentry** | **fexit** | **freplace** | **sk_lookup**
4949
| }
5050
| *ATTACH_TYPE* := {
5151
| **msg_verdict** | **stream_verdict** | **stream_parser** | **flow_dissector**

tools/bpf/bpftool/bash-completion/bpftool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ _bpftool()
479479
cgroup/post_bind4 cgroup/post_bind6 \
480480
cgroup/sysctl cgroup/getsockopt \
481481
cgroup/setsockopt struct_ops \
482-
fentry fexit freplace" -- \
482+
fentry fexit freplace sk_lookup" -- \
483483
"$cur" ) )
484484
return 0
485485
;;

tools/bpf/bpftool/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const char * const attach_type_name[__MAX_BPF_ATTACH_TYPE] = {
6464
[BPF_TRACE_FEXIT] = "fexit",
6565
[BPF_MODIFY_RETURN] = "mod_ret",
6666
[BPF_LSM_MAC] = "lsm_mac",
67+
[BPF_SK_LOOKUP] = "sk_lookup",
6768
};
6869

6970
void p_err(const char *fmt, ...)

tools/bpf/bpftool/prog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const char * const prog_type_name[] = {
5959
[BPF_PROG_TYPE_TRACING] = "tracing",
6060
[BPF_PROG_TYPE_STRUCT_OPS] = "struct_ops",
6161
[BPF_PROG_TYPE_EXT] = "ext",
62+
[BPF_PROG_TYPE_SK_LOOKUP] = "sk_lookup",
6263
};
6364

6465
const size_t prog_type_name_size = ARRAY_SIZE(prog_type_name);
@@ -1905,7 +1906,7 @@ static int do_help(int argc, char **argv)
19051906
" cgroup/getsockname4 | cgroup/getsockname6 | cgroup/sendmsg4 |\n"
19061907
" cgroup/sendmsg6 | cgroup/recvmsg4 | cgroup/recvmsg6 |\n"
19071908
" cgroup/getsockopt | cgroup/setsockopt |\n"
1908-
" struct_ops | fentry | fexit | freplace }\n"
1909+
" struct_ops | fentry | fexit | freplace | sk_lookup }\n"
19091910
" ATTACH_TYPE := { msg_verdict | stream_verdict | stream_parser |\n"
19101911
" flow_dissector }\n"
19111912
" METRIC := { cycles | instructions | l1d_loads | llc_misses }\n"

0 commit comments

Comments
 (0)