Closed pijuszczyk closed 3 years ago
It took some time and effort but I've managed to overhaul the way helper functions for getting kernel version are located and tested. As a byproduct, I've also created a small mock for system calls and IO.
I've also deleted the return statement in version >= 4.15 check.
I've applied fixup commits, merging now
In this pull request I'm introducing checking of the kernel version running on the host so that loading of BPF kprobes can be done successfully on kernels < 5.0 without compiling NetTracer on a host with the same kernel version. I also add a simple version check to confirm that we're on a sufficiently new kernel (>= 4.15) on NetTracer's side. The changes are tested using unit tests, for which I had to create a new subproject - bpf_generic previously didn't have any tests and so no tests subproject, that's why. To make everything introduced as clean as possible, I've also slightly modified directory structure for libnettracer (made it more flat) to improve consistency in the project, and added a small tests CMake/make target wrapper to allow a cleaner Makefile.