[PATCH 1/1] net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head

Ian May ian.may at canonical.com
Thu Oct 8 14:07:35 UTC 2020


From: Lorenzo Colitti <lorenzo at google.com>

BugLink: https://bugs.launchpad.net/bugs/1896504

This allows TC eBPF programs to modify and forward (redirect) packets
from interfaces without ethernet headers (for example cellular)
to interfaces with (for example ethernet/wifi).

The lack of this appears to simply be an oversight.

Tested:
  in active use in Android R on 4.14+ devices for ipv6
  cellular to wifi tethering offload.

Signed-off-by: Lorenzo Colitti <lorenzo at google.com>
Signed-off-by: Maciej ┼╗enczykowski <maze at google.com>
Signed-off-by: Alexei Starovoitov <ast at kernel.org>
(cherry picked from commit 6f3f65d80dac8f2bafce2213005821fccdce194c)
Signed-off-by: Ian May <ian.may at canonical.com>
---
 net/core/filter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 5c490d473df1..8340892884e8 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6159,6 +6159,8 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 		return &bpf_skb_adjust_room_proto;
 	case BPF_FUNC_skb_change_tail:
 		return &bpf_skb_change_tail_proto;
+	case BPF_FUNC_skb_change_head:
+		return &bpf_skb_change_head_proto;
 	case BPF_FUNC_skb_get_tunnel_key:
 		return &bpf_skb_get_tunnel_key_proto;
 	case BPF_FUNC_skb_set_tunnel_key:
-- 
2.25.1




More information about the kernel-team mailing list