From owner-freebsd-bugs@freebsd.org Thu Dec 24 03:09:24 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E30F4B4F81 for ; Thu, 24 Dec 2020 03:09:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4D1Zmh0gGJz4qsf for ; Thu, 24 Dec 2020 03:09:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 14DB84B4F80; Thu, 24 Dec 2020 03:09:24 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1386E4B4ED8 for ; Thu, 24 Dec 2020 03:09:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1Zmg71TNz4r1w for ; Thu, 24 Dec 2020 03:09:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E48CDEFD for ; Thu, 24 Dec 2020 03:09:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BO39Nnk076571 for ; Thu, 24 Dec 2020 03:09:23 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 0BO39NZH076570 for bugs@FreeBSD.org; Thu, 24 Dec 2020 03:09:23 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 252095] syslogd not sending hostname to loghost Date: Thu, 24 Dec 2020 03:09:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: raj@gusw.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2020 03:09:24 -0000 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.=