From: W.C.A. Wijngaards Date: Wed, 26 Feb 2020 11:14:52 +0000 (+0100) Subject: Add dnstap io callbacks to fptr whitelist event. X-Git-Tag: 1.11.0rc1~120^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a51e9e037549339fadfac5a68526c51f8fc88c0;p=thirdparty%2Funbound.git Add dnstap io callbacks to fptr whitelist event. --- diff --git a/dnstap/dtstream.c b/dnstap/dtstream.c index 8c51729be..744e6acde 100644 --- a/dnstap/dtstream.c +++ b/dnstap/dtstream.c @@ -463,7 +463,7 @@ static int dtio_find_msg(struct dt_io_thread* dtio) } /** callback for the dnstap reconnect, to start reconnecting to output */ -static void dtio_reconnect_timeout_cb(int ATTR_UNUSED(fd), +void dtio_reconnect_timeout_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(bits), void* arg) { struct dt_io_thread* dtio = (struct dt_io_thread*)arg; @@ -1146,7 +1146,7 @@ static int dtio_ssl_handshake(struct dt_io_thread* dtio, #endif /* HAVE_SSL */ /** callback for the dnstap events, to write to the output */ -static void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg) +void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg) { struct dt_io_thread* dtio = (struct dt_io_thread*)arg; int i; @@ -1210,7 +1210,7 @@ static void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg) } /** callback for the dnstap commandpipe, to stop the dnstap IO */ -static void dtio_cmd_cb(int fd, short ATTR_UNUSED(bits), void* arg) +void dtio_cmd_cb(int fd, short ATTR_UNUSED(bits), void* arg) { struct dt_io_thread* dtio = (struct dt_io_thread*)arg; uint8_t cmd; @@ -1349,7 +1349,7 @@ static int dtio_control_stop_send(struct stop_flush_info* info) return 1; } -static void dtio_stop_timer_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(bits), +void dtio_stop_timer_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(bits), void* arg) { struct stop_flush_info* info = (struct stop_flush_info*)arg; @@ -1360,7 +1360,7 @@ static void dtio_stop_timer_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(bits), dtio_stop_flush_exit(info); } -static void dtio_stop_ev_cb(int ATTR_UNUSED(fd), short bits, void* arg) +void dtio_stop_ev_cb(int ATTR_UNUSED(fd), short bits, void* arg) { struct stop_flush_info* info = (struct stop_flush_info*)arg; struct dt_io_thread* dtio = info->dtio; diff --git a/dnstap/dtstream.h b/dnstap/dtstream.h index 1359af7a9..5bf84757a 100644 --- a/dnstap/dtstream.h +++ b/dnstap/dtstream.h @@ -281,4 +281,19 @@ int dt_io_thread_start(struct dt_io_thread* dtio, void* event_base_nothr, */ void dt_io_thread_stop(struct dt_io_thread* dtio); +/** callback for the dnstap reconnect, to start reconnecting to output */ +void dtio_reconnect_timeout_cb(int fd, short bits, void* arg); + +/** callback for the dnstap events, to write to the output */ +void dtio_output_cb(int fd, short bits, void* arg); + +/** callback for the dnstap commandpipe, to stop the dnstap IO */ +void dtio_cmd_cb(int fd, short bits, void* arg); + +/** callback for the timer when the thread stops and wants to finish up */ +void dtio_stop_timer_cb(int fd, short bits, void* arg); + +/** callback for the output when the thread stops and wants to finish up */ +void dtio_stop_ev_cb(int fd, short bits, void* arg); + #endif /* DTSTREAM_H */ diff --git a/util/fptr_wlist.c b/util/fptr_wlist.c index 84d41cc84..cf07a7aff 100644 --- a/util/fptr_wlist.c +++ b/util/fptr_wlist.c @@ -93,6 +93,9 @@ #ifdef USE_IPSET #include "ipset/ipset.h" #endif +#ifdef USE_DNSTAP +#include "dnstap/dtstream.h" +#endif int fptr_whitelist_comm_point(comm_point_callback_type *fptr) @@ -168,6 +171,13 @@ fptr_whitelist_event(void (*fptr)(int, short, void *)) else if(fptr == &tube_handle_signal) return 1; else if(fptr == &comm_base_handle_slow_accept) return 1; else if(fptr == &comm_point_http_handle_callback) return 1; +#ifdef USE_DNSTAP + else if(fptr == &dtio_output_cb) return 1; + else if(fptr == &dtio_cmd_cb) return 1; + else if(fptr == &dtio_reconnect_timeout_cb) return 1; + else if(fptr == &dtio_stop_timer_cb) return 1; + else if(fptr == &dtio_stop_ev_cb) return 1; +#endif #ifdef UB_ON_WINDOWS else if(fptr == &worker_win_stop_cb) return 1; #endif