Commit Graph

781 Commits

Author SHA1 Message Date
Joachim Wiberg
e3d6ff8737 Check boundary in every step of parse_rfc5424()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 11:59:33 +02:00
Joachim Wiberg
d1f1702277 Check boundary first in parse_rfc5424()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 10:09:34 +02:00
Joachim Wiberg
ebced817a7 Ensure argument to printsys() is always nul terminated
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 10:03:01 +02:00
Joachim Wiberg
52fc3f7176 Ensure received data is nul terminated, found by Coverity Scan
Coverity found two possible untrusted loop bounds, in unix_cb() and
inet_cb(), that were indeed possibly unterminated strings.  These
were classified as medium.  A third finding, marked high, was found
in kernel_cb(), which upon further investigation seems bogus.

This patch terminates the buffers received in unix_cb() and inet_cb()
but only changes to 0 from \0 termination in kernel_cb().

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 09:42:45 +02:00
Joachim Wiberg
65ceec1171 Fix GCC warning: integer constant is so large that it is unsigned
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 08:55:26 +02:00
Joachim Wiberg
947a0e103b Travis-CI: disable clang temporarily for Coverity Scan run
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 08:52:49 +02:00
Joachim Wiberg
9847237515 Update and sync changelogs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 08:51:22 +02:00
Joachim Wiberg
e5ee2446a0 Follow-up to 92a4fb3: allow kernel log dupes around edge of seqno
Although hihgly unlikely, if the kernel log sequence number (seqno)
reaches the end of its MAX value (18446744073709551615) we allow for
dupes to handle the wrap-around back to zero (0) in the counter.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-06 08:47:30 +02:00
Joachim Wiberg
4e1aefaf3d man: update syslogd(8) with new cache file and fix pidfile name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 05:17:15 +02:00
Joachim Wiberg
92a4fb3318 Fix #29: prevent repeating kernel messages when syslogd is restarted
This patch fixes the problem with kernel messages being repeated when
syslogd is restarted at runtime.  This is achieved by caching the last
seqno read from /dev/kmsg to /run/syslogd.cache.  The latter is usually
a ram disk these days so it should be a fairly quick op.

Excessive updates are prevented by only caching after handling all
callbacks in the socket_poll() loop, and only updating the cache
if there has been any new kernel messages since last update.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 05:17:15 +02:00
Joachim Wiberg
a38daf0896 test: clean up residual test files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 05:01:12 +02:00
Joachim Wiberg
1de66a04c0 logger: minor, staticify
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 04:52:48 +02:00
Joachim Wiberg
d736c837d0 Update changelogs and bump version for upcoming v2.2.3 patch release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 03:40:48 +02:00
Joachim Wiberg
eb454d7d37 Fix #28: log messages stuck in 1969
The timer_now() API, introduced in 2019, returns time relative to boot.
Useful for relative time comparisons, but when used for absolute time,
e.g. for log messages, it must be offset with boot_time.

This patch fixes issue #28, but also wall messages, which exhibits the
same problem.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 03:25:22 +02:00
Joachim Wiberg
4ab8bc7b40 Fix #31: invalid time for kernel log messages on 32-bit machines
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 03:04:52 +02:00
Joachim Wiberg
d722584191 Fix #32: fix logging of remote kernel messages being mapped to uucp
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-04 10:45:13 +02:00
Joachim Wiberg
f507ed8ff3 Update changelogs and bump version for v2.2.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-03-08 11:37:06 +01:00
Joachim Wiberg
80ec47b0ca debian: allow building package without systemd installed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 17:13:09 +01:00
Joachim Wiberg
e7194db01f debian: leverage built-in log rotation instead of logrotate
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 16:24:30 +01:00
Joachim Wiberg
24f0fd36c4 Prepare for v2.2.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 16:18:12 +01:00
Joachim Wiberg
2db6f712ce debian: initial syslogd/logger/libsyslog0/libsylog-dev packaging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 16:18:12 +01:00
Joachim Wiberg
ca6b36c63a Makefile: add relase-hook to verify release is tagged
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 15:50:27 +01:00
Joachim Wiberg
9dba6d3b9f man: fix unexpected use of .Lb, found by lintian
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 15:50:13 +01:00
Joachim Wiberg
c66c36fa90 man: drop sysklogd version from .Os and fix syslog.conf .Nd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 15:50:13 +01:00
Joachim Wiberg
a26ec5a84e man: Fix spelling error found by lintian
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 15:50:13 +01:00
Joachim Wiberg
2731591709 syslogd: Fix spelling error found by lintian
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 15:50:13 +01:00
Joachim Wiberg
e58b0cf180 syslogd.service: read SYSLOGD_OPTS from /etc/default/syslogd
- drop hard-coded -s from syslogd command line
- allow options to be read from /etc/default/syslogd

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 13:07:56 +01:00
Joachim Wiberg
d00c9dac74 Minor, refactor in preparation for checking kmesg seqno
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 13:05:26 +01:00
Joachim Wiberg
0901310226 Load or reload timezone data on init/SIGHUP
This should fix any lingering issues with logging with the wrong
timezone at boot.  As long as syslogd gets HUP'ed after setting
the new timezone.

