Hi, Welcome to the eBPF land!
> Is there a way to "compile" sample to BPF code on "host" machine, > upload script and "bpf" code to target machine and execute it ? I have done something similar before where I would generate a BPF binary using clang, extract bytecode from it and load it using bpf_prog_load() helper. There are examples in kernel to do similar stuff. The samples/bpf is a good place to start IMO ( http://lxr.free-electrons.com/source/samples/bpf/ ). For example, lathist_kern.c compiles to an object that contains bpf bytecode and the lathist_user.c extracts and "loads" the bytecode according to program type (kprobe/socket etc) using helpers provided in libbpf.c So, if I understand you correctly, you could use the generated object containing bpf bytecode (lathist_kern.o), and your 'script' (which here would be the lathist_user program) and insert the bytecode in kernel. As a bonus, check bpf_load.c to see how this code extraction works. If you are adventurous and want to write your own bytecode, it may be possible to write it by hand also. Do check the first part of this post : https://kinvolk.io/blog/2016/11/introducing-gobpf---using-ebpf-from-go/ PS. Everyone, please correct me if I am wrong -- Suchakra _______________________________________________ iovisor-dev mailing list [email protected] https://lists.iovisor.org/mailman/listinfo/iovisor-dev
