ppkarwasz commented on issue #1740: URL: https://github.com/apache/logging-log4j2/issues/1740#issuecomment-5639702958
> Hm... But on Darwin and FreeBSD `gethostname(3)` returns **qualified** hostname. Sorry, you are right: traditions vary. Anyway the result of this call can be qualified or unqualified. For the OP the name was unqualified. > Am I to understand, `InetAddress.getLocalHost()` after `impl.getLocalHostName()` does next..? > > 1. `InetAddress.getLocalHost()` calls `getAllByName0()` for reverse lookup the name (`local`). > 2. `InetAddress.getAllByName0()` calls `NameServiceAddresses.get()` for reverse lookup the name (`host`). > 3. `NameServiceAddresses.get()` calls `getAddressesFromNameService()' for get address for the name (`host`) from a NS. > 4. `InetAddress.getAddressesFromNameService()` calls `lookupByName()` for lookup by the name (`host`). > 5. `PlatformResolver.lookupByName()` calls `lookupAllHostAddr()`, which calls [getaddrinfo()](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html) with the AI_CANONNAME hint, so the C library does resolve a canonical name. > > Is it correct? Yes, the result is similar to `InetAddress.getAllByName()` with the name given by the call above. However, no canonicalization occurs: the JDK does request `AI_CANONNAME`, but it does not use it. It replaces whatever the C library returns with the host name obtained above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
