Commit Graph

593 Commits

Author SHA1 Message Date
Joachim Nilsson
762e09d7e8 syslogd: Drop -l HOST flag, the RFCs are very clear on this point
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
d1035377cc syslogd: Drop -s HOST flag in favor of future BSD SecureMode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
4ee6211277 syslogd: Refactor internals to use new socket API
This patch is inspired, in part, by FreeBSD syslogd but now diverges
onto its own path.  Special handling for AF_UNIX sockets are required
on Linux, which unlike BSD cannot use getaddrinfo() on UNIX sockets.

- Rip out old funix[] and finet support
- Add new concept of peers
- Linked list of peers can be > 20
- Temporarily open up to accept all remote conns
- Remove old logerror(), replaced with new log macros

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:01 +01:00
Joachim Nilsson
07677c78a5 Graft struct addrinfo support on top of new socket API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:01 +01:00
Joachim Nilsson
a4c1acbca8 syslogd: Drop -r flag, to be replaced with BSD -s (secure) flag
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 09:19:54 +01:00
Joachim Nilsson
c66411e8c2 Use new log macros and err.h fns
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 08:56:06 +01:00
Joachim Nilsson
53c2d0e3d9 Export flog() function and define new log macros ERR(), WARN(), etc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-11 18:52:00 +01:00
Joachim Nilsson
90fb520c06 Add socket helper functions from SMCRoute, licesened as 3-clause BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-10 11:22:14 +01:00
Joachim Nilsson
c31a7d1031 Minor refactor/cleanup
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-10 09:35:01 +01:00
Joachim Nilsson
a2feba69e2 Allow klogd to send LOG_KERN messages to syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-09 11:46:56 +01:00
Joachim Nilsson
b15420fdc5 syslogd: Inherit parsed PRI value in RFC3164 front-end
The RFC5424 front-end already does this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-09 11:23:03 +01:00
Joachim Nilsson
9aaa7ec8c4 syslogd: Install SIGHUP handler earlier
When a heavily loaded system starts up syslogd may not in time reach its
original installation of the SIGHUP handler before receiving the signal.
It will then die and have to be restarted by PID 1.

This patch installs the SIGHUP handler early, with all the other signals
right after command line parsing.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 16:15:29 +01:00
Joachim Nilsson
9ed0fe672a Bump version for second release candidate
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 16:04:04 +01:00
Joachim Nilsson
dd5b470342 Fix assert when buffer->hostname == NULL at startup
Default to use 'from' in RFC3164 parser, just like the RFC5424 parser
already does.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 15:50:09 +01:00
Joachim Nilsson
0435139ec9 man: Formatting fixes for readability
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:56:16 +01:00
Joachim Nilsson
625a0d4abc Relicense example code/readme/makefile as public domain
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:43:37 +01:00
Joachim Nilsson
1546d3ce94 Bump version for v2.0-rc1 release candidate
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:23:33 +01:00
Joachim Nilsson
9a3d5b6a4d Mention syslogp() code example and Dr. Wettstein's formative work
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:21:41 +01:00
Joachim Nilsson
307dcd073e Revert "Disable clang in Coverity Scan run"
This reverts commit bafdb29743.
2019-11-08 12:39:45 +01:00
Joachim Nilsson
fbb7c5ce86 Minor, same look for contact information as previous maintainers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 12:37:47 +01:00
Joachim Nilsson
0a3c5e1544 syslogd: Update usage text, drop -a add -b and simplify
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 08:50:17 +01:00
Joachim Nilsson
3377f07a5a klogd: Update usage text, no more -i or -I
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 08:50:17 +01:00
Joachim Nilsson
172ae92887 test: Extend API test with logger verifing structured data
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:33 +01:00
Joachim Nilsson
cc96379252 syslogd: Fix RFC5424 structured-data parser
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:33 +01:00
Joachim Nilsson
22c3fa9fa3 syslogd: Increase debug logging of raw incoming and parsed messages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:33 +01:00
Joachim Nilsson
3f68d765db logger: Change usage text slightly for readability
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:33 +01:00
Joachim Nilsson
31815d6143 logger: Add NetBSD -d SD for RFC5424 structured data
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:31 +01:00
Joachim Nilsson
12d5536dfc Update man page with missing -u SOCK documentation
Also, update FILES section with correct information on the UNIX domain
socket path used on Linux.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:20:14 +01:00
Joachim Nilsson
60239756af Reference syslogp(3) instead of native/old syslog(3) API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:20:14 +01:00
Joachim Nilsson
e25f835a5a logger: Add NetBSD -m MSGID support for logging RFC5424 style
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:20:11 +01:00
Joachim Nilsson
f2e1793cda logger: Add NetBSD -n option for LOG_NDELAY
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 22:03:11 +01:00
Joachim Nilsson
0aa57978ee logger: Add NetBSD -i option for LOG_PID
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 21:54:47 +01:00
Joachim Nilsson
d3461fd6a3 logger: Add NetBSD -c option for LOG_CONS
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 21:08:01 +01:00
Joachim Nilsson
fff4368e80 RFC5424 sec 6.1 states that we *should* support 2048 byte long msgs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 20:56:02 +01:00
Joachim Nilsson
07033382ee Minor, type cast logit() argument for Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 20:35:54 +01:00
Joachim Nilsson
11819e5b7f Type cast arguments to logit(), fixes warnings from Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:37:12 +01:00
Joachim Nilsson
884a0a180b Use correct format specifier for ssize_t, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:37:04 +01:00
Joachim Nilsson
774523f6e2 Fix missing argument to logit() and clean up unreadable code
Found by Coverity Scan

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:36:49 +01:00
Joachim Nilsson
7533f96ca9 Fix invalid/missing/extra argument to logit(), found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:24:38 +01:00
Joachim Nilsson
bafdb29743 Disable clang in Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:17:18 +01:00
Joachim Nilsson
6059d873a5 Fix stray 'g' that sneaked in last test update
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:13:28 +01:00
Joachim Nilsson
cee833a7f5 Draft update of v2.0 change log
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
939a28f6f8 Test with a secondary UNIX socket
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
4376def121 Allow running tests stand-alone
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
64c6866667 Minor, drop debug log message for normal case
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
67723e53b9 syslogd.8: Clarify -r documentation and how it works with -b :PORT
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
f8e87f143d syslogd: Drop -a SOCK support, replaced with multiple -p SOCK args
The -p SOCK syntax is what NetBSD syslogd use, so this is more of an
alignment with upstream.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
d723574eee logger: Update usage text with missing -u SOCK info
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 06:47:53 +01:00
Joachim Nilsson
9a0bfeef8a Travis-CI: Fix configure rule, follow-up to previous commit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 17:13:55 +01:00
Joachim Nilsson
55d92d73c3 Drop address sanitizer for now, fails on Clang builds
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:59:04 +01:00