Date: Thu, 24 Dec 2020 03:09:24 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 252095] syslogd not sending hostname to loghost Message-ID: <bug-252095-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252095 Bug ID: 252095 Summary: syslogd not sending hostname to loghost Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: raj@gusw.net When remote logging, the syslogd does not send the hostname over to the loghost.=20 Example, in syslog client's syslog.conf *.* /var/log/all.log *.* @loghost syslog server is started with=20 syslogd -a 0.0.0.0/0 -H=20 (network can be constraint, doesn't matter). The /etc/hosts nor DNS may have all the hosts registered, it is not important or even desirable that the sy= slog server translates the IP address to a hostname, hence the -H flag. Now, when I do=20 logger -h loghost -H pb00 test the loghost's syslogd receives the "pb00" hostname and logs it.=20 When I do logger -h loghost test then also the syslogd recieves the client's current hostname and logs it. But when intermediating through the client's own syslogd logger test then the client's syslogd will not send its hostname over to the loghost, a= nd then the loghost will attempt to decode the hostname via DNS or /etc/hosts.= I think the syslogd should send its hostname over to the client, or the hostn= ame which it originally received.=20 Interestingly, the above command will log the own hostname in the all.log l= og file on the syslogd client, which will forward to the loghost without infor= ming its own idea of its hostname. logger -H xx00 test interestingly, that also does not log the xx00 name on the local syslogd in all.log even if I started the local syslogd with the -H flag. I consider this behavior a bug in that there is no reason why the syslogd should withhold its own idea of its hostname or the original hostname provi= ded in the log message on to the remote logger.=20 I browsed through the source code and couldn't immediately find how I could quickly fix this, but it seems the issue is somewhere here around line 1790: lsent =3D 0; for (r =3D f->fu_forw_addr; r; r =3D r->ai_next) { memset(&msghdr, 0, sizeof(msghdr)); msghdr.msg_name =3D r->ai_addr; msghdr.msg_namelen =3D r->ai_addrlen; msghdr.msg_iov =3D il->iov; msghdr.msg_iovlen =3D il->iovcnt; STAILQ_FOREACH(sl, &shead, next) { if (sl->sl_ss.ss_family =3D=3D AF_LOCAL || sl->sl_ss.ss_family =3D=3D AF_UNSPEC || sl->sl_socket < 0) continue; lsent =3D sendmsg(sl->sl_socket, &msghdr, 0= ); if (lsent =3D=3D (ssize_t)il->totalsize) break; } if (lsent =3D=3D (ssize_t)il->totalsize && !send_to= _all) break; } when I looked at the packets with tcpdump, it seemed that the forwarded pac= kets had no hostname of any kind in it. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252095-227>