dynatrace-oss / nettracer-bpf

This module allows 3rd party solutions (including Dynatrace OneAgent) to offer event driven monitoring of network traffic on Linux/Unix kernels.
Apache License 2.0
28 stars 5 forks source link

APM-286586: Improve kernel headers directory selection for building bpf_program #2

Closed pijuszczyk closed 3 years ago

pijuszczyk commented 3 years ago

Previously, compiler had /lib/modules/... with its subdirectories as the location of the kernel headers. However, this directory doesn't seem right, especially on non-Ubuntu distributions. A better place to look at is /usr/src/.... Furthermore, in some cases, like on Debian 10 amd64, not one but two directories contain the required headers (on Debian 10 amd64 one is related to amd64-specific definitions, while the other, common, is for generic definitions).

This pull request introduces kernel headers directory seeking logic to deal with the presented issues and allow NetTracer builds e.g. on Debian. Additionally, the error message for bpf_load_program is enriched with the name of the probe whose loading failed.

dyladan commented 3 years ago

CLA assistant check
All committers have signed the CLA.