bpf: Add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_ENCAP_L2_ETH
authorXuesen Huang <huangxuesen@kuaishou.com>
Thu, 4 Mar 2021 06:40:46 +0000 (14:40 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 5 Mar 2021 15:59:00 +0000 (16:59 +0100)
commitd01b59c9ae94560fbcceaafeef39784d72765033
tree8fc796fd568840b20623f9a06ca10760db097a64
parentbce8623135fbe54bd86797df72cb85bfe4118b6e
bpf: Add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_ENCAP_L2_ETH

bpf_skb_adjust_room sets the inner_protocol as skb->protocol for packets
encapsulation. But that is not appropriate when pushing Ethernet header.

Add an option to further specify encap L2 type and set the inner_protocol
as ETH_P_TEB.

Suggested-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Xuesen Huang <huangxuesen@kuaishou.com>
Signed-off-by: Zhiyong Cheng <chengzhiyong@kuaishou.com>
Signed-off-by: Li Wang <wangli09@kuaishou.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/bpf/20210304064046.6232-1-hxseverything@gmail.com
include/uapi/linux/bpf.h
net/core/filter.c
tools/include/uapi/linux/bpf.h