<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/bpf/bpftool/main.c, branch linux-4.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-03-02T08:46:41Z</updated>
<entry>
<title>tools: bpftool: add support for quotations in batch files</title>
<updated>2018-03-02T08:46:41Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2018-03-02T04:20:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=668da745af3c29d5742238ef278a1b2055c97e51'/>
<id>urn:sha1:668da745af3c29d5742238ef278a1b2055c97e51</id>
<content type='text'>
Improve argument parsing from batch input files in order to support
arguments enclosed between single (') or double quotes ("). For example,
this command can now be parsed in batch mode:

    bpftool prog dump xlated id 1337 file "/tmp/my file with spaces"

The function responsible for parsing command arguments is copied from
its counterpart in lib/utils.c in iproute2 package.

Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: read from stdin when batch file name is "-"</title>
<updated>2018-03-02T08:46:41Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2018-03-02T04:20:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=416656bbaa57a5be75514498491b7e24c58537c1'/>
<id>urn:sha1:416656bbaa57a5be75514498491b7e24c58537c1</id>
<content type='text'>
Make bpftool read its command list from standard input when the name if
the input file is a single dash.

Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: support continuation lines in batch files</title>
<updated>2018-03-02T08:46:41Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2018-03-02T04:20:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=65d538dde625d93359ca4e33d2311f8598f423a6'/>
<id>urn:sha1:65d538dde625d93359ca4e33d2311f8598f423a6</id>
<content type='text'>
Add support for continuation lines, such as in the following example:

    prog show
    prog dump xlated \
        id 1337 opcodes

This patch is based after the code for support for continuation lines
from file lib/utils.c from package iproute2.

"Lines" in error messages are renamed as "commands", as we count the
number of commands (but we ignore empty lines, comments, and do not add
continuation lines to the count).

Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: support comments in batch files</title>
<updated>2018-03-02T08:46:41Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2018-03-02T04:20:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=06cc7fe7c2951e64cd5e73ea447791c7e6bc3852'/>
<id>urn:sha1:06cc7fe7c2951e64cd5e73ea447791c7e6bc3852</id>
<content type='text'>
Replace '#' by '\0' in commands read from batch files in order to avoid
processing the remaining part of the line, thus allowing users to use
comments in the files.

Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: preserve JSON output on errors on batch file parsing</title>
<updated>2018-02-15T09:01:05Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2018-02-15T06:42:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9be6d411b0c473d31f756993b8b41bb16b0679c1'/>
<id>urn:sha1:9be6d411b0c473d31f756993b8b41bb16b0679c1</id>
<content type='text'>
Before this patch, perror() function is used in some cases when bpftool
fails to parse its input file in batch mode. This function does not
integrate well with the rest of the output when JSON is used, so we
replace it by something that is compliant.

Most calls to perror() had already been replaced in a previous patch,
this one is a leftover.

Fixes: d319c8e101c5 ("tools: bpftool: preserve JSON output on errors on batch file parsing")
Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools/bpftool: use version from the kernel source tree</title>
<updated>2017-12-30T00:07:36Z</updated>
<author>
<name>Roman Gushchin</name>
</author>
<published>2017-12-27T19:16:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4bfe3bd3cc351efd1d51b3258b060e9445533888'/>
<id>urn:sha1:4bfe3bd3cc351efd1d51b3258b060e9445533888</id>
<content type='text'>
Bpftool determines it's own version based on the kernel
version, which is picked from the linux/version.h header.

It's strange to use the version of the installed kernel
headers, and makes much more sense to use the version
of the actual source tree, where bpftool sources are.

Fix this by building kernelversion target and use
the resulting string as bpftool version.

Example:
before:

$ bpftool version
bpftool v4.14.6

after:
$ bpftool version
bpftool v4.15.0-rc3

$bpftool version --json
{"version":"4.15.0-rc3"}

Signed-off-by: Roman Gushchin &lt;guro@fb.com&gt;
Reviewed-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Cc: Alexei Starovoitov &lt;ast@kernel.org&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>bpftool: implement cgroup bpf operations</title>
<updated>2017-12-14T12:37:13Z</updated>
<author>
<name>Roman Gushchin</name>
</author>
<published>2017-12-13T15:18:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5ccda64d38cc2800e3c7fab42a2fea46d44693e9'/>
<id>urn:sha1:5ccda64d38cc2800e3c7fab42a2fea46d44693e9</id>
<content type='text'>
This patch adds basic cgroup bpf operations to bpftool:
cgroup list, attach and detach commands.

Usage is described in the corresponding man pages,
and examples are provided.

Syntax:
$ bpftool cgroup list CGROUP
$ bpftool cgroup attach CGROUP ATTACH_TYPE PROG [ATTACH_FLAGS]
$ bpftool cgroup detach CGROUP ATTACH_TYPE PROG

Signed-off-by: Roman Gushchin &lt;guro@fb.com&gt;
Cc: Alexei Starovoitov &lt;ast@kernel.org&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Cc: Martin KaFai Lau &lt;kafai@fb.com&gt;
Cc: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Reviewed-by: David Ahern &lt;dsahern@gmail.com&gt;
Reviewed-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: make error message from getopt_long() JSON-friendly</title>
<updated>2017-11-30T01:09:29Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2017-11-29T01:44:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=146882a37da7aa566c7ec088b42c6495d769f2ba'/>
<id>urn:sha1:146882a37da7aa566c7ec088b42c6495d769f2ba</id>
<content type='text'>
If `getopt_long()` meets an unknown option, it prints its own error
message to standard error output. While this does not strictly break
JSON output, it is the only case bpftool prints something to standard
error output if JSON output is required. All other errors are printed on
standard output as JSON objects, so that an external program does not
have to parse stderr.

This is changed by setting the global variable `opterr` to 0.
Furthermore, p_err() is used to reproduce the error message in a more
JSON-friendly way, so that users still get to know what the erroneous
option is.

Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: clean up the JSON writer before exiting in usage()</title>
<updated>2017-11-30T01:09:29Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2017-11-29T01:44:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7868620a3c15dbc661fb5d849de403ac04624c50'/>
<id>urn:sha1:7868620a3c15dbc661fb5d849de403ac04624c50</id>
<content type='text'>
The writer is cleaned at the end of the main function, but not if the
program exits sooner in usage(). Let's keep it clean and destroy the
writer before exiting.

Destruction and actual call to exit() are moved to another function so
that clean exit can also be performed without printing usage() hints.

Fixes: d35efba99d92 ("tools: bpftool: introduce --json and --pretty options")
Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>tools: bpftool: fix crash on bad parameters with JSON</title>
<updated>2017-11-30T01:09:29Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2017-11-29T01:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b85c2d4508563f4bb1de0d971ed02fea0d0d757'/>
<id>urn:sha1:9b85c2d4508563f4bb1de0d971ed02fea0d0d757</id>
<content type='text'>
If bad or unrecognised parameters are specified after JSON output is
requested, `usage()` will try to output null JSON object before the
writer is created.

To prevent this, create the writer as soon as the `--json` option is
parsed.

Fixes: 004b45c0e51a ("tools: bpftool: provide JSON output for all possible commands")
Reported-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Quentin Monnet &lt;quentin.monnet@netronome.com&gt;
Acked-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
</feed>
