Open sebastiaoamaro opened 1 year ago
That's correct, you can't use 128 bit wide fields in eBPF code. Should you need that, I think you will need to model it using 4 32 bit-wide fields.
Hi, thanks for the quick reply! And what about u64 are they allowed?
@sebastiaoamaro I don't believe they are permitted either. The best way would be to test.
I am gonna test this when I have the time I think it is interesting to know. Should the cargo bpf tool allow the declaration of u128 if they are not allowed in the kernel? Do not know if this is hard to implement but it could maybe give a warning or something. Thanks for the replies.
@sebastiaoamaro, @rsdy,
I think this depends on the kernel version. I've certainly used u128 in maps when dealing with IPv6 addresses. This patch set also suggests that support for 128 bit integers was added some time ago: https://www.spinics.net/lists/netdev/msg544476.html. For reference, I'm using a Kernel version 5.19 and have also performed some testing on 5.10. Hope this helps.
Cheers, Ben
Hi, I am trying to load this BPF program, however, I get the error: thread 'tokio-runtime-worker' panicked at 'error loading BPF program: LoadError("measure_tcp_lifetime", BPF)', In RedBPF as far as I am aware tracks to this block https://github.com/foniod/redbpf/blob/55331987dc31a26feb192e4a668bf9bfc336e1e0/redbpf/src/lib.rs#L727 This is the code in the program
I previously managed to get this program correctly loaded when I used u32 instead of u128, however, I need to change it now. Is there anything related to u128 that the kernel does not allow? Thank you in advance.