]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: add error reporting in XDP
authorEric Leblond <eric@regit.org>
Tue, 30 Jan 2018 20:55:02 +0000 (21:55 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 3 Feb 2018 01:53:48 +0000 (17:53 -0800)
commitfbf486bfa421fba9be94a0509bb14958212bf298
treeb8cb67b2922bdd88e43371158a0094fcf09129f3
parent2e8290ccfe4a74cfd37a9a380a5854f013d51ccc
libbpf: add error reporting in XDP

Parse netlink ext attribute to get the error message returned by
the card. Code is partially take from libnl.

We add netlink.h to the uapi include of tools. And we need to
avoid include of userspace netlink header to have a successful
build of sample so nlattr.h has a define to avoid
the inclusion. Using a direct define could have been an issue
as NLMSGERR_ATTR_MAX can change in the future.

We also define SOL_NETLINK if not defined to avoid to have to
copy socket.h for a fixed value.

Signed-off-by: Eric Leblond <eric@regit.org>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
samples/bpf/Makefile
tools/lib/bpf/Build
tools/lib/bpf/bpf.c
tools/lib/bpf/nlattr.c [new file with mode: 0644]
tools/lib/bpf/nlattr.h [new file with mode: 0644]