diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 11:54:15 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 12:24:21 +0300 |
| commit | 3776ae87bf363535aa5883008a922a7dcb1e2b86 (patch) | |
| tree | 625b6c3adb1275fddb495b59d37dc51d06f87886 /kernel | |
| parent | 73f1da37630c1799d32f881ebafdfe353ecffdd6 (diff) | |
| download | accel-ppp-3776ae87bf363535aa5883008a922a7dcb1e2b86.tar.gz accel-ppp-3776ae87bf363535aa5883008a922a7dcb1e2b86.zip | |
metrics: resolve protocol stat symbols via dlsym
The previous weak-symbol workaround let the module load on musl (which
treats RTLD_LAZY as RTLD_NOW) but introduced a silent failure: weak
undefined references are bound to NULL at our own dlopen time and are
not updated when a later RTLD_GLOBAL dlopen brings the protocol module
in. In any [modules] ordering where metrics comes before pppoe / l2tp /
pptp / sstp / ipoe, the function pointers stay NULL and per-protocol
session metrics silently disappear from both Prometheus and JSON
output, with no log to indicate why.
Replace the weak declarations with a small table and resolve each
protocol's stat_starting/stat_active pair via dlsym(RTLD_DEFAULT, ...)
the first time we render after the module is seen as loaded. dlsym
walks the live global scope at call time, so it picks up symbols
regardless of dlopen order; the resolved pointers are cached so
subsequent scrapes do not re-walk the loader. The five near-identical
render blocks in render_prometheus() and render_json() collapse into
table-driven loops.
libdl is already a transitive dependency of accel-pppd via triton, so
no build-system changes are needed.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
