OSDN Git Service

bpf: add plumbing for BPF_LWT_ENCAP_IP in bpf_lwt_push_encap
authorPeter Oskolkov <posk@google.com>
Wed, 13 Feb 2019 19:53:35 +0000 (11:53 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 14 Feb 2019 02:27:55 +0000 (18:27 -0800)
commit3e0bd37ce0e4a574df6d87a901e13bcb46e10301
tree37139a151b9f589d1d0b1f466bad50da76e6c0d2
parentdd27c2e3d0a05c01ff14bb672d1a3f0fdd8f98fc
bpf: add plumbing for BPF_LWT_ENCAP_IP in bpf_lwt_push_encap

This patch adds all needed plumbing in preparation to allowing
bpf programs to do IP encapping via bpf_lwt_push_encap. Actual
implementation is added in the next patch in the patchset.

Of note:
- bpf_lwt_push_encap can now be called from BPF_PROG_TYPE_LWT_XMIT
  prog types in addition to BPF_PROG_TYPE_LWT_IN;
- if the skb being encapped has GSO set, encapsulation is limited
  to IPIP/IP+GRE/IP+GUE (both IPv4 and IPv6);
- as route lookups are different for ingress vs egress, the single
  external bpf_lwt_push_encap BPF helper is routed internally to
  either bpf_lwt_in_push_encap or bpf_lwt_xmit_push_encap BPF_CALLs,
  depending on prog type.

v8 changes: fixed a typo.

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h
net/core/filter.c