MINOR: log: adds syslog udp message handler and parsing.
This patch introduce a new fd handler used to parse syslog
message on udp.
The parsing function returns level, facility and metadata that
can be immediatly reused to forward message to a log server.
This handler is enabled on udp listeners if proxy is internally set
to mode PR_MODE_SYSLOG
diff --git a/src/proto_udp.c b/src/proto_udp.c
index d006c45..6defe7e 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -303,9 +303,14 @@
listener->fd = fd;
listener->state = LI_LISTEN;
- err |= ERR_FATAL | ERR_ALERT;
- msg = "UDP is not yet supported on this proxy mode";
- goto udp_close_return;
+ if (listener->bind_conf->frontend->mode == PR_MODE_SYSLOG)
+ fd_insert(fd, listener, syslog_fd_handler,
+ thread_mask(listener->bind_conf->bind_thread) & all_threads_mask);
+ else {
+ err |= ERR_FATAL | ERR_ALERT;
+ msg = "UDP is not yet supported on this proxy mode";
+ goto udp_close_return;
+ }
udp_return:
if (msg && errlen) {