diff --git a/src/loader/prog.c b/src/loader/prog.c index c5628fc..7a4d0ca 100644 --- a/src/loader/prog.c +++ b/src/loader/prog.c @@ -254,10 +254,7 @@ int main(int argc, char *argv[]) } #ifdef ENABLE_FILTER_LOGGING - if (rb) - { - ring_buffer__poll(rb, RB_TIMEOUT); - } + PollFiltersRb(rb); #endif usleep(sleep_time); diff --git a/src/loader/utils/logging.c b/src/loader/utils/logging.c index ad7ce16..8881f1f 100644 --- a/src/loader/utils/logging.c +++ b/src/loader/utils/logging.c @@ -103,6 +103,21 @@ void LogMsg(config__t* cfg, int req_lvl, int error, const char* msg, ...) va_end(args); } +/** + * Polls the filters map ringbuffer. + * + * @param rb A pointer to the ringbuffer. + * + * @return void + */ +void PollFiltersRb(struct ring_buffer* rb) +{ + if (rb) + { + ring_buffer__poll(rb, RB_TIMEOUT); + } +} + /** * Callback for BPF ringbuffer event (filter logging). * diff --git a/src/loader/utils/logging.h b/src/loader/utils/logging.h index beabf54..4de14d2 100644 --- a/src/loader/utils/logging.h +++ b/src/loader/utils/logging.h @@ -17,4 +17,6 @@ extern int doing_stats; void LogMsg(config__t* cfg, int req_lvl, int error, const char* msg, ...); + +void PollFiltersRb(struct ring_buffer* rb); int HandleRbEvent(void* ctx, void* data, size_t sz); \ No newline at end of file