FreeBSD Bugzilla – Attachment 253432 Details for
Bug 238006
syslogd not starting because of missing /var/run/log
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-syslogd-Ignore-getaddrinfo-errors-if-ss-is-specified.patch (text/plain), 2.70 KB, created by
Mark Johnston
on 2024-09-08 18:25:36 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2024-09-08 18:25:36 UTC
Size:
2.70 KB
patch
obsolete
>From 85f9963eab7c6ed3176c1ade43875c41f4635819 Mon Sep 17 00:00:00 2001 >From: Mark Johnston <markj@FreeBSD.org> >Date: Sun, 8 Sep 2024 18:22:54 +0000 >Subject: [PATCH] syslogd: Ignore getaddrinfo() errors if -ss is specified > >This can arise if the jail doesn't have networking configured, and if >-ss is specified, syslogd won't listen on port 514 anyway. > >PR: 238006 >--- > usr.sbin/syslogd/syslogd.c | 8 ++++++ > usr.sbin/syslogd/tests/syslogd_test.sh | 34 +++++++++++++++++++++++++- > 2 files changed, 41 insertions(+), 1 deletion(-) > >diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c >index 7770e97e7a2d..12fa61b01bad 100644 >--- a/usr.sbin/syslogd/syslogd.c >+++ b/usr.sbin/syslogd/syslogd.c >@@ -548,6 +548,14 @@ addsock(const char *name, const char *serv, mode_t mode) > if (serv == NULL) > serv = "syslog"; > error = getaddrinfo(name, serv, &hints, &res0); >+ if (error == EAI_NONAME && name == NULL && SecureMode > 1) { >+ /* >+ * If we're in secure mode, we won't open inet sockets anyway. >+ * This failure can arise legitimately when running in a jail >+ * without networking. >+ */ >+ return; >+ } > if (error) { > asprintf(&msgbuf, "getaddrinfo failed for %s%s: %s", > name == NULL ? "" : name, serv, >diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh >index e4927868e47f..08e6d76b9ba6 100644 >--- a/usr.sbin/syslogd/tests/syslogd_test.sh >+++ b/usr.sbin/syslogd/tests/syslogd_test.sh >@@ -22,7 +22,13 @@ readonly SYSLOGD_LOCAL_PRIVSOCKET="${PWD}/logpriv.sock" > # Start a private syslogd instance. > syslogd_start() > { >- syslogd \ >+ local jail >+ >+ if [ "$1" = "-j" ]; then >+ jail="jexec $2" >+ shift 2 >+ fi >+ $jail syslogd \ > -b ":${SYSLOGD_UDP_PORT}" \ > -C \ > -d \ >@@ -288,6 +294,31 @@ pipe_action_cleanup() > syslogd_stop > } > >+atf_test_case "jail_noinet" "cleanup" >+jail_noinet_head() >+{ >+ atf_set descr "syslogd -ss can be run in a jail without INET support" >+ atf_set require.user root >+} >+jail_noinet_body() >+{ >+ local logfile >+ >+ atf_check jail -c name=syslogd_noinet persist >+ >+ logfile="${PWD}/jail_noinet.log" >+ printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" >+ syslogd_start -j syslogd_noinet -ss >+ >+ syslogd_log -p user.debug -t "test" -h "${SYSLOGD_LOCAL_SOCKET}" \ >+ "hello, world" >+ atf_check -s exit:0 -o match:"test: hello, world" cat "${logfile}" >+} >+jail_noinet_cleanup() >+{ >+ jail -r syslogd_noinet >+} >+ > atf_init_test_cases() > { > atf_add_test_case "basic" >@@ -296,4 +327,5 @@ atf_init_test_cases() > atf_add_test_case "host_filter" > atf_add_test_case "prop_filter" > atf_add_test_case "pipe_action" >+ atf_add_test_case "jail_noinet" > } >-- >2.46.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 238006
: 253432
Working