bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c
authorPeter Oskolkov <posk@google.com>
Wed, 13 Feb 2019 19:53:39 +0000 (11:53 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 14 Feb 2019 02:27:55 +0000 (18:27 -0800)
commit3bd0b15281af776650e1550be4ea655b8cfa10c8
tree22b56d5adc340bf9b04fb2581d2dbcdbc784730f
parent9b0a6a9dbab0ae092d033e67dc2701e8a7b09cdb
bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

This patch builds on top of the previous patch in the patchset,
which added BPF_LWT_ENCAP_IP mode to bpf_lwt_push_encap. As the
encapping can result in the skb needing to go via a different
interface/route/dst, bpf programs can indicate this by returning
BPF_LWT_REROUTE, which triggers a new route lookup for the skb.

v8 changes: fix kbuild errors when LWTUNNEL_BPF is builtin, but
   IPV6 is a module: as LWTUNNEL_BPF can only be either Y or N,
   call IPV6 routing functions only if they are built-in.

v9 changes:
   - fixed a kbuild test robot compiler warning;
   - call IPV6 routing functions via ipv6_stub.

v10 changes: removed unnecessary IS_ENABLED and pr_warn_once.

v11 changes: fixed a potential dst leak.

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/lwt_bpf.c