Am 20.11.2016 um 23:24 schrieb Michael Biebl: > Am 20.11.2016 um 17:55 schrieb Rainer Gerhards: >> 2016-11-20 17:45 GMT+01:00 Michael Biebl <bi...@debian.org>: >>> Am 20.11.2016 um 16:17 schrieb Rainer Gerhards: >>>> Lucas found the right root cause: It looks like the preload lib is not >>>> loaded on that platform. See >>>> https://github.com/rsyslog/rsyslog/issues/1268 >>> >>> I'm not sure. I can't reproduce the issue with a standard Debian >>> /etc/hosts which contains separate lines for localhost and the hostname. >> >> Well, the key point of the override library is that gethostname() >> ALWAYS returns "", no matter how the system is configured. So if the >> configured name is returned, the preload (or lib) did not work. I'd >> outrule that the lib does not work, as it is ultra-small: > > The override library is definitely loaded. I added some logging output > to getLocalHostname to print out hnbuf. This logs localhost. > Later on, rsyslog decides to use foo as hostname non-theless. > > So my guess, rsyslog uses another code path (not based on gethostname) > to determine the hostname.
I added some printf debug statements to runtime/net.c Looking at getLocalHostname(), we do get an empty hostname from gethostname() (from the overriden library) and at https://github.com/rsyslog/rsyslog/blob/master/runtime/net.c#L1157 hnbuf is set to localhost (as expected). At https://github.com/rsyslog/rsyslog/blob/master/runtime/net.c#L1164 dot is NULL so it calls gethostbyname() and iterates over the aliases. This is where things go wrong. If I have an entry like this 127.0.0.1 foo localhost fqdn is set to foo and this is what's returned from getLocalHostname. Rainer, is that info sufficient for you to take it from here? -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature