Resolution differences for getaddrinfo versus host/dig/delv

Tony Finch dot at dotat.at
Wed Nov 18 14:21:23 UTC 2015


Phil Mayers <p.mayers at imperial.ac.uk> wrote:
>
> This hostname is resolvable using "dig" & "host", but on Linux (glibc 2.20)
> the "ping", "telnet" and "nc" commands return "unknown host" or equivalent.

`ping` fails for me on FreeBSD but not MacOS.

> I suspect getaddrinfo isn't parsing the DNS response for some reason.

Well, sort of. The failure is because the resolver is doing name validity
checks along the chain of aliases, and an intermediate wildcard is not a
valid hostname.

For instance, have a look at
https://svnweb.freebsd.org/base/head/lib/libc/net/gethostbydns.c?view=markup#l140

Note the name_ok function pointer which is set to res_hnok for forward
queries, and res_hnok checks LDH syntax (plus underscores).

The old libbind code is similar, as is glibc.

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
Fair Isle, South Faeroes: Cyclonic 4 or 5, occasionally 6, becoming
northeasterly 5 to 7, increasing gale 8 for a time. Rough or very rough,
occasionally moderate. Rain or showers. Moderate or good.


More information about the bind-users mailing list