]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: add bpf_redirect helper function
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 17 Jul 2017 16:27:07 +0000 (09:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Jul 2017 16:48:05 +0000 (09:48 -0700)
commit5db98bdfe2b593c7f27c565c737f2402bacf1256
treefe6ae9f9007124e1ddd76efd152f5d60db0a5bd9
parent1cc8f7127f25f23c250b116986391551ae9cfc53
xdp: add bpf_redirect helper function

This adds support for a bpf_redirect helper function to the XDP
infrastructure. For now this only supports redirecting to the egress
path of a port.

In order to support drivers handling a xdp_buff natively this patches
uses a new ndo operation ndo_xdp_xmit() that takes pushes a xdp_buff
to the specified device.

If the program specifies either (a) an unknown device or (b) a device
that does not support the operation a BPF warning is thrown and the
XDP_ABORTED error code is returned.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/filter.h
include/linux/netdevice.h
include/uapi/linux/bpf.h
net/core/filter.c