On Thu, Feb 06, 2020 at 11:46:25AM -0500, sven falempin wrote:
> If for exemple there s a wrong endpoint in the config file, like
> local1.warn @badhost
> and no other the daemon will close  fd_udp.

Your DNS lookup fails at startup, sockets are closed.

> // reload with a badhost in /etc/hosts for the sake of testing

Later at SIGHUP you DNS works again.  Now the sockets are needed.

So do not close them if DNS for udp fails.
Does this diff fix your setup?

bluhm

Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.262
diff -u -p -r1.262 syslogd.c
--- usr.sbin/syslogd/syslogd.c  5 Jul 2019 13:23:27 -0000       1.262
+++ usr.sbin/syslogd/syslogd.c  6 Feb 2020 21:51:30 -0000
@@ -2416,6 +2416,7 @@ init(void)
        s = 0;
        strlcpy(progblock, "*", sizeof(progblock));
        strlcpy(hostblock, "*", sizeof(hostblock));
+       send_udp = send_udp6 = 0;
        while (getline(&cline, &s, cf) != -1) {
                /*
                 * check for end-of-section, comments, strip off trailing
@@ -2755,6 +2756,9 @@ cfline(char *line, char *progblock, char
                    sizeof(f->f_un.f_forw.f_addr)) != 0) {
                        log_warnx("bad hostname \"%s\"",
                            f->f_un.f_forw.f_loghost);
+                       /* DNS lookup may work after SIGHUP, keep sockets */
+                       if (strncmp(proto, "udp", 3) == 0)
+                               send_udp = send_udp6 = 1;
                        break;
                }
                f->f_file = -1;

Reply via email to