From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Paul Chaignon <paul.chaignon@orange.com>
Cc: bpf@vger.kernel.org,
Quentin Monnet <quentin.monnet@netronome.com>,
paul.chaignon@gmail.com, netdev@vger.kernel.org,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>
Subject: Re: [PATCH bpf-next 2/3] bpftool: match programs by name
Date: Fri, 13 Dec 2019 09:56:59 -0800 [thread overview]
Message-ID: <20191213095659.2782ca57@cakuba.netronome.com> (raw)
In-Reply-To: <20191213124038.GB6538@Omicron>
On Fri, 13 Dec 2019 13:40:38 +0100, Paul Chaignon wrote:
> > > @@ -176,7 +177,20 @@ prog_parse_fds(int *argc, char ***argv, int *fds)
> > > }
> > > NEXT_ARGP();
> > >
> > > - return prog_fd_by_tag(tag, fds);
> > > + return prog_fd_by_nametag(tag, fds, true);
> > > + } else if (is_prefix(**argv, "name")) {
> > > + char *name;
> > > +
> > > + NEXT_ARGP();
> > > +
> > > + name = **argv;
> > > + if (strlen(name) > BPF_OBJ_NAME_LEN - 1) {
> >
> > Is this needed? strncmp will simply never match, is it preferred to
> > hard error?
>
> I tried to follow the fail-early pattern of lookups by tag above.
Right although tag does a scanf and if we didn't scan all letters
we'd use uninit memory.
> I do like that there's a different error message for a longer than
> expected name. Since libbpf silently truncates names, typing a
> longer name is not uncommon.
Ugh, I didn't realize libbpf truncates names. Okay, let's keep the
error for now so we can switch to truncation if users complain.
next prev parent reply other threads:[~2019-12-13 20:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 16:05 [PATCH bpf-next 0/3] bpftool: match programs and maps by names Paul Chaignon
2019-12-10 16:06 ` [PATCH bpf-next 1/3] bpftool: match several programs with same tag Paul Chaignon
2019-12-10 17:29 ` Quentin Monnet
2019-12-13 18:10 ` Paul Chaignon
2019-12-10 20:36 ` Jakub Kicinski
2019-12-13 12:39 ` Paul Chaignon
2019-12-10 16:06 ` [PATCH bpf-next 2/3] bpftool: match programs by name Paul Chaignon
2019-12-10 17:29 ` Quentin Monnet
2019-12-10 21:04 ` Jakub Kicinski
2019-12-13 12:40 ` Paul Chaignon
2019-12-13 17:56 ` Jakub Kicinski [this message]
2019-12-10 16:06 ` [PATCH bpf-next 3/3] bpftool: match maps " Paul Chaignon
2019-12-10 17:29 ` Quentin Monnet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191213095659.2782ca57@cakuba.netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=paul.chaignon@gmail.com \
--cc=paul.chaignon@orange.com \
--cc=quentin.monnet@netronome.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).