Improvements to this welcome, of course.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 11:47:42 +01:00
Joachim Wiberg
f54c1d1f30 Fix issue with parsing /dev/kmsg time, off by one error
Problem and proposed fix reported by opty on #troglobit at freenode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-21 11:46:09 +01:00
Joachim Wiberg
b115c7ec4e Uppdate changelog and bump version for v2.2.1 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-30 14:21:59 +01:00
Joachim Wiberg
23f779ee0e Add .sha256 checksum to release target
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-30 14:21:59 +01:00
Joachim Wiberg
324c489b23 configure: use $ac_default_prefix as default install prefix
Follow-up to 22d26c5 to avoid hard-coding and instead using the
internal prefix variable, that can be changed/overridden by the
correct APIs.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-27 07:44:03 +01:00
Joachim Wiberg
fb573fe0ae Update ChangeLog for upcoming v2.2.1 patch release
Initial release date, Saturday Jan 30, 2021.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-27 00:09:05 +01:00
Joachim Wiberg
d2444c720f Fix #27: bug in /dev/kmsg priority parser, intrdocued in v2.2.0
This patch fixes a bug in the kernel log priority parser introduced in
v2.2.0 with the new support for /dev/kmsg, replacing /proc/kmsg which
has another format for the log priority.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-26 22:04:49 +01:00
Joachim Wiberg
3c59234dab Bump version for upcoming v2.2.1 bug fix release, -beta1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:43 +01:00
Joachim Wiberg
406e4299a1 logger: No need for appending error message, err() already does this
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:06 +01:00
Joachim Wiberg
ea2565ce4e Drop %m gnuism from internal log macro
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:13:06 +01:00
Joachim Wiberg
3e4000b25a Fix #26: handle Linux EPIPE on /dev/kmsg
When Linux CONFIG_LOG_BUF_SHIFT is set too low, or too many messages are
generated by the kernel, /dev/kmsg will overflow.  This is signaled with
EPIPE to userspace.  We can use the seqnos to figure out how many we've
lost, but seqnos are currently ignored.

> In case records get overwritten while /dev/kmsg is held open, or
> records get faster overwritten than they are read, the next read()
> will return -EPIPE and the current reading position gets updated to
> the next available record. The passed sequence numbers allow the log
> consumer to calculate the amount of lost messages.

-- https://lwn.net/Articles/490690/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-25 00:12:29 +01:00
Joachim Wiberg
22d26c5945 Restore default configure prefix, from / to /usr/local
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-23 23:09:59 +01:00
Joachim Wiberg
df46facfb9 Bump version for v2.2.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 11:16:23 +01:00
Joachim Wiberg
45085709e8 Update copyright years
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 11:16:04 +01:00
Joachim Wiberg
dbdc1cdf91 test: Update fwd.sh to ignore kernel logs
With the new support for /dev/kmsg the tests can run on a system that
already has a syslog daemon, and still receive all kernel messages.  We
want to ignore those in this (all?) tests and focus on the forwarding of
messages between two sysklogd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 09:40:31 +01:00
Joachim Wiberg
5a42a72721 Update ChangeLog for release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 09:17:02 +01:00
Joachim Wiberg
54da74ba4c Ignore GNU global ID files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 08:59:47 +01:00
Joachim Wiberg
fb4412b62c .github: Disable silent rules in build, use install-strip
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 18:48:30 +01:00
Joachim Wiberg
a95c4baeda Prepare ChangeLog for v2.2.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 15:29:01 +01:00
Joachim Wiberg
680c622efb Fix GCC init warning on ArmV5, use memset() instead
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 15:21:11 +01:00
Joachim Wiberg
af0da3cf1d Update, generated files by Buildroot and Emacs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 12:53:46 +01:00
Joachim Wiberg
883b351351 Allow loop initial declarations, explicitly enable C99
Fixes the following error on certain buildroot toolchains:

    syslogd.c: In function 'fmt5424':
    syslogd.c:1583:2: error: 'for' loop initial declarations are only allowed in C99 mode
      for (int j = 25; j >= 20; --j) {
           ^

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-14 12:50:51 +01:00