[Cake] issue with Cake and bpf filter

Pete Heist pete at heistp.net
Wed Aug 22 06:32:41 EDT 2018

> On Aug 22, 2018, at 12:13 PM, Toke Høiland-Jørgensen <toke at toke.dk> wrote:
> Jonathan Morton <chromatix99 at gmail.com> writes:
>>> On 22 Aug, 2018, at 12:51 pm, Pete Heist <pete at heistp.net> wrote:
>>> "math between pkt pointer and 4294901760 is not allowed"
>> As a possible clue here, 4294901760 == (2^32) - (2^16).
>> I suspect both errors are being caused by the call to memcpy(). This
>> potentially inlines a substantial amount of code which may not be
>> eBPF-clean.
> Yeah, I think this is a good guess. You could try using
> __builtin_memcpy() instead; that may do fewer pointer shenanigans than
> the function-header-defined one...

Thanks for those ideas. It sounded good to me too, but __builtin_memcpy does the same, as does replacing memcpy with a manually unrolled loop (committed as IPV6_SUPPORT_V3).

Backing up, I’m not even sure why I have to put the IPv6 address on the stack. For IPv4, I just have a pointer to a “struct iphdr” set at an offset from head, not on the stack at all, and it works fine to reference &ip4->daddr directly. For IPv6 (IPV6_SUPPORT_V1), it doesn’t. I have to look at that (2^32) - (2^16) value, seems key, and I might find some clues in the example Dave sent. Or understand the bytecode… :)

More information about the Cake mailing list