Description of problem: When the DNS server is unreachable, getaddrinfo is expected to return EAI_AGAIN. This was fixed in RHEL-6 with bug 1044628 but the same fix is useless in RHEL-7. This is because a default RHEL-7 install also has myhostname plugin, which returns NODATA, resulting in getaddrinfo returning EAI_NONAME. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: See reproducer in bug 1098042. Actual results: getaddrinfo returns EAI_NONAME Expected results: getaddrinfo returns EAI_AGAIN Notes: Just to be clear the problem is a fundamental design flaw in nss_myhostname which violates the expectations of the NSS plugin framework, but because the behaviour has shown to be useful we are going to extend the glibc API to support it and we hope that upstream supports this new behaviour. Raised issue upstream to have a conversation about the notion of supporting NSS service plugins that only answer a subset of requests in an authoritative way. https://www.sourceware.org/ml/libc-alpha/2016-05/msg00554.html
I don't think glibc changes are required if nss_myhostname is moved to the front and nss_myhostname uses _gateway instead of gateway for the name it injects. _gateway is not in the IANA namespace for host names, so collisions with DNS are not possible, and no public names can be shadowed. This needs to be fixed in systemd.
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'.
I *really* let the ball drop here... Sorry for that. Anyway, I filed a pull-request in systemd to rename to _gateway. Hopefully it go in soon. But I don't think this actually solves the problem. The issue is that glibc does not provide support for nss modules which only are authoritative only for a subset of names, unless they are at the beginning of the "hosts:". Carlos explains it better than I could in https://www.sourceware.org/ml/libc-alpha/2016-05/msg00554.html, so let me just add an example: Let's say I want to use "files" as a backup, letting "sss" and "dns" take precedence. If I put "hosts: sss dns files", and the first two modules return NSS_STATUS_UNAVAIL/EAGAIN, the last one returns NSS_STATUS_NOTFOUND/ENOENT, and the user sees "No such host" even though "Temporary failure in name resolution" would be more appropriate (and would not poison nscd cache). A module like "files" knows that it is only authoritative for the few names which are listed in /etc/hosts, and cannot say anything useful about other names. So it should be able to make itself ignored, and let the return value from previous modules propagate. (So this is independent from any _gateway vs gateway considerations.) In https://bugzilla.redhat.com/show_bug.cgi?id=1238628#c13 Carlos proposes to add __nss_last_service_result(), to allow the modules to "propagate" the return value from preceding modules. I can also see an alternative solution: adding a new return code, that would tell the resolver function that this module cannot provide an authoritative answer. If any other module provides an authoritative answer, that answer it returned. In no other module provides an authoritative answer, EAI_NONAME is returned. This could be implemented as either a new NSS_STATUS code (NSS_STATUS_NONAUTHORITATIVE without *errnop and *h_errnop being set). The advantage of a new return code is that it puts the logic in glibc, and allows the modules to be kept simple. But either option would work from nss-myhostname's point of view, so I'd defer to glibc maintainers to decide what is easier/more backwards compatible/etc.
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle. Changing version to '27'.
This message is a reminder that Fedora 27 is nearing its end of life. On 2018-Nov-30 Fedora will stop maintaining and issuing updates for Fedora 27. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '27'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 27 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.
FWIW, systemd in F28+ uses _gateway. But the more general issue still exists for nss-resolve and other modules. I'll retitle the bug accordingly.
DJ published a blog post asking for developer feedback about improving nsswicth.conf, and it is directly related to this issue and how to handle the description of what a service is authoritative for: https://developers.redhat.com/blog/2018/11/26/etc-nsswitch-conf-non-complexity/