[Bug 238006] syslogd not starting because of missing /var/run/log

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 09 Sep 2024 09:23:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238006

--- Comment #8 from Harald Schmalzbauer <bugzilla.freebsd@omnilan.de> ---
(In reply to Mark Johnston from comment #7)
Thanks a lot!  I was wondering how comes that your diff calls getaddrinfo()
differently...
and noticed that HEAD has a significant newer version, tuned by Jake Freeland
mainly.

In main f30b063ee667
  »syslogd: Only use peerlist during flag parsing«
the check in question was moved from socksetup() to addsock() and the
unconditional addpeer() was removed.
So I thought it's worth giving the unmodified HEAD version a try†, especially
because the commits were tagged to be MFCd after 3 weeks.

  And lucky I was: Only reading/understanding parts of the diff, it turns out
that HEAD version doesn't terminate in jails without IP/vnet assigned if '-ss'
was passed as CLI arg 
(while (the default) '-s' still makes syslogd(8) terminate with »pri 53, flags
0, from test, msg exiting on signal 2« in such jails).


  For completeness I also successfully tested the patched stable/14 version of
syslogd(8), with Mark's slightly adopted diff (same result as with HEAD
version, '-ss' pased starts while '-s' terminates in jails withoutIP/vnet):
(note pe->pe_name instead of name and returning with an int)
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -3825,6 +3825,14 @@ socksetup(struct peer *pe)
        if (pe->pe_serv == NULL)
                pe->pe_serv = "syslog";
        error = getaddrinfo(pe->pe_name, pe->pe_serv, &hints, &res0);
+       if (error == EAI_NONAME && pe->pe_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 (0);
+       }
        if (error) {
                char *msgbuf;

So I guess instead of patching, MFCing is the preferred solution after one year
in HEAD.
Unfortunately I don't have any environment where I could test all the network
functionality of syslogd(8).  Neither sending nor collecting via inet...
Ever since I discovered 'netstat -an' as young rookie, I'm passing '-ss' to
syslogd(8).

How to find out if syslogd_flags="-ss" (instead of ="-s") would be the better
default in /etc/defaults/rc.conf?  But that's unrelated to this PR.


†although I new this would make me upset about git(666) once more... I lost the
wrestle again, so I took the head src tar and copied usr.sbin/syslogd into my
stable/14 checkout (I _always_ end up with an unusable local git repo and need
to re-clone and start from scratch :-( I rarely needed much svn(1) help and
never messed it up...)
If somebody could tell me how I could have accomplished getting an diff between
the HEAD commit as in stable/14 and head in HEAD, I'd highly appreciate.  I
guess I'd always need to separately clone the HEAD repo 1st, which is
ridiculous imho.

-- 
You are receiving this mail because:
You are the assignee for the bug.