summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-03-09 15:08:24 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-03-09 15:08:24 +0000
commit459d4e795faae9e9a5825a299f7e5063446853a0 (patch)
tree86bfad1536a640c54db5ba58c50eba42662f303b /usr.sbin
parent4cc6cf66897987e18200a48c515983ae3f121690 (diff)
Early daemons like dhcpleased(8), slaacd(8), unwind(8), resolvd(8)
are started before syslogd(8). This resulted in ugly sendsyslog(2) dropped logs and the real message was lost. Create a temporary stash for log messages within the kernel. It has a limited size of 100 messages, and each message is truncated to 8192 bytes. When the stash is exhausted, the well-known dropped message is generated with a counter. After syslogd(8) has setup everything, it sends a debug line through libc to flush the kernel stash. Then syslogd receives all messages from the kernel before the usual logs. OK deraadt@ visa@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/syslogd/syslogd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 9b324a61dfb..98c79c80b82 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.264 2020/09/14 20:36:01 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.265 2021/03/09 15:08:23 bluhm Exp $ */
/*
* Copyright (c) 2014-2017 Alexander Bluhm <bluhm@genua.de>
@@ -891,6 +891,10 @@ main(int argc, char *argv[])
if (sigprocmask(SIG_SETMASK, &sigmask, NULL) == -1)
err(1, "sigprocmask unblock");
+ /* Send message via libc, flushes log stash in kernel. */
+ openlog("syslogd", LOG_PID, LOG_SYSLOG);
+ syslog(LOG_DEBUG, "running");
+
event_dispatch();
/* NOTREACHED */
return (0);