lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 30 Jul 2020 14:14:46 -0700 From: Andrii Nakryiko <andrii.nakryiko@...il.com> To: Song Liu <songliubraving@...com> Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Alexei Starovoitov <ast@...com>, "daniel@...earbox.net" <daniel@...earbox.net>, Kernel Team <Kernel-team@...com>, Toke Høiland-Jørgensen <toke@...hat.com> Subject: Re: [PATCH bpf-next 4/5] tools/bpftool: add `link detach` subcommand On Thu, Jul 30, 2020 at 2:02 PM Song Liu <songliubraving@...com> wrote: > > > > > On Jul 29, 2020, at 4:05 PM, Andrii Nakryiko <andriin@...com> wrote: > > > > Add ability to force-detach BPF link. Also add missing error message, if > > specified link ID is wrong. > > > > Signed-off-by: Andrii Nakryiko <andriin@...com> > > Acked-by: Song Liu <songliubraving@...com> > > With two nitpicks below. > > [...] > > > static int link_parse_fd(int *argc, char ***argv) > > { > > + int fd; > > + > > if (is_prefix(**argv, "id")) { > > unsigned int id; > > char *endptr; > > @@ -35,7 +37,10 @@ static int link_parse_fd(int *argc, char ***argv) > > } > > NEXT_ARGP(); > > > > - return bpf_link_get_fd_by_id(id); > > + fd = bpf_link_get_fd_by_id(id); > > + if (fd < 0) > > + p_err("failed to get link with ID %d: %d", id, -errno); > > How about we print strerror(errno) to match the rest of link.c? sure, will do, was lazy :) > > [...] > > > +static int do_detach(int argc, char **argv) > > +{ > > + int err, fd; > > + > > + if (argc != 2) > > + return BAD_ARG(); > > + > > + fd = link_parse_fd(&argc, &argv); > > + if (fd < 0) > > + return 1; > > + > > + err = bpf_link_detach(fd); > > + if (err) > > + err = -errno; > > + close(fd); > > + if (err) { > > + p_err("failed link detach: %d", err); > > And strerror(err) here. > >
Powered by blists - more mailing lists