On 3/8/24 8:07 AM, Jakub Sitnicki wrote:
On Tue, Mar 05, 2024 at 12:22 PM -08, Yonghong Song wrote:
An example output looks like:
9: sk_msg prog 108
map_id 84 attach_type sk_msg_verdict
Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx>
---
tools/bpf/bpftool/link.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
index afde9d0c2ea1..5eb140197d3f 100644
--- a/tools/bpf/bpftool/link.c
+++ b/tools/bpf/bpftool/link.c
@@ -526,6 +526,9 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
show_link_ifindex_json(info->netkit.ifindex, json_wtr);
show_link_attach_type_json(info->netkit.attach_type, json_wtr);
break;
+ case BPF_LINK_TYPE_SK_MSG:
+ jsonw_uint_field(json_wtr, "map_id", info->skmsg.map_id);
+ show_link_attach_type_json(info->skmsg.attach_type, json_wtr);
Compiler says - missing break.
Ack, will fix.
case BPF_LINK_TYPE_XDP:
show_link_ifindex_json(info->xdp.ifindex, json_wtr);
break;
@@ -915,6 +918,11 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
show_link_ifindex_plain(info->netkit.ifindex);
show_link_attach_type_plain(info->netkit.attach_type);
break;
+ case BPF_LINK_TYPE_SK_MSG:
+ printf("\n\t");
+ printf("map_id %u ", info->skmsg.map_id);
+ show_link_attach_type_plain(info->skmsg.attach_type);
+ break;
case BPF_LINK_TYPE_XDP:
printf("\n\t");
show_link_ifindex_plain(info->xdp.ifindex);