2 * Copyright (C) 2017-2018 Netronome Systems, Inc.
4 * This software is dual licensed under the GNU General License Version 2,
5 * June 1991 as shown in the file COPYING in the top-level directory of this
6 * source tree or the BSD 2-Clause License provided below. You have the
7 * option to license this software under the complete terms of either license.
9 * The BSD 2-Clause License:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
15 * 1. Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
19 * 2. Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44 #include <sys/types.h>
47 #include <linux/err.h>
54 #include "xlated_dumper.h"
56 static const char * const prog_type_name[] = {
57 [BPF_PROG_TYPE_UNSPEC] = "unspec",
58 [BPF_PROG_TYPE_SOCKET_FILTER] = "socket_filter",
59 [BPF_PROG_TYPE_KPROBE] = "kprobe",
60 [BPF_PROG_TYPE_SCHED_CLS] = "sched_cls",
61 [BPF_PROG_TYPE_SCHED_ACT] = "sched_act",
62 [BPF_PROG_TYPE_TRACEPOINT] = "tracepoint",
63 [BPF_PROG_TYPE_XDP] = "xdp",
64 [BPF_PROG_TYPE_PERF_EVENT] = "perf_event",
65 [BPF_PROG_TYPE_CGROUP_SKB] = "cgroup_skb",
66 [BPF_PROG_TYPE_CGROUP_SOCK] = "cgroup_sock",
67 [BPF_PROG_TYPE_LWT_IN] = "lwt_in",
68 [BPF_PROG_TYPE_LWT_OUT] = "lwt_out",
69 [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
70 [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
71 [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
72 [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
73 [BPF_PROG_TYPE_SK_MSG] = "sk_msg",
74 [BPF_PROG_TYPE_RAW_TRACEPOINT] = "raw_tracepoint",
75 [BPF_PROG_TYPE_CGROUP_SOCK_ADDR] = "cgroup_sock_addr",
76 [BPF_PROG_TYPE_LIRC_MODE2] = "lirc_mode2",
77 [BPF_PROG_TYPE_FLOW_DISSECTOR] = "flow_dissector",
80 static const char * const attach_type_strings[] = {
81 [BPF_SK_SKB_STREAM_PARSER] = "stream_parser",
82 [BPF_SK_SKB_STREAM_VERDICT] = "stream_verdict",
83 [BPF_SK_MSG_VERDICT] = "msg_verdict",
84 [__MAX_BPF_ATTACH_TYPE] = NULL,
87 enum bpf_attach_type parse_attach_type(const char *str)
89 enum bpf_attach_type type;
91 for (type = 0; type < __MAX_BPF_ATTACH_TYPE; type++) {
92 if (attach_type_strings[type] &&
93 is_prefix(str, attach_type_strings[type]))
97 return __MAX_BPF_ATTACH_TYPE;
100 static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
102 struct timespec real_time_ts, boot_time_ts;
103 time_t wallclock_secs;
108 if (clock_gettime(CLOCK_REALTIME, &real_time_ts) ||
109 clock_gettime(CLOCK_BOOTTIME, &boot_time_ts)) {
110 perror("Can't read clocks");
111 snprintf(buf, size, "%llu", nsecs / 1000000000);
115 wallclock_secs = (real_time_ts.tv_sec - boot_time_ts.tv_sec) +
116 (real_time_ts.tv_nsec - boot_time_ts.tv_nsec + nsecs) /
120 if (!localtime_r(&wallclock_secs, &load_tm)) {
121 snprintf(buf, size, "%llu", nsecs / 1000000000);
126 strftime(buf, size, "%s", &load_tm);
128 strftime(buf, size, "%FT%T%z", &load_tm);
131 static int prog_fd_by_tag(unsigned char *tag)
133 struct bpf_prog_info info = {};
134 __u32 len = sizeof(info);
140 err = bpf_prog_get_next_id(id, &id);
142 p_err("%s", strerror(errno));
146 fd = bpf_prog_get_fd_by_id(id);
148 p_err("can't get prog by id (%u): %s",
149 id, strerror(errno));
153 err = bpf_obj_get_info_by_fd(fd, &info, &len);
155 p_err("can't get prog info (%u): %s",
156 id, strerror(errno));
161 if (!memcmp(tag, info.tag, BPF_TAG_SIZE))
168 int prog_parse_fd(int *argc, char ***argv)
172 if (is_prefix(**argv, "id")) {
178 id = strtoul(**argv, &endptr, 0);
180 p_err("can't parse %s as ID", **argv);
185 fd = bpf_prog_get_fd_by_id(id);
187 p_err("get by id (%u): %s", id, strerror(errno));
189 } else if (is_prefix(**argv, "tag")) {
190 unsigned char tag[BPF_TAG_SIZE];
194 if (sscanf(**argv, BPF_TAG_FMT, tag, tag + 1, tag + 2,
195 tag + 3, tag + 4, tag + 5, tag + 6, tag + 7)
197 p_err("can't parse tag");
202 return prog_fd_by_tag(tag);
203 } else if (is_prefix(**argv, "pinned")) {
211 return open_obj_pinned_any(path, BPF_OBJ_PROG);
214 p_err("expected 'id', 'tag' or 'pinned', got: '%s'?", **argv);
218 static void show_prog_maps(int fd, u32 num_maps)
220 struct bpf_prog_info info = {};
221 __u32 len = sizeof(info);
222 __u32 map_ids[num_maps];
226 info.nr_map_ids = num_maps;
227 info.map_ids = ptr_to_u64(map_ids);
229 err = bpf_obj_get_info_by_fd(fd, &info, &len);
230 if (err || !info.nr_map_ids)
234 jsonw_name(json_wtr, "map_ids");
235 jsonw_start_array(json_wtr);
236 for (i = 0; i < info.nr_map_ids; i++)
237 jsonw_uint(json_wtr, map_ids[i]);
238 jsonw_end_array(json_wtr);
241 for (i = 0; i < info.nr_map_ids; i++)
242 printf("%u%s", map_ids[i],
243 i == info.nr_map_ids - 1 ? "" : ",");
247 static void print_prog_json(struct bpf_prog_info *info, int fd)
251 jsonw_start_object(json_wtr);
252 jsonw_uint_field(json_wtr, "id", info->id);
253 if (info->type < ARRAY_SIZE(prog_type_name))
254 jsonw_string_field(json_wtr, "type",
255 prog_type_name[info->type]);
257 jsonw_uint_field(json_wtr, "type", info->type);
260 jsonw_string_field(json_wtr, "name", info->name);
262 jsonw_name(json_wtr, "tag");
263 jsonw_printf(json_wtr, "\"" BPF_TAG_FMT "\"",
264 info->tag[0], info->tag[1], info->tag[2], info->tag[3],
265 info->tag[4], info->tag[5], info->tag[6], info->tag[7]);
267 jsonw_bool_field(json_wtr, "gpl_compatible", info->gpl_compatible);
269 print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);
271 if (info->load_time) {
274 print_boot_time(info->load_time, buf, sizeof(buf));
276 /* Piggy back on load_time, since 0 uid is a valid one */
277 jsonw_name(json_wtr, "loaded_at");
278 jsonw_printf(json_wtr, "%s", buf);
279 jsonw_uint_field(json_wtr, "uid", info->created_by_uid);
282 jsonw_uint_field(json_wtr, "bytes_xlated", info->xlated_prog_len);
284 if (info->jited_prog_len) {
285 jsonw_bool_field(json_wtr, "jited", true);
286 jsonw_uint_field(json_wtr, "bytes_jited", info->jited_prog_len);
288 jsonw_bool_field(json_wtr, "jited", false);
291 memlock = get_fdinfo(fd, "memlock");
293 jsonw_int_field(json_wtr, "bytes_memlock", atoi(memlock));
296 if (info->nr_map_ids)
297 show_prog_maps(fd, info->nr_map_ids);
299 if (!hash_empty(prog_table.table)) {
300 struct pinned_obj *obj;
302 jsonw_name(json_wtr, "pinned");
303 jsonw_start_array(json_wtr);
304 hash_for_each_possible(prog_table.table, obj, hash, info->id) {
305 if (obj->id == info->id)
306 jsonw_string(json_wtr, obj->path);
308 jsonw_end_array(json_wtr);
311 jsonw_end_object(json_wtr);
314 static void print_prog_plain(struct bpf_prog_info *info, int fd)
318 printf("%u: ", info->id);
319 if (info->type < ARRAY_SIZE(prog_type_name))
320 printf("%s ", prog_type_name[info->type]);
322 printf("type %u ", info->type);
325 printf("name %s ", info->name);
328 fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
329 print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
330 printf("%s", info->gpl_compatible ? " gpl" : "");
333 if (info->load_time) {
336 print_boot_time(info->load_time, buf, sizeof(buf));
338 /* Piggy back on load_time, since 0 uid is a valid one */
339 printf("\tloaded_at %s uid %u\n", buf, info->created_by_uid);
342 printf("\txlated %uB", info->xlated_prog_len);
344 if (info->jited_prog_len)
345 printf(" jited %uB", info->jited_prog_len);
347 printf(" not jited");
349 memlock = get_fdinfo(fd, "memlock");
351 printf(" memlock %sB", memlock);
354 if (info->nr_map_ids)
355 show_prog_maps(fd, info->nr_map_ids);
357 if (!hash_empty(prog_table.table)) {
358 struct pinned_obj *obj;
361 hash_for_each_possible(prog_table.table, obj, hash, info->id) {
362 if (obj->id == info->id)
363 printf("\tpinned %s\n", obj->path);
370 static int show_prog(int fd)
372 struct bpf_prog_info info = {};
373 __u32 len = sizeof(info);
376 err = bpf_obj_get_info_by_fd(fd, &info, &len);
378 p_err("can't get prog info: %s", strerror(errno));
383 print_prog_json(&info, fd);
385 print_prog_plain(&info, fd);
390 static int do_show(int argc, char **argv)
397 build_pinned_obj_table(&prog_table, BPF_OBJ_PROG);
400 fd = prog_parse_fd(&argc, &argv);
404 return show_prog(fd);
411 jsonw_start_array(json_wtr);
413 err = bpf_prog_get_next_id(id, &id);
415 if (errno == ENOENT) {
419 p_err("can't get next program: %s%s", strerror(errno),
420 errno == EINVAL ? " -- kernel too old?" : "");
425 fd = bpf_prog_get_fd_by_id(id);
429 p_err("can't get prog by id (%u): %s",
430 id, strerror(errno));
442 jsonw_end_array(json_wtr);
447 static int do_dump(int argc, char **argv)
449 unsigned long *func_ksyms = NULL;
450 struct bpf_prog_info info = {};
451 unsigned int *func_lens = NULL;
452 const char *disasm_opt = NULL;
453 unsigned int nr_func_ksyms;
454 unsigned int nr_func_lens;
455 struct dump_data dd = {};
456 __u32 len = sizeof(info);
457 unsigned int buf_size;
458 char *filepath = NULL;
459 bool opcodes = false;
468 if (is_prefix(*argv, "jited")) {
469 member_len = &info.jited_prog_len;
470 member_ptr = &info.jited_prog_insns;
471 } else if (is_prefix(*argv, "xlated")) {
472 member_len = &info.xlated_prog_len;
473 member_ptr = &info.xlated_prog_insns;
475 p_err("expected 'xlated' or 'jited', got: %s", *argv);
483 fd = prog_parse_fd(&argc, &argv);
487 if (is_prefix(*argv, "file")) {
490 p_err("expected file path");
496 } else if (is_prefix(*argv, "opcodes")) {
499 } else if (is_prefix(*argv, "visual")) {
509 err = bpf_obj_get_info_by_fd(fd, &info, &len);
511 p_err("can't get prog info: %s", strerror(errno));
516 p_info("no instructions returned");
521 buf_size = *member_len;
523 buf = malloc(buf_size);
525 p_err("mem alloc failed");
530 nr_func_ksyms = info.nr_jited_ksyms;
532 func_ksyms = malloc(nr_func_ksyms * sizeof(__u64));
534 p_err("mem alloc failed");
540 nr_func_lens = info.nr_jited_func_lens;
542 func_lens = malloc(nr_func_lens * sizeof(__u32));
544 p_err("mem alloc failed");
550 memset(&info, 0, sizeof(info));
552 *member_ptr = ptr_to_u64(buf);
553 *member_len = buf_size;
554 info.jited_ksyms = ptr_to_u64(func_ksyms);
555 info.nr_jited_ksyms = nr_func_ksyms;
556 info.jited_func_lens = ptr_to_u64(func_lens);
557 info.nr_jited_func_lens = nr_func_lens;
559 err = bpf_obj_get_info_by_fd(fd, &info, &len);
562 p_err("can't get prog info: %s", strerror(errno));
566 if (*member_len > buf_size) {
567 p_err("too many instructions returned");
571 if (info.nr_jited_ksyms > nr_func_ksyms) {
572 p_err("too many addresses returned");
576 if (info.nr_jited_func_lens > nr_func_lens) {
577 p_err("too many values returned");
581 if ((member_len == &info.jited_prog_len &&
582 info.jited_prog_insns == 0) ||
583 (member_len == &info.xlated_prog_len &&
584 info.xlated_prog_insns == 0)) {
585 p_err("error retrieving insn dump: kernel.kptr_restrict set?");
590 fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
592 p_err("can't open file %s: %s", filepath,
597 n = write(fd, buf, *member_len);
599 if (n != *member_len) {
600 p_err("error writing output file: %s",
601 n < 0 ? strerror(errno) : "short write");
606 jsonw_null(json_wtr);
607 } else if (member_len == &info.jited_prog_len) {
608 const char *name = NULL;
611 name = ifindex_to_bfd_params(info.ifindex,
619 if (info.nr_jited_func_lens && info.jited_func_lens) {
620 struct kernel_sym *sym = NULL;
621 char sym_name[SYM_MAX_NAME];
622 unsigned char *img = buf;
627 if (info.nr_jited_ksyms) {
628 kernel_syms_load(&dd);
629 ksyms = (__u64 *) info.jited_ksyms;
633 jsonw_start_array(json_wtr);
635 lens = (__u32 *) info.jited_func_lens;
636 for (i = 0; i < info.nr_jited_func_lens; i++) {
638 sym = kernel_syms_search(&dd, ksyms[i]);
640 sprintf(sym_name, "%s", sym->name);
642 sprintf(sym_name, "0x%016llx", ksyms[i]);
644 strcpy(sym_name, "unknown");
648 jsonw_start_object(json_wtr);
649 jsonw_name(json_wtr, "name");
650 jsonw_string(json_wtr, sym_name);
651 jsonw_name(json_wtr, "insns");
653 printf("%s:\n", sym_name);
656 disasm_print_insn(img, lens[i], opcodes, name,
661 jsonw_end_object(json_wtr);
667 jsonw_end_array(json_wtr);
669 disasm_print_insn(buf, *member_len, opcodes, name,
674 jsonw_null(json_wtr);
676 dump_xlated_cfg(buf, *member_len);
678 kernel_syms_load(&dd);
679 dd.nr_jited_ksyms = info.nr_jited_ksyms;
680 dd.jited_ksyms = (__u64 *) info.jited_ksyms;
683 dump_xlated_json(&dd, buf, *member_len, opcodes);
685 dump_xlated_plain(&dd, buf, *member_len, opcodes);
686 kernel_syms_destroy(&dd);
701 static int do_pin(int argc, char **argv)
705 err = do_pin_any(argc, argv, bpf_prog_get_fd_by_id);
706 if (!err && json_output)
707 jsonw_null(json_wtr);
717 int map_replace_compar(const void *p1, const void *p2)
719 const struct map_replace *a = p1, *b = p2;
721 return a->idx - b->idx;
724 static int do_attach(int argc, char **argv)
726 enum bpf_attach_type attach_type;
727 int err, mapfd, progfd;
730 p_err("too few parameters for map attach");
734 progfd = prog_parse_fd(&argc, &argv);
738 attach_type = parse_attach_type(*argv);
739 if (attach_type == __MAX_BPF_ATTACH_TYPE) {
740 p_err("invalid attach type");
745 mapfd = map_parse_fd(&argc, &argv);
749 err = bpf_prog_attach(progfd, mapfd, attach_type, 0);
751 p_err("failed prog attach to map");
756 jsonw_null(json_wtr);
760 static int do_detach(int argc, char **argv)
762 enum bpf_attach_type attach_type;
763 int err, mapfd, progfd;
766 p_err("too few parameters for map detach");
770 progfd = prog_parse_fd(&argc, &argv);
774 attach_type = parse_attach_type(*argv);
775 if (attach_type == __MAX_BPF_ATTACH_TYPE) {
776 p_err("invalid attach type");
781 mapfd = map_parse_fd(&argc, &argv);
785 err = bpf_prog_detach2(progfd, mapfd, attach_type);
787 p_err("failed prog detach from map");
792 jsonw_null(json_wtr);
795 static int do_load(int argc, char **argv)
797 enum bpf_attach_type expected_attach_type;
798 struct bpf_object_open_attr attr = {
799 .prog_type = BPF_PROG_TYPE_UNSPEC,
801 struct map_replace *map_replace = NULL;
802 unsigned int old_map_fds = 0;
803 struct bpf_program *prog;
804 struct bpf_object *obj;
813 attr.file = GET_ARG();
817 if (is_prefix(*argv, "type")) {
822 if (attr.prog_type != BPF_PROG_TYPE_UNSPEC) {
823 p_err("program type already specified");
824 goto err_free_reuse_maps;
827 goto err_free_reuse_maps;
829 /* Put a '/' at the end of type to appease libbpf */
830 type = malloc(strlen(*argv) + 2);
832 p_err("mem alloc failed");
833 goto err_free_reuse_maps;
839 err = libbpf_prog_type_by_name(type, &attr.prog_type,
840 &expected_attach_type);
843 p_err("unknown program type '%s'", *argv);
844 goto err_free_reuse_maps;
847 } else if (is_prefix(*argv, "map")) {
854 goto err_free_reuse_maps;
856 if (is_prefix(*argv, "idx")) {
859 idx = strtoul(*argv, &endptr, 0);
861 p_err("can't parse %s as IDX", *argv);
862 goto err_free_reuse_maps;
865 } else if (is_prefix(*argv, "name")) {
871 p_err("expected 'idx' or 'name', got: '%s'?",
873 goto err_free_reuse_maps;
877 fd = map_parse_fd(&argc, &argv);
879 goto err_free_reuse_maps;
881 map_replace = reallocarray(map_replace, old_map_fds + 1,
882 sizeof(*map_replace));
884 p_err("mem alloc failed");
885 goto err_free_reuse_maps;
887 map_replace[old_map_fds].idx = idx;
888 map_replace[old_map_fds].name = name;
889 map_replace[old_map_fds].fd = fd;
891 } else if (is_prefix(*argv, "dev")) {
895 p_err("offload device already specified");
896 goto err_free_reuse_maps;
899 goto err_free_reuse_maps;
901 ifindex = if_nametoindex(*argv);
903 p_err("unrecognized netdevice '%s': %s",
904 *argv, strerror(errno));
905 goto err_free_reuse_maps;
909 p_err("expected no more arguments, 'type', 'map' or 'dev', got: '%s'?",
911 goto err_free_reuse_maps;
915 obj = __bpf_object__open_xattr(&attr, bpf_flags);
916 if (IS_ERR_OR_NULL(obj)) {
917 p_err("failed to open object file");
918 goto err_free_reuse_maps;
921 prog = bpf_program__next(NULL, obj);
923 p_err("object file doesn't contain any bpf program");
927 bpf_program__set_ifindex(prog, ifindex);
928 if (attr.prog_type == BPF_PROG_TYPE_UNSPEC) {
929 const char *sec_name = bpf_program__title(prog, false);
931 err = libbpf_prog_type_by_name(sec_name, &attr.prog_type,
932 &expected_attach_type);
934 p_err("failed to guess program type based on section name %s\n",
939 bpf_program__set_type(prog, attr.prog_type);
940 bpf_program__set_expected_attach_type(prog, expected_attach_type);
942 qsort(map_replace, old_map_fds, sizeof(*map_replace),
945 /* After the sort maps by name will be first on the list, because they
946 * have idx == -1. Resolve them.
949 while (j < old_map_fds && map_replace[j].name) {
951 bpf_map__for_each(map, obj) {
952 if (!strcmp(bpf_map__name(map), map_replace[j].name)) {
953 map_replace[j].idx = i;
958 if (map_replace[j].idx == -1) {
959 p_err("unable to find map '%s'", map_replace[j].name);
964 /* Resort if any names were resolved */
966 qsort(map_replace, old_map_fds, sizeof(*map_replace),
969 /* Set ifindex and name reuse */
972 bpf_map__for_each(map, obj) {
973 if (!bpf_map__is_offload_neutral(map))
974 bpf_map__set_ifindex(map, ifindex);
976 if (j < old_map_fds && idx == map_replace[j].idx) {
977 err = bpf_map__reuse_fd(map, map_replace[j++].fd);
979 p_err("unable to set up map reuse: %d", err);
983 /* Next reuse wants to apply to the same map */
984 if (j < old_map_fds && map_replace[j].idx == idx) {
985 p_err("replacement for map idx %d specified more than once",
993 if (j < old_map_fds) {
994 p_err("map idx '%d' not used", map_replace[j].idx);
998 err = bpf_object__load(obj);
1000 p_err("failed to load object file");
1004 if (do_pin_fd(bpf_program__fd(prog), pinfile))
1008 jsonw_null(json_wtr);
1010 bpf_object__close(obj);
1011 for (i = 0; i < old_map_fds; i++)
1012 close(map_replace[i].fd);
1018 bpf_object__close(obj);
1019 err_free_reuse_maps:
1020 for (i = 0; i < old_map_fds; i++)
1021 close(map_replace[i].fd);
1026 static int do_help(int argc, char **argv)
1029 jsonw_null(json_wtr);
1034 "Usage: %s %s { show | list } [PROG]\n"
1035 " %s %s dump xlated PROG [{ file FILE | opcodes | visual }]\n"
1036 " %s %s dump jited PROG [{ file FILE | opcodes }]\n"
1037 " %s %s pin PROG FILE\n"
1038 " %s %s load OBJ FILE [type TYPE] [dev NAME] \\\n"
1039 " [map { idx IDX | name NAME } MAP]\n"
1040 " %s %s attach PROG ATTACH_TYPE MAP\n"
1041 " %s %s detach PROG ATTACH_TYPE MAP\n"
1044 " " HELP_SPEC_MAP "\n"
1045 " " HELP_SPEC_PROGRAM "\n"
1046 " TYPE := { socket | kprobe | kretprobe | classifier | action |\n"
1047 " tracepoint | raw_tracepoint | xdp | perf_event | cgroup/skb |\n"
1048 " cgroup/sock | cgroup/dev | lwt_in | lwt_out | lwt_xmit |\n"
1049 " lwt_seg6local | sockops | sk_skb | sk_msg | lirc_mode2 |\n"
1050 " cgroup/bind4 | cgroup/bind6 | cgroup/post_bind4 |\n"
1051 " cgroup/post_bind6 | cgroup/connect4 | cgroup/connect6 |\n"
1052 " cgroup/sendmsg4 | cgroup/sendmsg6 }\n"
1053 " ATTACH_TYPE := { msg_verdict | skb_verdict | skb_parse }\n"
1054 " " HELP_SPEC_OPTIONS "\n"
1056 bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
1057 bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
1058 bin_name, argv[-2], bin_name, argv[-2]);
1063 static const struct cmd cmds[] = {
1064 { "show", do_show },
1065 { "list", do_show },
1066 { "help", do_help },
1067 { "dump", do_dump },
1069 { "load", do_load },
1070 { "attach", do_attach },
1071 { "detach", do_detach },
1075 int do_prog(int argc, char **argv)
1077 return cmd_select(cmds, argc, argv, do_help);