Page MenuHomeFreeBSD

syslogd: fixed hostname processing and optimizing timestamp parsing for RFC 5424
ClosedPublic

Authored by dmitry.wagin_ya.ru on Oct 2 2020, 4:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 4:16 AM
Unknown Object (File)
Wed, Oct 1, 11:42 PM
Unknown Object (File)
Thu, Sep 25, 7:55 PM
Unknown Object (File)
Thu, Sep 25, 7:52 PM
Unknown Object (File)
Wed, Sep 24, 10:13 AM
Unknown Object (File)
Sep 4 2025, 3:19 AM
Unknown Object (File)
Aug 27 2025, 7:42 AM
Unknown Object (File)
Aug 15 2025, 5:53 PM
Subscribers

Details

Summary

In RFC 3164 (bsd-format): The Domain Name MUST NOT be included in the HOSTNAME field.
In RFC 5424 (ietf-format): The HOSTNAME field SHOULD contain the hostname and the domain name of the originator in FQDN format.

Without these changes syslogd(8) uses trimdomain() for addresses received from socket by socklist_recv_sock() (via cvthname()) and addresses used by config filtering by readconfigfile() (via cfline()).

Also, RFC 5424 timestamp parsing has been optimized.

Test Plan

Hostname filtering works incorrectly with "-O syslog" in next cases:

  • using "+@" filtering - "localhost" (without domain name) is used for comparing with FQDN-names (ex. "localhost.localdomain");
  • using "+server.localdomain" filtering, "-H" flag and localdomain clients - "server" (without domain name) is used for comparing with FQDN-names (ex. "bsd.localdomain").

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks reasonable to me, thanks. Please be sure to upload with context, this change is hard to read without it. i.e., generate the raw diff with -U99999.

This revision is now accepted and ready to land.Oct 3 2020, 5:54 PM
This revision now requires review to proceed.Oct 4 2020, 2:46 PM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 9 2020, 3:19 PM
This revision was automatically updated to reflect the committed changes.