4 ms·
Tangentially: I am interested in sponsoring an open source (Apache License) implementation of BPF bytecode in DynASM (or LuaJIT). The use case is to execute pac
by lukego 12y ago
Tangentially: I am interested in sponsoring an open source (Apache License) implementation of BPF bytecode in DynASM (or LuaJIT). The use case is to execute packet filters compiled by libpcap. Ideally we'd win shootouts (like http://carnivore.it/2011/12/28/bpf_performance http://carnivore.it/2011/12/28/bpf_performance).
Get in touch if you are the person to do this :-) luke@snabb.co
- alnsn 12y agoHi Luke, Take a look at bpfjit in NetBSD. It uses bsd licensed sljit library to generate code for multiple platforms. The library has some slight overhead over hand-written assembly but it gives you a single codebase for all platforms. At the very least, you can borrow some optimisations from my code. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/net/bpfjit.c?only_with_tag=MAIN http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/net/bpfjit.c?onl... PS I can't work on sponsored projects. Alex
- lukego 12y agoThanks for the pointer! Do you also know a lightweight way to compile pcap-filters into BPF code?
- justincormack 12y agoNot sure there is. There seems to be a lot of optimisation done, and there only seem to be a couple of heavyweight implementations.
- majke 12y agoFrom my humble experience, even the simplest implementations of BPF runtime are fast enough. Maybe just jitted interpreter in LUA would do for most use cases. BPF is generally pretty fast.