bpf: add bpf_skb_adjust_room mode BPF_ADJ_ROOM_MAC
authorWillem de Bruijn <willemb@google.com>
Fri, 22 Mar 2019 18:32:54 +0000 (14:32 -0400)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 22 Mar 2019 20:52:45 +0000 (13:52 -0700)
commit14aa31929b724b70fb63a9b0e7877da325b25cfe
tree337408444ce554606978d20087e22e4a6ad4a59c
parent8142958954d17a31e0ac9e3a9c91103a1c171179
bpf: add bpf_skb_adjust_room mode BPF_ADJ_ROOM_MAC

bpf_skb_adjust_room net allows inserting room in an skb.

Existing mode BPF_ADJ_ROOM_NET inserts room after the network header
by pulling the skb, moving the network header forward and zeroing the
new space.

Add new mode BPF_ADJUST_ROOM_MAC that inserts room after the mac
header. This allows inserting tunnel headers in front of the network
header without having to recreate the network header in the original
space, avoiding two copies.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h
net/core/filter.c