1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 // Copyright (C) 2018 Facebook
14 #include <bpf/libbpf.h>
16 #include <linux/rtnetlink.h>
17 #include <linux/socket.h>
18 #include <linux/tc_act/tc_bpf.h>
19 #include <sys/socket.h>
21 #include <sys/types.h>
23 #include "bpf/nlattr.h"
25 #include "netlink_dumper.h"
28 #define SOL_NETLINK 270
31 struct ip_devname_ifindex {
37 struct ip_devname_ifindex *devices;
43 struct tc_kind_handle {
49 struct tc_kind_handle *handle_array;
61 struct bpf_attach_info {
62 __u32 flow_dissector_id;
65 enum net_attach_type {
67 NET_ATTACH_TYPE_XDP_GENERIC,
68 NET_ATTACH_TYPE_XDP_DRIVER,
69 NET_ATTACH_TYPE_XDP_OFFLOAD,
72 static const char * const attach_type_strings[] = {
73 [NET_ATTACH_TYPE_XDP] = "xdp",
74 [NET_ATTACH_TYPE_XDP_GENERIC] = "xdpgeneric",
75 [NET_ATTACH_TYPE_XDP_DRIVER] = "xdpdrv",
76 [NET_ATTACH_TYPE_XDP_OFFLOAD] = "xdpoffload",
79 static const char * const attach_loc_strings[] = {
80 [BPF_TCX_INGRESS] = "tcx/ingress",
81 [BPF_TCX_EGRESS] = "tcx/egress",
84 const size_t net_attach_type_size = ARRAY_SIZE(attach_type_strings);
86 static enum net_attach_type parse_attach_type(const char *str)
88 enum net_attach_type type;
90 for (type = 0; type < net_attach_type_size; type++) {
91 if (attach_type_strings[type] &&
92 is_prefix(str, attach_type_strings[type]))
96 return net_attach_type_size;
99 typedef int (*dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb);
101 typedef int (*__dump_nlmsg_t)(struct nlmsghdr *nlmsg, dump_nlmsg_t, void *cookie);
103 static int netlink_open(__u32 *nl_pid)
105 struct sockaddr_nl sa;
110 memset(&sa, 0, sizeof(sa));
111 sa.nl_family = AF_NETLINK;
113 sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
117 if (setsockopt(sock, SOL_NETLINK, NETLINK_EXT_ACK,
118 &one, sizeof(one)) < 0) {
119 p_err("Netlink error reporting not supported");
122 if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
127 addrlen = sizeof(sa);
128 if (getsockname(sock, (struct sockaddr *)&sa, &addrlen) < 0) {
133 if (addrlen != sizeof(sa)) {
134 ret = -LIBBPF_ERRNO__INTERNAL;
146 static int netlink_recv(int sock, __u32 nl_pid, __u32 seq,
147 __dump_nlmsg_t _fn, dump_nlmsg_t fn,
150 bool multipart = true;
151 struct nlmsgerr *err;
158 len = recv(sock, buf, sizeof(buf), 0);
167 for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, (unsigned int)len);
168 nh = NLMSG_NEXT(nh, len)) {
169 if (nh->nlmsg_pid != nl_pid) {
170 ret = -LIBBPF_ERRNO__WRNGPID;
173 if (nh->nlmsg_seq != seq) {
174 ret = -LIBBPF_ERRNO__INVSEQ;
177 if (nh->nlmsg_flags & NLM_F_MULTI)
179 switch (nh->nlmsg_type) {
181 err = (struct nlmsgerr *)NLMSG_DATA(nh);
185 libbpf_nla_dump_errormsg(nh);
193 ret = _fn(nh, fn, cookie);
204 static int __dump_class_nlmsg(struct nlmsghdr *nlh,
205 dump_nlmsg_t dump_class_nlmsg,
208 struct nlattr *tb[TCA_MAX + 1], *attr;
209 struct tcmsg *t = NLMSG_DATA(nlh);
212 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
213 attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
214 if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
215 return -LIBBPF_ERRNO__NLPARSE;
217 return dump_class_nlmsg(cookie, t, tb);
220 static int netlink_get_class(int sock, unsigned int nl_pid, int ifindex,
221 dump_nlmsg_t dump_class_nlmsg, void *cookie)
227 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
228 .nlh.nlmsg_type = RTM_GETTCLASS,
229 .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
230 .t.tcm_family = AF_UNSPEC,
231 .t.tcm_ifindex = ifindex,
233 int seq = time(NULL);
235 req.nlh.nlmsg_seq = seq;
236 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
239 return netlink_recv(sock, nl_pid, seq, __dump_class_nlmsg,
240 dump_class_nlmsg, cookie);
243 static int __dump_qdisc_nlmsg(struct nlmsghdr *nlh,
244 dump_nlmsg_t dump_qdisc_nlmsg,
247 struct nlattr *tb[TCA_MAX + 1], *attr;
248 struct tcmsg *t = NLMSG_DATA(nlh);
251 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
252 attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
253 if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
254 return -LIBBPF_ERRNO__NLPARSE;
256 return dump_qdisc_nlmsg(cookie, t, tb);
259 static int netlink_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
260 dump_nlmsg_t dump_qdisc_nlmsg, void *cookie)
266 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
267 .nlh.nlmsg_type = RTM_GETQDISC,
268 .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
269 .t.tcm_family = AF_UNSPEC,
270 .t.tcm_ifindex = ifindex,
272 int seq = time(NULL);
274 req.nlh.nlmsg_seq = seq;
275 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
278 return netlink_recv(sock, nl_pid, seq, __dump_qdisc_nlmsg,
279 dump_qdisc_nlmsg, cookie);
282 static int __dump_filter_nlmsg(struct nlmsghdr *nlh,
283 dump_nlmsg_t dump_filter_nlmsg,
286 struct nlattr *tb[TCA_MAX + 1], *attr;
287 struct tcmsg *t = NLMSG_DATA(nlh);
290 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
291 attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
292 if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
293 return -LIBBPF_ERRNO__NLPARSE;
295 return dump_filter_nlmsg(cookie, t, tb);
298 static int netlink_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle,
299 dump_nlmsg_t dump_filter_nlmsg, void *cookie)
305 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
306 .nlh.nlmsg_type = RTM_GETTFILTER,
307 .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
308 .t.tcm_family = AF_UNSPEC,
309 .t.tcm_ifindex = ifindex,
310 .t.tcm_parent = handle,
312 int seq = time(NULL);
314 req.nlh.nlmsg_seq = seq;
315 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
318 return netlink_recv(sock, nl_pid, seq, __dump_filter_nlmsg,
319 dump_filter_nlmsg, cookie);
322 static int __dump_link_nlmsg(struct nlmsghdr *nlh,
323 dump_nlmsg_t dump_link_nlmsg, void *cookie)
325 struct nlattr *tb[IFLA_MAX + 1], *attr;
326 struct ifinfomsg *ifi = NLMSG_DATA(nlh);
329 len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi));
330 attr = (struct nlattr *) ((void *) ifi + NLMSG_ALIGN(sizeof(*ifi)));
331 if (libbpf_nla_parse(tb, IFLA_MAX, attr, len, NULL) != 0)
332 return -LIBBPF_ERRNO__NLPARSE;
334 return dump_link_nlmsg(cookie, ifi, tb);
337 static int netlink_get_link(int sock, unsigned int nl_pid,
338 dump_nlmsg_t dump_link_nlmsg, void *cookie)
342 struct ifinfomsg ifm;
344 .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
345 .nlh.nlmsg_type = RTM_GETLINK,
346 .nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
347 .ifm.ifi_family = AF_PACKET,
349 int seq = time(NULL);
351 req.nlh.nlmsg_seq = seq;
352 if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
355 return netlink_recv(sock, nl_pid, seq, __dump_link_nlmsg,
356 dump_link_nlmsg, cookie);
359 static int dump_link_nlmsg(void *cookie, void *msg, struct nlattr **tb)
361 struct bpf_netdev_t *netinfo = cookie;
362 struct ifinfomsg *ifinfo = msg;
364 if (netinfo->filter_idx > 0 && netinfo->filter_idx != ifinfo->ifi_index)
367 if (netinfo->used_len == netinfo->array_len) {
368 netinfo->devices = realloc(netinfo->devices,
369 (netinfo->array_len + 16) *
370 sizeof(struct ip_devname_ifindex));
371 if (!netinfo->devices)
374 netinfo->array_len += 16;
376 netinfo->devices[netinfo->used_len].ifindex = ifinfo->ifi_index;
377 snprintf(netinfo->devices[netinfo->used_len].devname,
378 sizeof(netinfo->devices[netinfo->used_len].devname),
381 ? libbpf_nla_getattr_str(tb[IFLA_IFNAME])
385 return do_xdp_dump(ifinfo, tb);
388 static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb)
390 struct bpf_tcinfo_t *tcinfo = cookie;
391 struct tcmsg *info = msg;
393 if (tcinfo->is_qdisc) {
394 /* skip clsact qdisc */
396 strcmp(libbpf_nla_data(tb[TCA_KIND]), "clsact") == 0)
398 if (info->tcm_handle == 0)
402 if (tcinfo->used_len == tcinfo->array_len) {
403 tcinfo->handle_array = realloc(tcinfo->handle_array,
404 (tcinfo->array_len + 16) * sizeof(struct tc_kind_handle));
405 if (!tcinfo->handle_array)
408 tcinfo->array_len += 16;
410 tcinfo->handle_array[tcinfo->used_len].handle = info->tcm_handle;
411 snprintf(tcinfo->handle_array[tcinfo->used_len].kind,
412 sizeof(tcinfo->handle_array[tcinfo->used_len].kind),
415 ? libbpf_nla_getattr_str(tb[TCA_KIND])
422 static int dump_filter_nlmsg(void *cookie, void *msg, struct nlattr **tb)
424 const struct bpf_filter_t *filter_info = cookie;
426 return do_filter_dump((struct tcmsg *)msg, tb, filter_info->kind,
427 filter_info->devname, filter_info->ifindex);
430 static int __show_dev_tc_bpf_name(__u32 id, char *name, size_t len)
432 struct bpf_prog_info info = {};
433 __u32 ilen = sizeof(info);
436 fd = bpf_prog_get_fd_by_id(id);
439 ret = bpf_obj_get_info_by_fd(fd, &info, &ilen);
444 get_prog_full_name(&info, fd, name, len);
452 static void __show_dev_tc_bpf(const struct ip_devname_ifindex *dev,
453 const enum bpf_attach_type loc)
455 __u32 prog_flags[64] = {}, link_flags[64] = {}, i, j;
456 __u32 prog_ids[64] = {}, link_ids[64] = {};
457 LIBBPF_OPTS(bpf_prog_query_opts, optq);
458 char prog_name[MAX_PROG_FULL_NAME];
461 optq.prog_ids = prog_ids;
462 optq.prog_attach_flags = prog_flags;
463 optq.link_ids = link_ids;
464 optq.link_attach_flags = link_flags;
465 optq.count = ARRAY_SIZE(prog_ids);
467 ret = bpf_prog_query_opts(dev->ifindex, loc, &optq);
470 for (i = 0; i < optq.count; i++) {
472 NET_DUMP_STR("devname", "%s", dev->devname);
473 NET_DUMP_UINT("ifindex", "(%u)", dev->ifindex);
474 NET_DUMP_STR("kind", " %s", attach_loc_strings[loc]);
475 ret = __show_dev_tc_bpf_name(prog_ids[i], prog_name,
478 NET_DUMP_STR("name", " %s", prog_name);
479 NET_DUMP_UINT("prog_id", " prog_id %u ", prog_ids[i]);
480 if (prog_flags[i] || json_output) {
481 NET_START_ARRAY("prog_flags", "%s ");
482 for (j = 0; prog_flags[i] && j < 32; j++) {
483 if (!(prog_flags[i] & (1 << j)))
485 NET_DUMP_UINT_ONLY(1 << j);
489 if (link_ids[i] || json_output) {
490 NET_DUMP_UINT("link_id", "link_id %u ", link_ids[i]);
491 if (link_flags[i] || json_output) {
492 NET_START_ARRAY("link_flags", "%s ");
493 for (j = 0; link_flags[i] && j < 32; j++) {
494 if (!(link_flags[i] & (1 << j)))
496 NET_DUMP_UINT_ONLY(1 << j);
501 NET_END_OBJECT_FINAL;
505 static void show_dev_tc_bpf(struct ip_devname_ifindex *dev)
507 __show_dev_tc_bpf(dev, BPF_TCX_INGRESS);
508 __show_dev_tc_bpf(dev, BPF_TCX_EGRESS);
511 static int show_dev_tc_bpf_classic(int sock, unsigned int nl_pid,
512 struct ip_devname_ifindex *dev)
514 struct bpf_filter_t filter_info;
515 struct bpf_tcinfo_t tcinfo;
516 int i, handle, ret = 0;
518 tcinfo.handle_array = NULL;
520 tcinfo.array_len = 0;
522 tcinfo.is_qdisc = false;
523 ret = netlink_get_class(sock, nl_pid, dev->ifindex,
524 dump_class_qdisc_nlmsg, &tcinfo);
528 tcinfo.is_qdisc = true;
529 ret = netlink_get_qdisc(sock, nl_pid, dev->ifindex,
530 dump_class_qdisc_nlmsg, &tcinfo);
534 filter_info.devname = dev->devname;
535 filter_info.ifindex = dev->ifindex;
536 for (i = 0; i < tcinfo.used_len; i++) {
537 filter_info.kind = tcinfo.handle_array[i].kind;
538 ret = netlink_get_filter(sock, nl_pid, dev->ifindex,
539 tcinfo.handle_array[i].handle,
540 dump_filter_nlmsg, &filter_info);
545 /* root, ingress and egress handle */
547 filter_info.kind = "root";
548 ret = netlink_get_filter(sock, nl_pid, dev->ifindex, handle,
549 dump_filter_nlmsg, &filter_info);
553 handle = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS);
554 filter_info.kind = "clsact/ingress";
555 ret = netlink_get_filter(sock, nl_pid, dev->ifindex, handle,
556 dump_filter_nlmsg, &filter_info);
560 handle = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS);
561 filter_info.kind = "clsact/egress";
562 ret = netlink_get_filter(sock, nl_pid, dev->ifindex, handle,
563 dump_filter_nlmsg, &filter_info);
568 free(tcinfo.handle_array);
572 static int query_flow_dissector(struct bpf_attach_info *attach_info)
580 fd = open("/proc/self/ns/net", O_RDONLY);
582 p_err("can't open /proc/self/ns/net: %s",
586 prog_cnt = ARRAY_SIZE(prog_ids);
587 err = bpf_prog_query(fd, BPF_FLOW_DISSECTOR, 0,
588 &attach_flags, prog_ids, &prog_cnt);
591 if (errno == EINVAL) {
592 /* Older kernel's don't support querying
593 * flow dissector programs.
598 p_err("can't query prog: %s", strerror(errno));
603 attach_info->flow_dissector_id = prog_ids[0];
608 static int net_parse_dev(int *argc, char ***argv)
612 if (is_prefix(**argv, "dev")) {
615 ifindex = if_nametoindex(**argv);
617 p_err("invalid devname %s", **argv);
621 p_err("expected 'dev', got: '%s'?", **argv);
628 static int do_attach_detach_xdp(int progfd, enum net_attach_type attach_type,
629 int ifindex, bool overwrite)
634 flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
635 if (attach_type == NET_ATTACH_TYPE_XDP_GENERIC)
636 flags |= XDP_FLAGS_SKB_MODE;
637 if (attach_type == NET_ATTACH_TYPE_XDP_DRIVER)
638 flags |= XDP_FLAGS_DRV_MODE;
639 if (attach_type == NET_ATTACH_TYPE_XDP_OFFLOAD)
640 flags |= XDP_FLAGS_HW_MODE;
642 return bpf_xdp_attach(ifindex, progfd, flags, NULL);
645 static int do_attach(int argc, char **argv)
647 enum net_attach_type attach_type;
648 int progfd, ifindex, err = 0;
649 bool overwrite = false;
651 /* parse attach args */
655 attach_type = parse_attach_type(*argv);
656 if (attach_type == net_attach_type_size) {
657 p_err("invalid net attach/detach type: %s", *argv);
662 progfd = prog_parse_fd(&argc, &argv);
666 ifindex = net_parse_dev(&argc, &argv);
673 if (is_prefix(*argv, "overwrite")) {
676 p_err("expected 'overwrite', got: '%s'?", *argv);
682 /* attach xdp prog */
683 if (is_prefix("xdp", attach_type_strings[attach_type]))
684 err = do_attach_detach_xdp(progfd, attach_type, ifindex,
687 p_err("interface %s attach failed: %s",
688 attach_type_strings[attach_type], strerror(-err));
693 jsonw_null(json_wtr);
699 static int do_detach(int argc, char **argv)
701 enum net_attach_type attach_type;
702 int progfd, ifindex, err = 0;
704 /* parse detach args */
708 attach_type = parse_attach_type(*argv);
709 if (attach_type == net_attach_type_size) {
710 p_err("invalid net attach/detach type: %s", *argv);
715 ifindex = net_parse_dev(&argc, &argv);
719 /* detach xdp prog */
721 if (is_prefix("xdp", attach_type_strings[attach_type]))
722 err = do_attach_detach_xdp(progfd, attach_type, ifindex, NULL);
725 p_err("interface %s detach failed: %s",
726 attach_type_strings[attach_type], strerror(-err));
731 jsonw_null(json_wtr);
736 static int netfilter_link_compar(const void *a, const void *b)
738 const struct bpf_link_info *nfa = a;
739 const struct bpf_link_info *nfb = b;
742 delta = nfa->netfilter.pf - nfb->netfilter.pf;
746 delta = nfa->netfilter.hooknum - nfb->netfilter.hooknum;
750 if (nfa->netfilter.priority < nfb->netfilter.priority)
752 if (nfa->netfilter.priority > nfb->netfilter.priority)
755 return nfa->netfilter.flags - nfb->netfilter.flags;
758 static void show_link_netfilter(void)
760 unsigned int nf_link_len = 0, nf_link_count = 0;
761 struct bpf_link_info *nf_link_info = NULL;
765 struct bpf_link_info info;
769 err = bpf_link_get_next_id(id, &id);
773 p_err("can't get next link: %s (id %d)", strerror(errno), id);
777 fd = bpf_link_get_fd_by_id(id);
779 p_err("can't get link by id (%u): %s", id, strerror(errno));
783 memset(&info, 0, sizeof(info));
786 err = bpf_link_get_info_by_fd(fd, &info, &len);
791 p_err("can't get link info for fd %d: %s", fd, strerror(errno));
795 if (info.type != BPF_LINK_TYPE_NETFILTER)
798 if (nf_link_count >= nf_link_len) {
799 static const unsigned int max_link_count = INT_MAX / sizeof(info);
800 struct bpf_link_info *expand;
802 if (nf_link_count > max_link_count) {
803 p_err("cannot handle more than %u links\n", max_link_count);
809 expand = realloc(nf_link_info, nf_link_len * sizeof(info));
811 p_err("realloc: %s", strerror(errno));
815 nf_link_info = expand;
818 nf_link_info[nf_link_count] = info;
822 qsort(nf_link_info, nf_link_count, sizeof(*nf_link_info), netfilter_link_compar);
824 for (id = 0; id < nf_link_count; id++) {
827 netfilter_dump_json(&nf_link_info[id], json_wtr);
829 netfilter_dump_plain(&nf_link_info[id]);
831 NET_DUMP_UINT("id", " prog_id %u", nf_link_info[id].prog_id);
838 static int do_show(int argc, char **argv)
840 struct bpf_attach_info attach_info = {};
841 int i, sock, ret, filter_idx = -1;
842 struct bpf_netdev_t dev_array;
843 unsigned int nl_pid = 0;
847 filter_idx = net_parse_dev(&argc, &argv);
850 } else if (argc != 0) {
854 ret = query_flow_dissector(&attach_info);
858 sock = netlink_open(&nl_pid);
860 fprintf(stderr, "failed to open netlink sock\n");
864 dev_array.devices = NULL;
865 dev_array.used_len = 0;
866 dev_array.array_len = 0;
867 dev_array.filter_idx = filter_idx;
870 jsonw_start_array(json_wtr);
872 NET_START_ARRAY("xdp", "%s:\n");
873 ret = netlink_get_link(sock, nl_pid, dump_link_nlmsg, &dev_array);
877 NET_START_ARRAY("tc", "%s:\n");
878 for (i = 0; i < dev_array.used_len; i++) {
879 show_dev_tc_bpf(&dev_array.devices[i]);
880 ret = show_dev_tc_bpf_classic(sock, nl_pid,
881 &dev_array.devices[i]);
888 NET_START_ARRAY("flow_dissector", "%s:\n");
889 if (attach_info.flow_dissector_id > 0)
890 NET_DUMP_UINT("id", "id %u", attach_info.flow_dissector_id);
893 NET_START_ARRAY("netfilter", "%s:\n");
894 show_link_netfilter();
899 jsonw_end_array(json_wtr);
903 jsonw_null(json_wtr);
904 libbpf_strerror(ret, err_buf, sizeof(err_buf));
905 fprintf(stderr, "Error: %s\n", err_buf);
907 free(dev_array.devices);
912 static int do_help(int argc, char **argv)
915 jsonw_null(json_wtr);
920 "Usage: %1$s %2$s { show | list } [dev <devname>]\n"
921 " %1$s %2$s attach ATTACH_TYPE PROG dev <devname> [ overwrite ]\n"
922 " %1$s %2$s detach ATTACH_TYPE dev <devname>\n"
925 " " HELP_SPEC_PROGRAM "\n"
926 " ATTACH_TYPE := { xdp | xdpgeneric | xdpdrv | xdpoffload }\n"
927 " " HELP_SPEC_OPTIONS " }\n"
929 "Note: Only xdp, tcx, tc, flow_dissector and netfilter attachments\n"
930 " are currently supported.\n"
931 " For progs attached to cgroups, use \"bpftool cgroup\"\n"
932 " to dump program attachments. For program types\n"
933 " sk_{filter,skb,msg,reuseport} and lwt/seg6, please\n"
934 " consult iproute2.\n"
941 static const struct cmd cmds[] = {
944 { "attach", do_attach },
945 { "detach", do_detach },
950 int do_net(int argc, char **argv)
952 return cmd_select(cmds, argc, argv, do_help);