clatd ebpf offload - fallback to clatd if bpf_skb_change_proto() helper fails
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I29b68debb8c094522161fe2254b1404b50997893
diff --git a/bpf_progs/clatd.c b/bpf_progs/clatd.c
index c2cd950..207241b 100644
--- a/bpf_progs/clatd.c
+++ b/bpf_progs/clatd.c
@@ -121,8 +121,9 @@
// Note that there is no L4 checksum update: we are relying on the checksum neutrality
// of the ipv6 address chosen by netd's ClatdController.
- // Packet mutations begin - point of no return.
- if (bpf_skb_change_proto(skb, htons(ETH_P_IP), 0)) return TC_ACT_SHOT;
+ // Packet mutations begin - point of no return, but if this first modification fails
+ // the packet is probably still pristine, so let clatd handle it.
+ if (bpf_skb_change_proto(skb, htons(ETH_P_IP), 0)) return TC_ACT_OK;
// bpf_skb_change_proto() invalidates all pointers - reload them.
data = (void*)(long)skb->data;