]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: make error reporting in bpf_warn_invalid_xdp_action more clear
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 8 Sep 2017 23:40:35 +0000 (01:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Sep 2017 04:13:09 +0000 (21:13 -0700)
commita115e234f727837dacae4cec3f23e46eee8122ac
treea1b746996795ad8ca61eca7380b3bd43e6d750af
parentfe29336eb1036d64bc35383374f0ba89115c2b14
bpf: make error reporting in bpf_warn_invalid_xdp_action more clear

Differ between illegal XDP action code and just driver
unsupported one to provide better feedback when we throw
a one-time warning here. Reason is that with 741e6de4fcb9
("xdp: add bpf_redirect helper function") not all drivers
support the new XDP return code yet and thus they will
fall into their 'default' case when checking for return
codes after program return, which then triggers a
bpf_warn_invalid_xdp_action() stating that the return
code is illegal, but from XDP perspective it's not.

I decided not to place something like a XDP_ACT_MAX define
into uapi i) given we don't have this either for all other
program types, ii) future action codes could have further
encoding there, which would render such define unsuitable
and we wouldn't be able to rip it out again, and iii) we
rarely add new action codes.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/bpf.h
net/core/filter.c