On Tue, Jul 25, 2017 at 09:48:11PM -0400, Roland C. Dowdeswell wrote: > On Tue, Jul 25, 2017 at 11:20:57PM +0200, u-hd-p...@aetey.se wrote: > > > As you can see, getaddrinfo(3) will only use DNS to chase the CNAME > > > defined in DNS and does not consult /etc/hosts in the middle of a > > > > You refer to a certain implementation which is not a specification > > by itself. What do the applicable standards say? > > Since we are discussing our processing of SRVs rather than CNAMEs, I'll > limit my conversation to the relevant stanards for SRVs.
As Russ already pointed out, the DNS standard is not an authority which defines the behaviour of the applicable APIs. Of course widely used implementations may create "de-facto standards" but this discussion shows that there is no apparent consensus about how name lookup is supposed to happen. So unless we find a relevant standard reference saying otherwise, the least surprise approach should reflect the practice of treating /etc/hosts as a part of service name resolution. Note, it is "service names to endpoints resolution" which I mean, irrespectively of which technologies (DNS/non-DNS) are being used for the purpose and possibly behind the scenes. Name-to-endpoint mapping data is traditionally spread across multiple local and more or less global databases like /etc/hosts, /etc/services, various DNS servers and more. Is there an API specification which says "if a lookup implies multiple steps and begins against a certain database instance, then all of the possibly needed additional lookups must use the same database instance (or the same technology/protocol/implementation?)"? I may be wrong but I doubt this. Regards, Rune